summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CommonAPI/DBus/DBusAddress.cpp102
-rw-r--r--src/CommonAPI/DBus/DBusAddressTranslator.cpp370
-rw-r--r--src/CommonAPI/DBus/DBusAddressTranslator.h84
-rw-r--r--src/CommonAPI/DBus/DBusAttribute.h549
-rw-r--r--src/CommonAPI/DBus/DBusClientId.cpp23
-rw-r--r--src/CommonAPI/DBus/DBusClientId.h48
-rw-r--r--src/CommonAPI/DBus/DBusConfiguration.cpp264
-rw-r--r--src/CommonAPI/DBus/DBusConfiguration.h74
-rw-r--r--src/CommonAPI/DBus/DBusConnection.cpp615
-rw-r--r--src/CommonAPI/DBus/DBusConnection.h242
-rw-r--r--src/CommonAPI/DBus/DBusConnectionBusType.h26
-rw-r--r--src/CommonAPI/DBus/DBusDaemonProxy.cpp102
-rw-r--r--src/CommonAPI/DBus/DBusDaemonProxy.h101
-rw-r--r--src/CommonAPI/DBus/DBusDeployment.cpp14
-rw-r--r--src/CommonAPI/DBus/DBusError.cpp16
-rw-r--r--src/CommonAPI/DBus/DBusError.h45
-rw-r--r--src/CommonAPI/DBus/DBusEvent.h110
-rw-r--r--src/CommonAPI/DBus/DBusFactory.cpp459
-rw-r--r--src/CommonAPI/DBus/DBusFactory.h93
-rw-r--r--src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp128
-rw-r--r--src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.h60
-rw-r--r--src/CommonAPI/DBus/DBusFunctionalHash.cpp17
-rw-r--r--src/CommonAPI/DBus/DBusFunctionalHash.h80
-rw-r--r--src/CommonAPI/DBus/DBusHelper.h42
-rw-r--r--src/CommonAPI/DBus/DBusInputStream.cpp369
-rw-r--r--src/CommonAPI/DBus/DBusInputStream.h233
-rw-r--r--src/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.h140
-rw-r--r--src/CommonAPI/DBus/DBusInterfaceHandler.h32
-rw-r--r--src/CommonAPI/DBus/DBusLegacyVariant.h138
-rw-r--r--src/CommonAPI/DBus/DBusMainLoopContext.cpp54
-rw-r--r--src/CommonAPI/DBus/DBusMainLoopContext.h92
-rw-r--r--src/CommonAPI/DBus/DBusMessage.cpp312
-rw-r--r--src/CommonAPI/DBus/DBusMessage.h117
-rw-r--r--src/CommonAPI/DBus/DBusMultiEvent.h121
-rw-r--r--src/CommonAPI/DBus/DBusObjectManager.cpp76
-rw-r--r--src/CommonAPI/DBus/DBusObjectManager.h72
-rw-r--r--src/CommonAPI/DBus/DBusObjectManagerStub.cpp50
-rw-r--r--src/CommonAPI/DBus/DBusObjectManagerStub.h127
-rw-r--r--src/CommonAPI/DBus/DBusOutputStream.cpp374
-rw-r--r--src/CommonAPI/DBus/DBusOutputStream.h351
-rw-r--r--src/CommonAPI/DBus/DBusProxy.cpp83
-rw-r--r--src/CommonAPI/DBus/DBusProxy.h106
-rw-r--r--src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h79
-rw-r--r--src/CommonAPI/DBus/DBusProxyBase.cpp56
-rw-r--r--src/CommonAPI/DBus/DBusProxyBase.h75
-rw-r--r--src/CommonAPI/DBus/DBusProxyConnection.h135
-rw-r--r--src/CommonAPI/DBus/DBusProxyHelper.h283
-rw-r--r--src/CommonAPI/DBus/DBusProxyManager.cpp237
-rw-r--r--src/CommonAPI/DBus/DBusProxyManager.h74
-rw-r--r--src/CommonAPI/DBus/DBusRuntime.cpp86
-rw-r--r--src/CommonAPI/DBus/DBusRuntime.h39
-rw-r--r--src/CommonAPI/DBus/DBusSelectiveEvent.h101
-rw-r--r--src/CommonAPI/DBus/DBusSerializableArguments.h66
-rw-r--r--src/CommonAPI/DBus/DBusServicePublisher.cpp155
-rw-r--r--src/CommonAPI/DBus/DBusServicePublisher.h61
-rw-r--r--src/CommonAPI/DBus/DBusServiceRegistry.cpp287
-rw-r--r--src/CommonAPI/DBus/DBusServiceRegistry.h319
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapter.cpp91
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapter.h86
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapterHelper.h838
-rw-r--r--src/CommonAPI/DBus/DBusUtils.h39
-rw-r--r--src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch201
-rw-r--r--src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch217
-rw-r--r--src/murmurhash/MurmurHash3.cpp2
-rw-r--r--src/murmurhash/MurmurHash3.h37
-rw-r--r--src/pugixml/pugiconfig.hpp69
-rw-r--r--src/pugixml/pugixml.cpp2
-rw-r--r--src/pugixml/pugixml.hpp1265
-rw-r--r--src/test/CMakeLists.txt469
-rw-r--r--src/test/DBusAddressTranslatorTest.cpp489
-rw-r--r--src/test/DBusBroadcastTest.cpp242
-rw-r--r--src/test/DBusClientIdTest.cpp20
-rw-r--r--src/test/DBusCommunicationTest.cpp224
-rw-r--r--src/test/DBusConnectionTest.cpp256
-rw-r--r--src/test/DBusDaemonProxyTest.cpp33
-rw-r--r--src/test/DBusFactoryTest.cpp105
-rw-r--r--src/test/DBusFreedesktopPropertiesTest.cpp90
-rw-r--r--src/test/DBusInputStreamTest.cpp190
-rw-r--r--src/test/DBusLoadTest.cpp111
-rw-r--r--src/test/DBusMainLoopIntegrationTest.cpp201
-rw-r--r--src/test/DBusManagedTest.cpp197
-rw-r--r--src/test/DBusMultipleConnectionTest.cpp52
-rw-r--r--src/test/DBusNameCacheTest.cpp30
-rw-r--r--src/test/DBusObjectManagerStubTest.cpp64
-rw-r--r--src/test/DBusOutputStreamTest.cpp358
-rw-r--r--src/test/DBusPolymorphicTest.cpp159
-rw-r--r--src/test/DBusProxyTest.cpp195
-rw-r--r--src/test/DBusRuntimeTest.cpp55
-rw-r--r--src/test/DBusSerializableStructTest.cpp79
-rw-r--r--src/test/DBusSerializableStructTest.h68
-rw-r--r--src/test/DBusServicePublisherTest.cpp82
-rw-r--r--src/test/DBusServiceRegistryTest.cpp107
-rw-r--r--src/test/DBusStubAdapterTest.cpp34
-rw-r--r--src/test/DBusTestUtils.hpp (renamed from src/test/DBusTestUtils.h)18
-rw-r--r--src/test/DBusTypeStreamTest.cpp40
-rw-r--r--src/test/DBusVariantOutputStreamTest.cpp114
-rw-r--r--src/test/DBusVariantTest.cpp21
-rw-r--r--src/test/DemoMainLoop.hpp (renamed from src/test/DemoMainLoop.h)47
-rw-r--r--src/test/README.txt12
-rw-r--r--src/test/commonapi-dbus.ini41
-rw-r--r--src/test/commonapi/tests/DerivedTypeCollection.cpp227
-rw-r--r--src/test/commonapi/tests/DerivedTypeCollection.h476
-rw-r--r--src/test/commonapi/tests/DerivedTypeCollection.hpp354
-rw-r--r--src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp78
-rw-r--r--src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h60
-rw-r--r--src/test/commonapi/tests/ExtendedInterfaceProxyBase.h47
-rw-r--r--src/test/commonapi/tests/PredefinedTypeCollection.hpp (renamed from src/test/commonapi/tests/PredefinedTypeCollection.h)20
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterface.h60
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp63
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.h61
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.h199
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.h44
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStub.h102
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp88
-rw-r--r--src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.h74
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterface.h59
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp68
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.h66
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterfaceProxy.h280
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterfaceProxyBase.h52
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterfaceStub.h127
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp211
-rw-r--r--src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.h104
-rw-r--r--src/test/commonapi/tests/TestInterfaceDBusProxy.cpp245
-rw-r--r--src/test/commonapi/tests/TestInterfaceDBusProxy.h91
-rw-r--r--src/test/commonapi/tests/TestInterfaceProxyBase.h92
-rw-r--r--src/test/commonapi/tests/TestInterfaceStubDefault.cpp285
-rw-r--r--src/test/commonapi/tests/TestInterfaceStubDefault.h137
-rw-r--r--src/test/commonapi/tests/managed/BranchInterface.h91
-rw-r--r--src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp74
-rw-r--r--src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h61
-rw-r--r--src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h112
-rw-r--r--src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h48
-rw-r--r--src/test/commonapi/tests/managed/LeafInterface.h91
-rw-r--r--src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp74
-rw-r--r--src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h61
-rw-r--r--src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h112
-rw-r--r--src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h48
-rw-r--r--src/test/commonapi/tests/managed/RootInterface.h92
-rw-r--r--src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp82
-rw-r--r--src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h66
-rw-r--r--src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp253
-rw-r--r--src/test/commonapi/tests/managed/RootInterfaceProxyBase.h53
-rw-r--r--src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp81
-rw-r--r--src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp58
-rw-r--r--src/test/commonapi/tests/managed/SecondRootDBusProxy.h62
-rw-r--r--src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp178
-rw-r--r--src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h111
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp108
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingDefinitions.h20
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp13
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp2
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp11
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp12
-rw-r--r--src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h2
-rw-r--r--src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp107
-rw-r--r--src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h65
-rw-r--r--src/test/fake/legacy/service/LegacyInterfaceProxyBase.h54
-rw-r--r--src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp64
-rw-r--r--src/test/fakeLegacyService.fidl5
-rw-r--r--src/test/fakeLegacyService/fakeLegacyService.py6
-rw-r--r--src/test/fakeLegacyService/sendToFakeLegacyService.py6
-rw-r--r--src/test/leaf.fidl8
-rw-r--r--src/test/root.fidl8
-rw-r--r--src/test/src-gen/commonapi/tests/DerivedTypeCollection.cpp76
-rw-r--r--src/test/src-gen/commonapi/tests/DerivedTypeCollection.hpp375
-rw-r--r--src/test/src-gen/commonapi/tests/PredefinedTypeCollection.hpp64
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterface.hpp (renamed from src/test/commonapi/tests/ExtendedInterface.h)36
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp69
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp61
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp (renamed from src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp)112
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp (renamed from src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h)118
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceProxy.hpp (renamed from src/test/commonapi/tests/ExtendedInterfaceProxy.h)76
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp50
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStub.hpp (renamed from src/test/commonapi/tests/ExtendedInterfaceStub.h)44
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.cpp (renamed from src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp)31
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp (renamed from src/test/commonapi/tests/ExtendedInterfaceStubDefault.h)36
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp51
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp66
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp (renamed from src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp)76
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp (renamed from src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.h)105
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp62
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp74
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp (renamed from src/test/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp)75
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp (renamed from src/test/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.h)92
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterface.hpp (renamed from src/test/commonapi/tests/TestInterface.h)31
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp266
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp92
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.cpp (renamed from src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp)201
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp (renamed from src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h)113
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceProxy.hpp (renamed from src/test/commonapi/tests/TestInterfaceProxy.h)182
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceProxyBase.hpp98
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStub.hpp (renamed from src/test/commonapi/tests/TestInterfaceStub.h)117
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.cpp268
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.hpp122
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.cpp26
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.hpp64
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp71
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp62
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp (renamed from src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp)71
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp103
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceProxy.hpp (renamed from src/test/commonapi/tests/managed/BranchInterfaceProxy.h)72
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp51
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp (renamed from src/test/commonapi/tests/managed/BranchInterfaceStub.h)39
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.cpp (renamed from src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp)31
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp (renamed from src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h)33
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.cpp26
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.hpp64
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp71
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp62
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp (renamed from src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp)71
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp103
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceProxy.hpp (renamed from src/test/commonapi/tests/managed/LeafInterfaceProxy.h)72
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp51
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp (renamed from src/test/commonapi/tests/managed/LeafInterfaceStub.h)39
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.cpp (renamed from src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp)31
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp (renamed from src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h)33
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.cpp26
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.hpp65
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp79
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp67
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp222
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp (renamed from src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h)81
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceProxy.hpp (renamed from src/test/commonapi/tests/managed/RootInterfaceProxy.h)72
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp56
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStub.hpp (renamed from src/test/commonapi/tests/managed/RootInterfaceStub.h)43
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp92
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp (renamed from src/test/commonapi/tests/managed/RootInterfaceStubDefault.h)33
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRoot.hpp (renamed from src/test/commonapi/tests/managed/SecondRoot.h)31
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.cpp52
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.hpp63
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp151
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp104
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootProxy.hpp (renamed from src/test/commonapi/tests/managed/SecondRootProxy.h)60
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp (renamed from src/test/commonapi/tests/managed/SecondRootProxyBase.h)25
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStub.hpp (renamed from src/test/commonapi/tests/managed/SecondRootStub.h)38
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStubDefault.cpp (renamed from src/test/commonapi/tests/managed/SecondRootStubDefault.cpp)38
-rw-r--r--src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStubDefault.hpp (renamed from src/test/commonapi/tests/managed/SecondRootStubDefault.h)29
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterface.hpp (renamed from src/test/fake/legacy/service/LegacyInterface.h)31
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp110
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp66
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp (renamed from src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp)75
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp (renamed from src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.h)79
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceProxy.hpp (renamed from src/test/fake/legacy/service/LegacyInterfaceProxy.h)96
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp57
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStub.hpp (renamed from src/test/fake/legacy/service/LegacyInterfaceStub.h)45
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.cpp60
-rw-r--r--src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.hpp (renamed from src/test/fake/legacy/service/LegacyInterfaceStubDefault.h)41
-rw-r--r--src/test/test-derived-types.fidl8
-rw-r--r--src/test/test-freedesktop-interface.fdepl9
-rw-r--r--src/test/test-freedesktop-interface.fidl8
-rw-r--r--src/test/test-interface-proxy.fidl8
-rw-r--r--src/test/test-predefined-types.fidl8
253 files changed, 9973 insertions, 18323 deletions
diff --git a/src/CommonAPI/DBus/DBusAddress.cpp b/src/CommonAPI/DBus/DBusAddress.cpp
new file mode 100644
index 0000000..f317e57
--- /dev/null
+++ b/src/CommonAPI/DBus/DBusAddress.cpp
@@ -0,0 +1,102 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <algorithm>
+
+#include <CommonAPI/DBus/DBusAddress.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+DBusAddress::DBusAddress(const std::string &_service,
+ 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_) {
+}
+
+DBusAddress::~DBusAddress() {
+}
+
+bool
+DBusAddress::operator==(const DBusAddress &_other) const {
+ 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_);
+}
+
+bool
+DBusAddress::operator<(const DBusAddress &_other) const {
+ if (service_ < _other.service_)
+ return true;
+
+ if (service_ == _other.service_) {
+ if (objectPath_ < _other.objectPath_)
+ return true;
+
+ if (objectPath_ == _other.objectPath_) {
+ if (interface_ < _other.interface_)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+const std::string &
+DBusAddress::getService() const {
+ return service_;
+}
+
+void
+DBusAddress::setService(const std::string &_service) {
+ service_ = _service;
+}
+
+const std::string &
+DBusAddress::getObjectPath() const {
+ return objectPath_;
+}
+
+void
+DBusAddress::setObjectPath(const std::string &_objectPath) {
+ objectPath_ = _objectPath;
+}
+
+const std::string &
+DBusAddress::getInterface() const {
+ return interface_;
+}
+
+void
+DBusAddress::setInterface(const std::string &_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;
+}
+
+
+} // namespace DBus
+} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusAddressTranslator.cpp b/src/CommonAPI/DBus/DBusAddressTranslator.cpp
index 92f432c..5c5e3f1 100644
--- a/src/CommonAPI/DBus/DBusAddressTranslator.cpp
+++ b/src/CommonAPI/DBus/DBusAddressTranslator.cpp
@@ -1,149 +1,295 @@
-/* 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/. */
+// 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 <Windows.h>
+#else
+#include <unistd.h>
+#endif
-#include <CommonAPI/utils.h>
+#include <sys/stat.h>
-#include "DBusAddressTranslator.h"
-
-#include "DBusConnection.h"
-#include "DBusFactory.h"
-
-#include "DBusConnection.h"
-#include "DBusFactory.h"
-
-#include <unordered_set>
-#include <string.h>
-#include <iostream>
-#include <fstream>
-#include <cassert>
-#include <sstream>
+#include <algorithm>
+#include <CommonAPI/IniFileReader.hpp>
+#include <CommonAPI/Logger.hpp>
+#include <CommonAPI/Runtime.hpp>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
namespace CommonAPI {
namespace DBus {
+const char *COMMONAPI_DBUS_DEFAULT_CONFIG_FILE = "commonapi-dbus.ini";
+const char *COMMONAPI_DBUS_DEFAULT_CONFIG_FOLDER = "/etc/";
+
+const std::size_t DBUS_MAXIMUM_NAME_LENGTH = 255;
-DBusAddressTranslator::DBusAddressTranslator() {}
+static std::shared_ptr<DBusAddressTranslator> theTranslator = std::make_shared<DBusAddressTranslator>();
-void DBusAddressTranslator::init() {
- commonApiAddressDetails_ = DBusConfiguration::getInstance().getCommonApiAddressDetails();
- for (auto& addressDetail: commonApiAddressDetails_) {
- fillUndefinedValues(addressDetail.second, addressDetail.first);
- DBusServiceAddress dbusServiceDefinition = std::get<0>(addressDetail.second);
- dbusToCommonApiAddress_.insert( {dbusServiceDefinition, addressDetail.first});
- }
+std::shared_ptr<DBusAddressTranslator> DBusAddressTranslator::get() {
+ return theTranslator;
}
-DBusAddressTranslator& DBusAddressTranslator::getInstance() {
- static DBusAddressTranslator* dbusAddressTranslator;
- if(!dbusAddressTranslator) {
- dbusAddressTranslator = new DBusAddressTranslator();
- dbusAddressTranslator->init();
- }
- return *dbusAddressTranslator;
+DBusAddressTranslator::DBusAddressTranslator()
+ : defaultDomain_("local") {
+ init();
+
+ 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 DBusAddressTranslator::searchForDBusAddress(const std::string& domain,
- const std::string& interf,
- const std::string& instance,
- std::string& interfaceName,
- std::string& connectionName,
- std::string& objectPath) {
- std::stringstream ss;
- ss << domain << ":" << interf << ":" << instance;
- searchForDBusAddress(ss.str(), interfaceName, connectionName, objectPath);
+ (void)readConfiguration();
}
-void DBusAddressTranslator::searchForDBusAddress(const std::string& commonApiAddress,
- std::string& interfaceName,
- std::string& connectionName,
- std::string& objectPath) {
-
- const auto& foundAddressMapping = commonApiAddressDetails_.find(commonApiAddress);
-
- if (foundAddressMapping != commonApiAddressDetails_.end()) {
- connectionName = std::get<0>(std::get<0>(foundAddressMapping->second));
- objectPath = std::get<1>(std::get<0>(foundAddressMapping->second));
- interfaceName = std::get<2>(std::get<0>(foundAddressMapping->second));
- } else {
- findFallbackDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);
- commonApiAddressDetails_.insert( {commonApiAddress, std::make_tuple(std::make_tuple(connectionName, objectPath, interfaceName), false) } );
- }
+bool
+DBusAddressTranslator::translate(const std::string &_key, DBusAddress &_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());
-void DBusAddressTranslator::fillUndefinedValues(CommonApiServiceDetails& serviceDetails, const std::string& commonApiAddress) const {
- std::string connectionName;
- std::string objectPath;
- std::string interfaceName;
+ if (isValid(service, '.', false, false, true)
+ && isValid(objectPath, '/', true)
+ && isValid(interfaceName, '.')) {
+ _value.setInterface(interfaceName);
+ _value.setObjectPath(objectPath);
+ _value.setService(service);
- findFallbackDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);
+ forwards_.insert({ _key, _value });
+ backwards_.insert({ _value, _key });
+ }
+ } else {
+ result = false;
+ }
- std::get<0>(std::get<0>(serviceDetails)) = std::get<0>(std::get<0>(serviceDetails)) == "" ? connectionName : std::get<0>(std::get<0>(serviceDetails));
- std::get<1>(std::get<0>(serviceDetails)) = std::get<1>(std::get<0>(serviceDetails)) == "" ? objectPath : std::get<1>(std::get<0>(serviceDetails));
- std::get<2>(std::get<0>(serviceDetails)) = std::get<2>(std::get<0>(serviceDetails)) == "" ? interfaceName : std::get<2>(std::get<0>(serviceDetails));
+ 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;
+}
-void DBusAddressTranslator::searchForCommonAddress(const std::string& interfaceName,
- const std::string& connectionName,
- const std::string& objectPath,
- std::string& commonApiAddress) {
+bool
+DBusAddressTranslator::translate(const DBusAddress &_key, CommonAPI::Address &_value) {
+ bool result(true);
+ std::lock_guard<std::mutex> itsLock(mutex_);
- DBusServiceAddress dbusAddress(connectionName, objectPath, interfaceName);
+ 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(), '/', '.');
- const auto& foundAddressMapping = dbusToCommonApiAddress_.find(dbusAddress);
- if (foundAddressMapping != dbusToCommonApiAddress_.end()) {
- commonApiAddress = foundAddressMapping->second;
- } else {
- findFallbackCommonAddress(commonApiAddress, interfaceName, connectionName, objectPath);
- dbusToCommonApiAddress_.insert( {std::move(dbusAddress), commonApiAddress} );
- }
-}
+ _value.setDomain(defaultDomain_);
+ _value.setInterface(interfaceName);
+ _value.setInstance(instance);
-void DBusAddressTranslator::getPredefinedInstances(const std::string& connectionName,
- std::vector<DBusServiceAddress>& instances) {
- instances.clear();
- auto dbusAddress = commonApiAddressDetails_.begin();
- while (dbusAddress != commonApiAddressDetails_.end()) {
- CommonApiServiceDetails serviceDetails = dbusAddress->second;
- if (connectionName == std::get<0>(std::get<0>(serviceDetails))
- && true == std::get<1>(serviceDetails)) {
- instances.push_back(std::get<0>(serviceDetails));
- }
- dbusAddress++;
- }
+ forwards_.insert({_value, _key});
+ backwards_.insert({_key, _value});
+ } else {
+ result = false;
+ }
+ } else {
+ result = false;
+ }
+
+ return result;
}
-void DBusAddressTranslator::findFallbackDBusAddress(const std::string& commonApiAddress,
- std::string& interfaceName,
- std::string& connectionName,
- std::string& objectPath) const {
- std::vector<std::string> parts = split(commonApiAddress, ':');
- interfaceName = parts[1];
- connectionName = parts[2];
- objectPath = '/' + parts[2];
- std::replace(objectPath.begin(), objectPath.end(), '.', '/');
+
+void
+DBusAddressTranslator::insert(
+ const std::string &_address,
+ const std::string &_service, const std::string &_path, const std::string &_interface) {
+
+ if (isValid(_service, '.',
+ (_service.length() > 0 && _service[0] == ':'),
+ (_service.length() > 0 && _service[0] == ':'),
+ true)
+ && isValid(_path, '/', true)
+ && 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);
+ } 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);
+ }
+ }
}
-void DBusAddressTranslator::findFallbackCommonAddress(std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& connectionName,
- const std::string& objectPath) const {
- commonApiAddress = "local:" + interfaceName + ":" + transfromObjectPathToInstance(objectPath);
+bool
+DBusAddressTranslator::readConfiguration() {
+#define MAX_PATH_LEN 255
+ std::string config;
+ char currentDirectory[MAX_PATH_LEN];
+#ifdef WIN32
+ if (GetCurrentDirectory(MAX_PATH_LEN, currentDirectory)) {
+#else
+ 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()) {
+ 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;
}
-std::string DBusAddressTranslator::transfromObjectPathToInstance(const std::string& path) const {
- std::string out = path.substr(1, std::string::npos);
- std::replace(out.begin(), out.end(), '/', '.');
- return out;
+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)
+ 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;
}
-}// namespace DBus
+} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusAddressTranslator.h b/src/CommonAPI/DBus/DBusAddressTranslator.h
deleted file mode 100644
index c1b29df..0000000
--- a/src/CommonAPI/DBus/DBusAddressTranslator.h
+++ /dev/null
@@ -1,84 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_ADDRESS_TRANSLATOR_H_
-#define COMMONAPI_DBUS_DBUS_ADDRESS_TRANSLATOR_H_
-
-#include <CommonAPI/types.h>
-
-#include "DBusConnectionBusType.h"
-#include "DBusFunctionalHash.h"
-#include "DBusConfiguration.h"
-
-#include <algorithm>
-#include <unordered_map>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-
-class DBusAddressTranslator {
-public:
- ~DBusAddressTranslator();
-
- static DBusAddressTranslator& getInstance();
-
- void searchForDBusAddress(const std::string& domain,
- const std::string& interf,
- const std::string& instance,
- std::string& interfaceName,
- std::string& connectionName,
- std::string& objectPath);
-
- void searchForDBusAddress(const std::string& commonApiAddress,
- std::string& interfaceName,
- std::string& connectionName,
- std::string& objectPath);
-
- void searchForCommonAddress(const std::string& interfaceName,
- const std::string& connectionName,
- const std::string& objectPath,
- std::string& commonApiAddress);
-
- void getPredefinedInstances(const std::string& connectionName,
- std::vector<DBusServiceAddress>& instances);
-
-private:
- DBusAddressTranslator();
- DBusAddressTranslator(const DBusAddressTranslator&) = delete;
- DBusAddressTranslator& operator=(const DBusAddressTranslator&) = delete;
-
- void init();
-
- void findFallbackDBusAddress(const std::string& instanceId,
- std::string& interfaceName,
- std::string& connectionName,
- std::string& objectPath) const;
-
- void findFallbackCommonAddress(std::string& instanceId,
- const std::string& interfaceName,
- const std::string& connectionName,
- const std::string& objectPath) const;
-
- void fillUndefinedValues(CommonApiServiceDetails& serviceDetails, const std::string& commonApiAddress) const;
-
- std::string transfromObjectPathToInstance(const std::string& path) const;
-
- std::unordered_map<std::string, CommonApiServiceDetails> commonApiAddressDetails_;
- std::unordered_map<DBusServiceAddress, std::string> dbusToCommonApiAddress_;
-};
-
-
-}// namespace DBus
-}// namespace CommonAPI
-
-#endif /* COMMONAPI_DBUS_DBUS_ADDRESS_TRANSLATOR_H_ */
diff --git a/src/CommonAPI/DBus/DBusAttribute.h b/src/CommonAPI/DBus/DBusAttribute.h
deleted file mode 100644
index 146a190..0000000
--- a/src/CommonAPI/DBus/DBusAttribute.h
+++ /dev/null
@@ -1,549 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_ATTRIBUTE_H_
-#define COMMONAPI_DBUS_DBUS_ATTRIBUTE_H_
-
-#include "DBusProxyHelper.h"
-#include "DBusEvent.h"
-#include <stdint.h>
-#include "DBusLegacyVariant.h"
-
-#include <cassert>
-
-namespace CommonAPI {
-namespace DBus {
-
-
-class DBusProxy;
-
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusReadonlyAttribute: public _AttributeType {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusReadonlyAttribute(_DBusProxyType& dbusProxy, const char* setMethodSignature, const char* getMethodName):
- dbusProxy_(dbusProxy),
- getMethodName_(getMethodName),
- setMethodSignature_(setMethodSignature) {
- assert(getMethodName);
- }
-
- void getValue(CallStatus& callStatus, ValueType& value) const {
-
- DBusProxyHelper<DBusSerializableArguments<>,
- DBusSerializableArguments<ValueType> >::callMethodWithReply(dbusProxy_, getMethodName_, "", callStatus, value);
- }
-
- std::future<CallStatus> getValueAsync(AttributeAsyncCallback attributeAsyncCallback) {
- return DBusProxyHelper<DBusSerializableArguments<>,
- DBusSerializableArguments<ValueType> >::callMethodAsync(dbusProxy_, getMethodName_, "", std::move(attributeAsyncCallback));
- }
-
- protected:
- _DBusProxyType& dbusProxy_;
- const char* getMethodName_;
- const char* setMethodSignature_;
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusFreedesktopReadonlyAttribute: public _AttributeType {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusFreedesktopReadonlyAttribute(_DBusProxyType& dbusProxy, const char* interfaceName, const char* propertyName):
- dbusProxy_(dbusProxy),
- interfaceName_(interfaceName),
- propertyName_(propertyName)
- {
- assert(interfaceName);
- assert(propertyName);
- }
-
- void getValue(CallStatus& callStatus, ValueType& value) const {
- DBusLegacyVariantWrapper<Variant<ValueType> > variantVal;
- DBusProxyHelper<DBusSerializableArguments<std::string, std::string>,
- DBusSerializableArguments<DBusLegacyVariantWrapper<Variant<ValueType> > > >::callMethodWithReply(
- dbusProxy_,
- dbusProxy_.getDBusBusName().c_str(),
- dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Get",
- "ss",
- interfaceName_,
- propertyName_,
- callStatus,
- variantVal);
- value = variantVal.contained_.template get<ValueType>();
-
- }
-
- std::future<CallStatus> getValueAsync(AttributeAsyncCallback attributeAsyncCallback) {
- return DBusProxyHelper<DBusSerializableArguments<std::string, std::string>,
- DBusSerializableArguments<DBusLegacyVariantWrapper<Variant<ValueType> > > >::callMethodAsync(
- dbusProxy_,
- dbusProxy_.getDBusBusName().c_str(),
- dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Get",
- "ss",
- interfaceName_,
- propertyName_,
- std::bind(
- &CommonAPI::DBus::DBusFreedesktopReadonlyAttribute<_AttributeType>::AsyncVariantStripper,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::move(attributeAsyncCallback)));
- }
-
- void AsyncVariantStripper(const CommonAPI::CallStatus& status,
- const DBusLegacyVariantWrapper<Variant<ValueType> >& value,
- AttributeAsyncCallback attributeAsyncCallback) {
- attributeAsyncCallback(status, value.contained_.template get<ValueType>());
- }
-
- protected:
- _DBusProxyType& dbusProxy_;
- const std::string interfaceName_;
- const std::string propertyName_;
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusFreedesktopUnionReadonlyAttribute: public _AttributeType {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusFreedesktopUnionReadonlyAttribute(_DBusProxyType& dbusProxy, const char* interfaceName, const char* propertyName):
- dbusProxy_(dbusProxy),
- interfaceName_(interfaceName),
- propertyName_(propertyName)
- {
- assert(interfaceName);
- assert(propertyName);
- }
-
- void getValue(CallStatus& callStatus, ValueType& value) const {
- DBusLegacyVariantWrapper<ValueType> variantVal(value);
- DBusProxyHelper<DBusSerializableArguments<std::string, std::string>,
- DBusSerializableArguments<DBusLegacyVariantWrapper<ValueType> > >::callMethodWithReply(
- dbusProxy_,
- dbusProxy_.getDBusBusName().c_str(),
- dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Get",
- "ss",
- interfaceName_,
- propertyName_,
- callStatus,
- variantVal);
- value = variantVal.contained_;
- }
-
- std::future<CallStatus> getValueAsync(AttributeAsyncCallback attributeAsyncCallback) {
- return DBusProxyHelper<DBusSerializableArguments<std::string, std::string>,
- DBusSerializableArguments<DBusLegacyVariantWrapper<ValueType> > >::callMethodAsync(
- dbusProxy_,
- dbusProxy_.getDBusBusName().c_str(),
- dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Get",
- "ss",
- interfaceName_,
- propertyName_,
- std::bind(
- &CommonAPI::DBus::DBusFreedesktopUnionReadonlyAttribute<_AttributeType>::AsyncVariantStripper,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::move(attributeAsyncCallback)));
- }
-
- void AsyncVariantStripper(const CommonAPI::CallStatus& status,
- const DBusLegacyVariantWrapper<ValueType>& value,
- AttributeAsyncCallback attributeAsyncCallback) {
- attributeAsyncCallback(status, value.contained_);
- }
-
- protected:
- _DBusProxyType& dbusProxy_;
- const std::string interfaceName_;
- const std::string propertyName_;
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusAttribute: public DBusReadonlyAttribute<_AttributeType> {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusAttribute(_DBusProxyType& dbusProxy, const char* setMethodName, const char* setMethodSignature, const char* getMethodName):
- DBusReadonlyAttribute<_AttributeType>(dbusProxy, setMethodSignature, getMethodName),
- setMethodName_(setMethodName),
- setMethodSignature_(setMethodSignature) {
- assert(setMethodName);
- assert(setMethodSignature);
- }
-
- void setValue(const ValueType& requestValue, CallStatus& callStatus, ValueType& responseValue) {
- DBusProxyHelper<DBusSerializableArguments<ValueType>,
- DBusSerializableArguments<ValueType> >::callMethodWithReply(
- this->dbusProxy_,
- setMethodName_,
- setMethodSignature_,
- requestValue,
- callStatus,
- responseValue);
- }
-
-
- std::future<CallStatus> setValueAsync(const ValueType& requestValue, AttributeAsyncCallback attributeAsyncCallback) {
- return DBusProxyHelper<DBusSerializableArguments<ValueType>,
- DBusSerializableArguments<ValueType> >::callMethodAsync(
- this->dbusProxy_,
- setMethodName_,
- setMethodSignature_,
- requestValue,
- attributeAsyncCallback);
- }
-
- protected:
- const char* setMethodName_;
- const char* setMethodSignature_;
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusFreedesktopAttribute: public DBusFreedesktopReadonlyAttribute<_AttributeType, _DBusProxyType> {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusFreedesktopAttribute(_DBusProxyType& dbusProxy,
- const char* interfaceName,
- const char* propertyName) :
- DBusFreedesktopReadonlyAttribute<_AttributeType>(dbusProxy, interfaceName, propertyName)
- {
- assert(interfaceName);
- assert(propertyName);
- }
-
-
- void setValue(const ValueType& requestValue, CallStatus& callStatus, ValueType& responseValue) {
- DBusLegacyVariantWrapper<Variant<ValueType> > variantVal;
- variantVal.contained_ = Variant<ValueType>(requestValue);
- DBusProxyHelper<DBusSerializableArguments<std::string, std::string, DBusLegacyVariantWrapper<Variant<ValueType> > >,
- DBusSerializableArguments<> >::callMethodWithReply(
- DBusFreedesktopReadonlyAttribute<_AttributeType>::dbusProxy_,
- DBusFreedesktopReadonlyAttribute<_AttributeType>::dbusProxy_.getDBusBusName().c_str(),
- DBusFreedesktopReadonlyAttribute<_AttributeType>::dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
- DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
- variantVal,
- callStatus);
- responseValue = requestValue;
- }
-
- std::future<CallStatus> setValueAsync(const ValueType& requestValue, AttributeAsyncCallback attributeAsyncCallback) {
- DBusLegacyVariantWrapper<Variant<ValueType> > variantVal;
- variantVal.contained_ = Variant<ValueType>(requestValue);
- return DBusProxyHelper<DBusSerializableArguments<std::string, std::string, DBusLegacyVariantWrapper<Variant<ValueType> > >,
- DBusSerializableArguments<> >::callMethodAsync(
- DBusFreedesktopReadonlyAttribute<_AttributeType>::dbusProxy_,
- DBusFreedesktopReadonlyAttribute<_AttributeType>::dbusProxy_.getDBusBusName().c_str(),
- DBusFreedesktopReadonlyAttribute<_AttributeType>::dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
- DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
- variantVal,
- std::bind(
- &CommonAPI::DBus::DBusFreedesktopAttribute<_AttributeType>::AsyncVariantStripper,
- this,
- std::placeholders::_1,
- variantVal,
- std::move(attributeAsyncCallback)));
- }
-
- void AsyncVariantStripper(const CommonAPI::CallStatus& status,
- const DBusLegacyVariantWrapper<Variant<ValueType> >& value,
- AttributeAsyncCallback attributeAsyncCallback) {
- attributeAsyncCallback(status, value.contained_.template get<ValueType>());
- }
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusFreedesktopUnionAttribute: public DBusFreedesktopUnionReadonlyAttribute<_AttributeType, _DBusProxyType> {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusFreedesktopUnionAttribute(_DBusProxyType& dbusProxy,
- const char* interfaceName,
- const char* propertyName) :
- DBusFreedesktopUnionReadonlyAttribute<_AttributeType>(dbusProxy, interfaceName, propertyName)
- {
- assert(interfaceName);
- assert(propertyName);
- }
-
-
- void setValue(const ValueType& requestValue, CallStatus& callStatus, ValueType& responseValue) {
- DBusLegacyVariantWrapper<ValueType> variantVal;
- variantVal.contained_ = requestValue;
- DBusProxyHelper<DBusSerializableArguments<std::string, std::string, DBusLegacyVariantWrapper<ValueType> >,
- DBusSerializableArguments<> >::callMethodWithReply(
- DBusFreedesktopUnionAttribute<_AttributeType>::dbusProxy_,
- DBusFreedesktopUnionAttribute<_AttributeType>::dbusProxy_.getDBusBusName().c_str(),
- DBusFreedesktopUnionAttribute<_AttributeType>::dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- DBusFreedesktopUnionReadonlyAttribute<_AttributeType>::interfaceName_,
- DBusFreedesktopUnionReadonlyAttribute<_AttributeType>::propertyName_,
- variantVal,
- callStatus);
- responseValue = requestValue;
- }
-
- std::future<CallStatus> setValueAsync(const ValueType& requestValue, AttributeAsyncCallback attributeAsyncCallback) {
- DBusLegacyVariantWrapper<ValueType> variantVal;
- variantVal.contained_ = requestValue;
- return DBusProxyHelper<DBusSerializableArguments<std::string, std::string, DBusLegacyVariantWrapper<ValueType> >,
- DBusSerializableArguments<> >::callMethodAsync(
- DBusFreedesktopUnionAttribute<_AttributeType>::dbusProxy_,
- DBusFreedesktopUnionAttribute<_AttributeType>::dbusProxy_.getDBusBusName().c_str(),
- DBusFreedesktopUnionAttribute<_AttributeType>::dbusProxy_.getDBusObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- DBusFreedesktopUnionReadonlyAttribute<_AttributeType>::interfaceName_,
- DBusFreedesktopUnionReadonlyAttribute<_AttributeType>::propertyName_,
- variantVal,
- std::bind(
- &CommonAPI::DBus::DBusFreedesktopUnionAttribute<_AttributeType>::AsyncVariantStripper,
- this,
- std::placeholders::_1,
- variantVal,
- std::move(attributeAsyncCallback)));
- }
-
- void AsyncVariantStripper(const CommonAPI::CallStatus& status,
- const DBusLegacyVariantWrapper<ValueType>& value,
- AttributeAsyncCallback attributeAsyncCallback) {
- attributeAsyncCallback(status, value.contained_);
- }
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusObservableAttribute: public _AttributeType {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
- typedef typename _AttributeType::ChangedEvent ChangedEvent;
-
- template <typename... _AttributeTypeArguments>
- DBusObservableAttribute(_DBusProxyType& dbusProxy, const char* changedEventName, _AttributeTypeArguments... arguments):
- _AttributeType(dbusProxy, arguments...),
- changedEvent_(dbusProxy, changedEventName, this->setMethodSignature_) {
- }
-
- ChangedEvent& getChangedEvent() {
- return changedEvent_;
- }
-
- protected:
- DBusEvent<ChangedEvent> changedEvent_;
-};
-
-template< class, class >
-class LegacyEvent;
-
-template <template <class...> class _Type, class _Types, typename _DBusProxy>
-class LegacyEvent<_Type<_Types>, _DBusProxy> : public _Type<_Types> {
-public:
- typedef _Types ValueType;
- typedef _Type<ValueType> CommonAPIEvent;
- typedef typename CommonAPIEvent::CancellableListener CancellableListener;
-
- LegacyEvent(_DBusProxy& dbusProxy, const char* interfaceName, const char* propName) :
- interfaceName_(interfaceName),
- propertyName_(propName),
- subSet_(false),
- internalEvent_(dbusProxy, "PropertiesChanged", "sa{sv}as", dbusProxy.getDBusObjectPath().c_str(), "org.freedesktop.DBus.Properties") {
- }
-
-protected:
- void onInternalEvent(const std::string& interfaceName,
- const std::unordered_map<std::string, DBusLegacyVariantWrapper<Variant<_Types> > >& props,
- const std::vector<std::string>& invalid) {
- if (interfaceName_ == interfaceName) {
- auto mapIter = props.find(propertyName_);
- if (mapIter != props.end()) {
- notifyListeners(mapIter->second.contained_.template get<ValueType>());
- }
- }
- }
-
- void onFirstListenerAdded(const CancellableListener& listener) {
- sub = internalEvent_.subscribe(
- std::bind(
- &LegacyEvent<_Type<_Types>, _DBusProxy>::onInternalEvent,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
- subSet_ = true;
- }
-
- void onLastListenerRemoved(const CancellableListener& listener) {
- if (subSet_) {
- internalEvent_.unsubscribe(sub);
- subSet_ = false;
- }
- }
-
- typedef DBusLegacyVariantWrapper<Variant<_Types> > ContainedVariant;
- typedef std::unordered_map<std::string, ContainedVariant> PropertyMap;
- typedef std::vector<std::string> InvalidArray;
- typedef Event<std::string, PropertyMap, InvalidArray> SignalEvent;
-
-
- typename DBusEvent<SignalEvent>::Subscription sub;
-
- const std::string interfaceName_;
- const std::string propertyName_;
- bool subSet_;
- DBusEvent<SignalEvent> internalEvent_;
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusFreedesktopObservableAttribute: public _AttributeType {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
- typedef typename _AttributeType::ChangedEvent ChangedEvent;
-
- template <typename... _AttributeTypeArguments>
- DBusFreedesktopObservableAttribute(_DBusProxyType& dbusProxy,
- const char* interfaceName,
- const char* propertyName,
- _AttributeTypeArguments... arguments):
- _AttributeType(dbusProxy, interfaceName, propertyName, arguments...),
- externalChangedEvent_(dbusProxy, interfaceName, propertyName) {
- }
-
- ChangedEvent& getChangedEvent() {
- return externalChangedEvent_;
- }
-
- protected:
- LegacyEvent<ChangedEvent, _DBusProxyType> externalChangedEvent_;
-};
-
-template< class, class >
-class LegacyUnionEvent;
-
-template <template <class...> class _Type, class _Types, typename _DBusProxy>
-class LegacyUnionEvent<_Type<_Types>, _DBusProxy> : public _Type<_Types> {
-public:
- typedef _Types ValueType;
- typedef _Type<ValueType> CommonAPIEvent;
- typedef typename CommonAPIEvent::CancellableListener CancellableListener;
-
- LegacyUnionEvent(_DBusProxy& dbusProxy, const char* interfaceName, const char* propName) :
- interfaceName_(interfaceName),
- propertyName_(propName),
- subSet_(false),
- internalEvent_(dbusProxy, "PropertiesChanged", "sa{sv}as", dbusProxy.getDBusObjectPath().c_str(), "org.freedesktop.DBus.Properties") {
- }
-
-protected:
- void onInternalEvent(const std::string& interfaceName,
- const std::unordered_map<std::string, DBusLegacyVariantWrapper<ValueType> >& props,
- const std::vector<std::string>& invalid) {
- if (interfaceName_ == interfaceName) {
- auto mapIter = props.find(propertyName_);
- if (mapIter != props.end()) {
- notifyListeners(mapIter->second.contained_);
- }
- }
- }
-
- void onFirstListenerAdded(const CancellableListener& listener) {
- sub = internalEvent_.subscribe(
- std::bind(
- &LegacyUnionEvent<_Type<_Types>, _DBusProxy>::onInternalEvent,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
- subSet_ = true;
- }
-
- void onLastListenerRemoved(const CancellableListener& listener) {
- if (subSet_) {
- internalEvent_.unsubscribe(sub);
- subSet_ = false;
- }
- }
-
- typedef DBusLegacyVariantWrapper<ValueType> ContainedVariant;
- typedef std::unordered_map<std::string, ContainedVariant> PropertyMap;
- typedef std::vector<std::string> InvalidArray;
- typedef Event<std::string, PropertyMap, InvalidArray> SignalEvent;
-
- DBusEvent<SignalEvent> internalEvent_;
-
- typename DBusEvent<SignalEvent>::Subscription sub;
-
- const std::string interfaceName_;
- const std::string propertyName_;
-
- bool subSet_;
-
-};
-
-template <typename _AttributeType, typename _DBusProxyType = DBusProxy>
-class DBusFreedesktopUnionObservableAttribute: public _AttributeType {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
- typedef typename _AttributeType::ChangedEvent ChangedEvent;
-
- template <typename... _AttributeTypeArguments>
- DBusFreedesktopUnionObservableAttribute(_DBusProxyType& dbusProxy,
- const char* interfaceName,
- const char* propertyName,
- _AttributeTypeArguments... arguments):
- _AttributeType(dbusProxy, interfaceName, propertyName, arguments...),
- externalChangedEvent_(dbusProxy, interfaceName, propertyName) {
- }
-
- ChangedEvent& getChangedEvent() {
- return externalChangedEvent_;
- }
-
- protected:
- LegacyUnionEvent<ChangedEvent, _DBusProxyType> externalChangedEvent_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_ATTRIBUTE_H_
diff --git a/src/CommonAPI/DBus/DBusClientId.cpp b/src/CommonAPI/DBus/DBusClientId.cpp
index b68b7fa..7c9f195 100644
--- a/src/CommonAPI/DBus/DBusClientId.cpp
+++ b/src/CommonAPI/DBus/DBusClientId.cpp
@@ -1,14 +1,13 @@
-/* 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/. */
+// 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 "DBusClientId.h"
-#include "DBusMessage.h"
#include <typeinfo>
+#include <CommonAPI/DBus/DBusClientId.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+
namespace std {
template<>
@@ -33,7 +32,7 @@ bool DBusClientId::operator==(CommonAPI::ClientId& clientIdToCompare) {
DBusClientId clientIdToCompareDBus = DBusClientId(dynamic_cast<DBusClientId&>(clientIdToCompare));
return (clientIdToCompareDBus == *this);
}
- catch (const std::bad_cast& e) {
+ catch (...) {
return false;
}
}
@@ -59,7 +58,5 @@ DBusMessage DBusClientId::createMessage(const std::string objectPath, const std:
return(returnMessage);
}
-} /* namespace DBus */
-} /* namespace CommonAPI */
-
-
+} // namespace DBus
+} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusClientId.h b/src/CommonAPI/DBus/DBusClientId.h
deleted file mode 100644
index a252de6..0000000
--- a/src/CommonAPI/DBus/DBusClientId.h
+++ /dev/null
@@ -1,48 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef DBUSCLIENTID_H_
-#define DBUSCLIENTID_H_
-
-#include <CommonAPI/types.h>
-#include <string>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusMessage;
-
-/**
- * \brief Implementation of CommonAPI::ClientId for DBus
- *
- * This class represents the DBus specific implementation of CommonAPI::ClientId.
- * It internally uses a string to identify clients. This string is the unique sender id used by dbus.
- */
-class DBusClientId: public CommonAPI::ClientId {
- friend class std::hash<DBusClientId>;
-
-public:
- DBusClientId(std::string dbusId);
-
- bool operator==(CommonAPI::ClientId& clientIdToCompare);
- bool operator==(DBusClientId& clientIdToCompare);
- size_t hashCode();
-
- const char * getDBusId();
-
- DBusMessage createMessage(const std::string objectPath, const std::string interfaceName, const std::string signalName) const;
-protected:
- std::string dbusId_;
-};
-
-} /* namespace DBus */
-} /* namespace CommonAPI */
-#endif /* DBUSCLIENTID_H_ */
diff --git a/src/CommonAPI/DBus/DBusConfiguration.cpp b/src/CommonAPI/DBus/DBusConfiguration.cpp
deleted file mode 100644
index 9b23a9c..0000000
--- a/src/CommonAPI/DBus/DBusConfiguration.cpp
+++ /dev/null
@@ -1,264 +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 <fstream>
-
-#include <CommonAPI/utils.h>
-
-#include "DBusConfiguration.h"
-
-
-namespace CommonAPI {
-namespace DBus {
-
-
-enum class TypeEnum {
- DBUS_CONNECTION, DBUS_OBJECT, DBUS_INTERFACE, DBUS_PREDEFINED
-};
-
-enum class TypeEnumFactory {
- DBUS_BUSTYPE
-};
-
-enum class FileParsingState {
- UNDEFINED,
- PARSING_ADDRESS,
- PARSING_FACTORY
-};
-
-
-static const std::unordered_map<std::string, TypeEnum> allowedValueTypes = {
- {"dbus_connection", TypeEnum::DBUS_CONNECTION},
- {"dbus_object", TypeEnum::DBUS_OBJECT},
- {"dbus_interface", TypeEnum::DBUS_INTERFACE},
- {"dbus_predefined", TypeEnum::DBUS_PREDEFINED}
-};
-
-static const std::unordered_map<std::string, TypeEnumFactory> allowedValueTypesFactory = {
- {"dbus_bustype", TypeEnumFactory::DBUS_BUSTYPE}
-};
-
-
-const DBusConfiguration& DBusConfiguration::getInstance() {
- static DBusConfiguration* instance = NULL;
- if (!instance) {
- instance = new DBusConfiguration();
- instance->retrieveCommonApiDBusConfiguration();
- }
- return *instance;
-}
-
-void DBusConfiguration::retrieveCommonApiDBusConfiguration() {
- std::string fqnOfConfigFile = getCurrentBinaryFileFQN();
- std::ifstream addressConfigFile;
-
- fqnOfConfigFile += DBUS_CONFIG_SUFFIX;
-
- addressConfigFile.open(fqnOfConfigFile.c_str());
-
- if (addressConfigFile.is_open()) {
- readConfigFile(addressConfigFile);
- addressConfigFile.close();
- }
-
- addressConfigFile.clear();
- std::vector<std::string> splittedConfigFQN = split(fqnOfConfigFile, '/');
- std::string globalConfigFQN = DBUS_GLOBAL_CONFIG_ROOT + splittedConfigFQN.at(splittedConfigFQN.size() - 1);
- addressConfigFile.open(globalConfigFQN);
- if (addressConfigFile.is_open()) {
- readConfigFile(addressConfigFile);
- addressConfigFile.close();
- }
- addressConfigFile.clear();
-
- addressConfigFile.open(DBUS_GLOBAL_CONFIG_FQN);
- if(addressConfigFile.is_open()) {
- readConfigFile(addressConfigFile);
- addressConfigFile.close();
- }
-}
-
-const std::unordered_map<std::string, CommonApiServiceDetails>& DBusConfiguration::getCommonApiAddressDetails() const {
- return std::move(commonApiAddressDetails_);
-}
-
-const DBusFactoryConfig* DBusConfiguration::getFactoryConfiguration(const std::string& factoryName) const {
- const auto foundConfig = factoryConfigurations_.find(factoryName);
-
- if (foundConfig != factoryConfigurations_.end()) {
- return &foundConfig->second;
- }
- return NULL;
-}
-
-void reset(DBusServiceAddress& dbusServiceAddress) {
- std::get<0>(dbusServiceAddress) = "";
- std::get<1>(dbusServiceAddress) = "";
- std::get<2>(dbusServiceAddress) = "";
-}
-
-void reset(CommonApiServiceDetails& serviceDetails) {
- reset(std::get<0>(serviceDetails));
- std::get<1>(serviceDetails) = false;
-}
-
-
-void reset(DBusFactoryConfig& dbusFactoryconfiguration) {
- dbusFactoryconfiguration.factoryName_ = "";
- dbusFactoryconfiguration.busType_ = BusType::SESSION;
-}
-
-void DBusConfiguration::readValue(std::string& readLine, DBusFactoryConfig& factoryConfig) {
- std::stringstream readStream(readLine);
- std::string paramName;
- std::string paramValue;
-
- getline(readStream, paramName, '=');
-
- auto typeEntry = allowedValueTypesFactory.find(paramName);
- if (typeEntry != allowedValueTypesFactory.end()) {
- getline(readStream, paramValue);
- switch (typeEntry->second) {
- case TypeEnumFactory::DBUS_BUSTYPE:
- if (paramValue == "system") {
- factoryConfig.busType_ = DBus::BusType::SYSTEM;
- }
- break;
- }
- }
-}
-
-void DBusConfiguration::readValue(std::string& readLine, CommonApiServiceDetails& serviceDetails) {
- std::stringstream readStream(readLine);
-
- std::string paramName;
- std::string paramValue;
-
- getline(readStream, paramName, '=');
-
- auto typeEntry = allowedValueTypes.find(paramName);
- if (typeEntry != allowedValueTypes.end()) {
- getline(readStream, paramValue);
- switch (typeEntry->second) {
- case TypeEnum::DBUS_CONNECTION:
- std::get<0>(std::get<0>(serviceDetails)) = paramValue;
- break;
- case TypeEnum::DBUS_OBJECT:
- std::get<1>(std::get<0>(serviceDetails)) = paramValue;
- break;
- case TypeEnum::DBUS_INTERFACE:
- std::get<2>(std::get<0>(serviceDetails)) = paramValue;
- break;
- case TypeEnum::DBUS_PREDEFINED:
- std::get<1>(serviceDetails) = paramValue == "true" ? true : false;
- break;
- }
- }
-}
-
-
-const FileParsingState isValidSection(const std::string& sectionIdentifier, std::string& newSectionName) {
- const size_t sectionIdentifierLength = sectionIdentifier.length();
-
- if (sectionIdentifier[0] == '[' && sectionIdentifier[sectionIdentifier.length() - 1] == ']') {
- std::string sectionName = sectionIdentifier.substr(1, sectionIdentifierLength - 2);
- std::vector<std::string> addressParts = split(sectionName, '$');
-
- if (addressParts.size() == 2 && addressParts[0] == "factory") {
- newSectionName = addressParts[1];
- return FileParsingState::PARSING_FACTORY;
- } else if (isValidCommonApiAddress(sectionName)) {
- newSectionName = sectionName;
- return FileParsingState::PARSING_ADDRESS;
- }
- }
- return FileParsingState::UNDEFINED;
-}
-
-
-void DBusConfiguration::readConfigFile(std::ifstream& addressConfigFile) {
- std::string currentlyParsedCommonApiAddress;
- DBusFactoryConfig currentlyParsedFactoryConfig;
- CommonApiServiceDetails serviceDetails;
- reset(serviceDetails);
-
- bool newAddressFound = false;
- bool newFactoryFound = false;
-
- FileParsingState currentParsingState = FileParsingState::UNDEFINED;
-
- while (addressConfigFile.good()) {
- std::string readLine;
- std::string sectionName;
- getline(addressConfigFile, readLine);
-
- FileParsingState newState = isValidSection(readLine, sectionName);
-
- //Finish currently read sections if necessary
- if (newState != FileParsingState::UNDEFINED) {
- switch (currentParsingState) {
- case FileParsingState::PARSING_ADDRESS:
- if (newAddressFound) {
- commonApiAddressDetails_.insert( {currentlyParsedCommonApiAddress, serviceDetails});
- }
- newAddressFound = false;
- break;
- case FileParsingState::PARSING_FACTORY:
- if (newFactoryFound) {
- factoryConfigurations_.insert( {currentlyParsedFactoryConfig.factoryName_, currentlyParsedFactoryConfig} );
- }
- newFactoryFound = false;
- break;
- case FileParsingState::UNDEFINED:
- break;
- }
- }
-
- //See what comes next
- switch (newState) {
- case FileParsingState::PARSING_ADDRESS:
- reset(serviceDetails);
- currentlyParsedCommonApiAddress = sectionName;
- newAddressFound = commonApiAddressDetails_.find(currentlyParsedCommonApiAddress) == commonApiAddressDetails_.end();
- currentParsingState = FileParsingState::PARSING_ADDRESS;
- break;
-
- case FileParsingState::PARSING_FACTORY:
- reset(currentlyParsedFactoryConfig);
- currentlyParsedFactoryConfig.factoryName_ = sectionName;
- newFactoryFound = factoryConfigurations_.find(sectionName) == factoryConfigurations_.end();
- currentParsingState = FileParsingState::PARSING_FACTORY;
- break;
-
- //nothing new, so this lines should contain additional information for the current state
- case FileParsingState::UNDEFINED:
- switch (currentParsingState) {
- case FileParsingState::PARSING_FACTORY:
- readValue(readLine, currentlyParsedFactoryConfig);
- break;
- case FileParsingState::PARSING_ADDRESS:
- readValue(readLine, serviceDetails);
- break;
- case FileParsingState::UNDEFINED:
- break;
- }
- break;
- }
- }
-
- //End of file, finish last section
- if (newAddressFound) {
- commonApiAddressDetails_.insert( {currentlyParsedCommonApiAddress, serviceDetails});
- }
- if (newFactoryFound) {
- factoryConfigurations_.insert( {currentlyParsedFactoryConfig.factoryName_, currentlyParsedFactoryConfig});
- }
-}
-
-
-}// namespace DBus
-} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusConfiguration.h b/src/CommonAPI/DBus/DBusConfiguration.h
deleted file mode 100644
index 6ded2b6..0000000
--- a/src/CommonAPI/DBus/DBusConfiguration.h
+++ /dev/null
@@ -1,74 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_CONFIGURATION_H_
-#define COMMONAPI_DBUS_DBUS_CONFIGURATION_H_
-
-
-#include <unordered_map>
-
-#include "DBusConnectionBusType.h"
-#include "DBusFunctionalHash.h"
-
-
-namespace CommonAPI {
-namespace DBus {
-
-static const char DBUS_CONFIG_SUFFIX[] = "_dbus.conf";
-static const char DBUS_GLOBAL_CONFIG_FQN[] = "/etc/CommonApiDBus/dbusAddresses.conf";
-static const char DBUS_GLOBAL_CONFIG_ROOT[] = "/etc/CommonApiDBus/";
-
-//connectionName, objectPath, interfaceName
-typedef std::tuple<std::string, std::string, std::string> DBusServiceAddress;
-
-//Details for a common api address key: DBusAddress, predefined service
-typedef std::tuple<DBusServiceAddress, bool> CommonApiServiceDetails;
-
-
-struct DBusFactoryConfig {
- DBusFactoryConfig(): factoryName_(""), busType_(BusType::SESSION) {}
-
- std::string factoryName_;
- BusType busType_;
-};
-
-
-class DBusConfiguration {
- public:
- static const DBusConfiguration& getInstance();
-
- DBusConfiguration(const DBusConfiguration&) = delete;
- DBusConfiguration& operator=(const DBusConfiguration&) = delete;
- DBusConfiguration(DBusConfiguration&&) = delete;
- DBusConfiguration& operator=(DBusConfiguration&&) = delete;
-
- const std::unordered_map<std::string, CommonApiServiceDetails>& getCommonApiAddressDetails() const;
-
- const DBusFactoryConfig* getFactoryConfiguration(const std::string& factoryName) const;
-
- private:
- DBusConfiguration() = default;
-
- void readConfigFile(std::ifstream& addressConfigFile);
- void retrieveCommonApiDBusConfiguration();
-
- void readValue(std::string& readLine, DBusFactoryConfig& factoryConfig);
- void readValue(std::string& readLine, CommonApiServiceDetails& serviceDetails);
-
- std::unordered_map<std::string, CommonApiServiceDetails> commonApiAddressDetails_;
- std::unordered_map<std::string, DBusFactoryConfig> factoryConfigurations_;
-};
-
-
-}// namespace DBus
-}// namespace CommonAPI
-
-#endif /* COMMONAPI_DBUS_DBUS_CONFIGURATION_H_ */
diff --git a/src/CommonAPI/DBus/DBusConnection.cpp b/src/CommonAPI/DBus/DBusConnection.cpp
index 1d8fd38..07e7da5 100644
--- a/src/CommonAPI/DBus/DBusConnection.cpp
+++ b/src/CommonAPI/DBus/DBusConnection.cpp
@@ -1,26 +1,20 @@
-/* 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/. */
-
-// Workaround for libstdc++ bug
-#ifndef _GLIBCXX_USE_NANOSLEEP
-#define _GLIBCXX_USE_NANOSLEEP
-#endif
-
-#include "DBusConnection.h"
-#include "DBusInputStream.h"
-#include "DBusProxy.h"
+// 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 <algorithm>
-#include <sstream>
#include <cassert>
-#include <future>
#include <chrono>
+#include <future>
+#include <sstream>
#include <thread>
+#include <CommonAPI/Logger.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
+
namespace CommonAPI {
namespace DBus {
@@ -28,7 +22,7 @@ DBusConnectionStatusEvent::DBusConnectionStatusEvent(DBusConnection* dbusConnect
dbusConnection_(dbusConnection) {
}
-void DBusConnectionStatusEvent::onListenerAdded(const CancellableListener& listener) {
+void DBusConnectionStatusEvent::onListenerAdded(const Listener& listener) {
if (dbusConnection_->isConnected())
listener(AvailabilityStatus::AVAILABLE);
}
@@ -42,12 +36,10 @@ const DBusObjectPathVTable* DBusConnection::getDBusObjectPathVTable() {
return &libdbusObjectPathVTable;
}
-
-
//std::bind used to start the dispatch thread holds one reference, and the selfReference
//created within the thread is the second. If only those two remain, no one but the
//dispatch thread references the connection, which therefore can be finished.
-const uint32_t ownUseCount = 2;
+const int32_t ownUseCount = 2;
void DBusConnection::dispatch() {
std::shared_ptr<DBusConnection> selfReference = this->shared_from_this();
@@ -59,11 +51,9 @@ void DBusConnection::dispatch() {
}
}
-bool DBusConnection::readWriteDispatch(int timeoutMilliseconds) {
+bool DBusConnection::readWriteDispatch(int _timeout) {
if(isConnected()) {
- const dbus_bool_t libdbusSuccess = dbus_connection_read_write_dispatch(libdbusConnection_,
- timeoutMilliseconds);
- return libdbusSuccess;
+ return 0 != dbus_connection_read_write_dispatch(connection_, _timeout);
}
return false;
}
@@ -78,39 +68,39 @@ void DBusConnection::resumeDispatching() const {
dispatchSuspendLock_.unlock();
}
-DBusConnection::DBusConnection(BusType busType) :
+DBusConnection::DBusConnection(DBusType_t busType) :
dispatchThread_(NULL),
stopDispatching_(false),
- mainLoopContext_(std::shared_ptr<MainLoopContext>(NULL)),
dispatchSource_(),
watchContext_(NULL),
pauseDispatching_(false),
- libdbusConnection_(NULL),
+ connection_(NULL),
busType_(busType),
dbusConnectionStatusEvent_(this),
libdbusSignalMatchRulesCount_(0),
dbusObjectMessageHandler_(),
connectionNameCount_(),
- enforcerThread_(NULL)
- {
+ enforcerThread_(NULL),
+ enforcerThreadCancelled_(false) {
dbus_threads_init_default();
}
-DBusConnection::DBusConnection(::DBusConnection* libDbusConnection) :
+DBusConnection::DBusConnection(::DBusConnection *_connection) :
dispatchThread_(NULL),
stopDispatching_(false),
- mainLoopContext_(std::shared_ptr<MainLoopContext>(NULL)),
dispatchSource_(),
watchContext_(NULL),
pauseDispatching_(false),
- libdbusConnection_(libDbusConnection),
- busType_(WRAPPED),
+ connection_(_connection),
+ busType_(DBusType_t::WRAPPED),
dbusConnectionStatusEvent_(this),
libdbusSignalMatchRulesCount_(0),
dbusObjectMessageHandler_(),
connectionNameCount_(),
- enforcerThread_(NULL) {
+ enforcerThread_(NULL),
+ enforcerThreadCancelled_(false) {
+
dbus_threads_init_default();
}
@@ -124,38 +114,36 @@ bool DBusConnection::isObjectPathMessageHandlerSet() {
DBusConnection::~DBusConnection() {
if (auto lockedContext = mainLoopContext_.lock()) {
- dbus_connection_set_watch_functions(libdbusConnection_, NULL, NULL, NULL, NULL, NULL);
- dbus_connection_set_timeout_functions(libdbusConnection_, NULL, NULL, NULL, NULL, NULL);
+ 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_;
delete dispatchSource_;
}
- disconnect();
+ // ensure, the registry survives until disconnecting is done...
+ //std::shared_ptr<DBusServiceRegistry> itsRegistry = DBusServiceRegistry::get(shared_from_this());
+ 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.
- if (enforcerThread_) {
- enforceTimeoutMutex_.lock();
-
- auto it = timeoutMap_.begin();
- while (it != timeoutMap_.end()) {
- 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);
- asyncHandler->onDBusMessageReply(CallStatus::REMOTE_ERROR, dbusMessageCall.createMethodError(DBUS_ERROR_TIMEOUT));
- delete asyncHandler;
- }
- it = timeoutMap_.erase(it);
- dbus_pending_call_unref(libdbusPendingCall);
- }
-
- enforceTimeoutMutex_.unlock();
- }
+ auto it = timeoutMap_.begin();
+ while (it != timeoutMap_.end()) {
+ 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);
+
+ asyncHandler->onDBusMessageReply(CallStatus::REMOTE_ERROR, dbusMessageCall.createMethodError(DBUS_ERROR_TIMEOUT));
+ delete asyncHandler;
+
+ }
+ it = timeoutMap_.erase(it);
+ dbus_pending_call_unref(libdbusPendingCall);
+ }
}
@@ -168,13 +156,13 @@ bool DBusConnection::attachMainLoopContext(std::weak_ptr<MainLoopContext> mainLo
lockedContext->registerDispatchSource(dispatchSource_);
dbus_connection_set_wakeup_main_function(
- libdbusConnection_,
+ connection_,
&DBusConnection::onWakeupMainContext,
&mainLoopContext_,
NULL);
- bool success = dbus_connection_set_watch_functions(
- libdbusConnection_,
+ bool success = 0 != dbus_connection_set_watch_functions(
+ connection_,
&DBusConnection::onAddWatch,
&DBusConnection::onRemoveWatch,
&DBusConnection::onToggleWatch,
@@ -185,8 +173,8 @@ bool DBusConnection::attachMainLoopContext(std::weak_ptr<MainLoopContext> mainLo
return false;
}
- success = dbus_connection_set_timeout_functions(
- libdbusConnection_,
+ success = 0 != dbus_connection_set_timeout_functions(
+ connection_,
&DBusConnection::onAddTimeout,
&DBusConnection::onRemoveTimeout,
&DBusConnection::onToggleTimeout,
@@ -194,7 +182,7 @@ bool DBusConnection::attachMainLoopContext(std::weak_ptr<MainLoopContext> mainLo
NULL);
if (!success) {
- dbus_connection_set_watch_functions(libdbusConnection_, NULL, NULL, NULL, NULL, NULL);
+ dbus_connection_set_watch_functions(connection_, NULL, NULL, NULL, NULL, NULL);
return false;
}
@@ -212,7 +200,6 @@ void DBusConnection::onWakeupMainContext(void* data) {
}
}
-
dbus_bool_t DBusConnection::onAddWatch(::DBusWatch* libdbusWatch, void* data) {
WatchContext* watchContext = static_cast<WatchContext*>(data);
assert(watchContext);
@@ -279,7 +266,6 @@ void DBusConnection::onToggleTimeout(::DBusTimeout* dbustimeout, void* data) {
assert(static_cast<std::weak_ptr<MainLoopContext>*>(data));
DBusTimeout* timeout = static_cast<DBusTimeout*>(dbus_timeout_get_data(dbustimeout));
-
if (timeout->isReadyToBeMonitored()) {
timeout->startMonitoring();
} else {
@@ -287,37 +273,38 @@ void DBusConnection::onToggleTimeout(::DBusTimeout* dbustimeout, void* data) {
}
}
-
bool DBusConnection::connect(bool startDispatchThread) {
DBusError dbusError;
return connect(dbusError, startDispatchThread);
}
-bool DBusConnection::connect(DBusError& dbusError, bool startDispatchThread) {
+bool DBusConnection::connect(DBusError &dbusError, bool startDispatchThread) {
assert(!dbusError);
-
if (isConnected()) {
return true;
}
const ::DBusBusType libdbusType = static_cast<DBusBusType>(busType_);
- libdbusConnection_ = dbus_bus_get_private(libdbusType, &dbusError.libdbusError_);
+ connection_ = dbus_bus_get_private(libdbusType, &dbusError.libdbusError_);
if (dbusError) {
return false;
}
- assert(libdbusConnection_);
- dbus_connection_set_exit_on_disconnect(libdbusConnection_, false);
+ assert(connection_);
+ dbus_connection_set_exit_on_disconnect(connection_, false);
initLibdbusObjectPathHandlerAfterConnect();
initLibdbusSignalFilterAfterConnect();
+ stopDispatching_ = !startDispatchThread;
if (startDispatchThread) {
dispatchThread_ = new std::thread(std::bind(&DBusConnection::dispatch, this->shared_from_this()));
}
- stopDispatching_ = !startDispatchThread;
+
+ enforcerThread_ = std::make_shared<std::thread>(
+ std::bind(&DBusConnection::enforceAsynchronousTimeouts, shared_from_this()));
dbusConnectionStatusEvent_.notifyListeners(AvailabilityStatus::AVAILABLE);
@@ -325,12 +312,12 @@ bool DBusConnection::connect(DBusError& dbusError, bool startDispatchThread) {
}
void DBusConnection::disconnect() {
- std::lock_guard<std::mutex> dbusConnectionLock(libdbusConnectionGuard_);
+ std::lock_guard<std::mutex> dbusConnectionLock(connectionGuard_);
if (isConnected()) {
dbusConnectionStatusEvent_.notifyListeners(AvailabilityStatus::NOT_AVAILABLE);
if (libdbusSignalMatchRulesCount_ > 0) {
- dbus_connection_remove_filter(libdbusConnection_, &onLibdbusSignalFilterThunk, this);
+ dbus_connection_remove_filter(connection_, &onLibdbusSignalFilterThunk, this);
libdbusSignalMatchRulesCount_ = 0;
}
@@ -338,7 +325,7 @@ void DBusConnection::disconnect() {
stopDispatching_ = true;
- dbus_connection_close(libdbusConnection_);
+ dbus_connection_close(connection_);
if(dispatchThread_) {
//It is possible for the disconnect to be called from within a callback, i.e. from within the dispatch
@@ -352,34 +339,26 @@ void DBusConnection::disconnect() {
dispatchThread_ = NULL;
}
- dbus_connection_unref(libdbusConnection_);
- libdbusConnection_ = NULL;
+ enforcerThreadCancelled_ = true;
+ enforceTimeoutCondition_.notify_one();
+ if (enforcerThread_->joinable()) {
+ enforcerThread_->join();
+ }
+ enforcerThreadCancelled_ = false;
+
+ dbus_connection_unref(connection_);
+ connection_ = nullptr;
}
}
bool DBusConnection::isConnected() const {
- return (libdbusConnection_ != NULL);
+ return (connection_ != NULL);
}
DBusProxyConnection::ConnectionStatusEvent& DBusConnection::getConnectionStatusEvent() {
return dbusConnectionStatusEvent_;
}
-const std::shared_ptr<DBusServiceRegistry> DBusConnection::getDBusServiceRegistry() {
- std::shared_ptr<DBusServiceRegistry> serviceRegistry = dbusServiceRegistry_.lock();
- if (!serviceRegistry || dbusServiceRegistry_.expired()) {
- serviceRegistryGuard_.lock();
- if (!serviceRegistry || dbusServiceRegistry_.expired()) {
- serviceRegistry = std::make_shared<DBusServiceRegistry>(shared_from_this());
- serviceRegistry->init();
- dbusServiceRegistry_ = serviceRegistry;
- }
- serviceRegistryGuard_.unlock();
- }
-
- return serviceRegistry;
-}
-
//Does this need to be a weak pointer?
const std::shared_ptr<DBusObjectManager> DBusConnection::getDBusObjectManager() {
if (!dbusObjectManager_) {
@@ -389,19 +368,19 @@ const std::shared_ptr<DBusObjectManager> DBusConnection::getDBusObjectManager()
}
objectManagerGuard_.unlock();
}
-
return dbusObjectManager_;
}
bool DBusConnection::requestServiceNameAndBlock(const std::string& serviceName) const {
DBusError dbusError;
bool isServiceNameAcquired = false;
- std::lock_guard<std::mutex> dbusConnectionLock(libdbusConnectionGuard_);
+
+ std::lock_guard<std::mutex> dbusConnectionLock(connectionGuard_);
auto conIter = connectionNameCount_.find(serviceName);
if (conIter == connectionNameCount_.end()) {
suspendDispatching();
- const int libdbusStatus = dbus_bus_request_name(libdbusConnection_,
+ const int libdbusStatus = dbus_bus_request_name(connection_,
serviceName.c_str(),
DBUS_NAME_FLAG_DO_NOT_QUEUE,
&dbusError.libdbusError_);
@@ -410,7 +389,7 @@ bool DBusConnection::requestServiceNameAndBlock(const std::string& serviceName)
isServiceNameAcquired = (libdbusStatus == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
if (isServiceNameAcquired) {
- connectionNameCount_.insert({serviceName, (uint16_t)1});
+ connectionNameCount_.insert( { serviceName, (uint16_t)1 } );
}
} else {
conIter->second = conIter->second + 1;
@@ -423,12 +402,12 @@ bool DBusConnection::requestServiceNameAndBlock(const std::string& serviceName)
bool DBusConnection::releaseServiceName(const std::string& serviceName) const {
DBusError dbusError;
bool isServiceNameReleased = false;
- std::lock_guard<std::mutex> dbusConnectionLock(libdbusConnectionGuard_);
+ std::lock_guard<std::mutex> dbusConnectionLock(connectionGuard_);
auto conIter = connectionNameCount_.find(serviceName);
if (conIter != connectionNameCount_.end()) {
if (conIter->second == 1) {
suspendDispatching();
- const int libdbusStatus = dbus_bus_release_name(libdbusConnection_,
+ const int libdbusStatus = dbus_bus_release_name(connection_,
serviceName.c_str(),
&dbusError.libdbusError_);
resumeDispatching();
@@ -444,13 +423,12 @@ bool DBusConnection::releaseServiceName(const std::string& serviceName) const {
return isServiceNameReleased;
}
-bool DBusConnection::sendDBusMessage(const DBusMessage& dbusMessage, uint32_t* allocatedSerial) const {
- assert(dbusMessage);
+bool DBusConnection::sendDBusMessage(const DBusMessage &_message) const {
+ assert(_message);
assert(isConnected());
- dbus_uint32_t* libdbusSerial = static_cast<dbus_uint32_t*>(allocatedSerial);
- const bool result = dbus_connection_send(libdbusConnection_, dbusMessage.libdbusMessage_, libdbusSerial);
-
+ dbus_uint32_t dbusSerial;
+ bool result = 0 != dbus_connection_send(connection_, _message.message_, &dbusSerial);
return result;
}
@@ -471,7 +449,7 @@ void DBusConnection::onLibdbusPendingCallNotifyThunk(::DBusPendingCall* libdbusP
dbusMessageReplyAsyncHandler->onDBusMessageReply(callStatus, dbusMessage);
- // libdbus calls the Cleanup method below
+ // libdbus calls the cleanup method below
dbus_pending_call_unref(libdbusPendingCall);
}
@@ -483,71 +461,74 @@ void DBusConnection::onLibdbusDataCleanup(void* userData) {
//Would not be needed if libdbus would actually handle its timeouts for pending calls.
void DBusConnection::enforceAsynchronousTimeouts() const {
- enforceTimeoutMutex_.lock();
-
- //Assert that we DO have a reference to the executing thread, even if the DBusConnection is destroyed.
- //We need it to assess whether we still may access the members of the DBusConnection.
- std::shared_ptr<std::thread> threadPtr = enforcerThread_;
-
- while (!timeoutMap_.empty()) {
- auto minTimeoutElement = std::min_element(timeoutMap_.begin(), timeoutMap_.end(),
- [] (const TimeoutMapElement& lhs, const TimeoutMapElement& rhs) {
- return std::get<0>(lhs.second) < std::get<0>(rhs.second);
- });
+ std::unique_lock<std::mutex> itsLock(enforcerThreadMutex_);
- int minTimeout = std::get<0>(minTimeoutElement->second);
+ while (!enforcerThreadCancelled_) {
+ enforceTimeoutMutex_.lock();
- enforceTimeoutMutex_.unlock();
+ int minTimeout = std::numeric_limits<int>::max(); // not really, but nearly "forever"
+ if (timeoutMap_.size() > 0) {
+ auto minTimeoutElement = std::min_element(timeoutMap_.begin(), timeoutMap_.end(),
+ [] (const TimeoutMapElement& lhs, const TimeoutMapElement& rhs) {
+ return std::get<0>(lhs.second) < std::get<0>(rhs.second);
+ });
- std::this_thread::sleep_for(std::chrono::milliseconds(minTimeout));
-
- //Do not access members if the DBusConnection was destroyed during the unlocked phase.
- if (!threadPtr.unique()) {
- enforceTimeoutMutex_.lock();
- auto it = timeoutMap_.begin();
- while (!threadPtr.unique() && it != timeoutMap_.end()) {
- int& currentTimeout = std::get<0>(it->second);
- currentTimeout -= minTimeout;
- if (currentTimeout <= 0) {
- 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);
- 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;
-
- }
- 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 {
- ++it;
- }
- }
+ minTimeout = std::get<0>(minTimeoutElement->second);
}
- }
- //Normally there is at least the member of DBusConnection plus the local copy of this pointer.
- //If the local copy is the only one remaining, we have to assume that the DBusConnection was
- //destroyed and therefore we must no longer access its members.
- if (!threadPtr.unique()) {
- enforcerThread_.reset();
enforceTimeoutMutex_.unlock();
- }
- threadPtr->detach();
+ auto startTime = std::chrono::high_resolution_clock::now();
+ if (std::cv_status::timeout ==
+ enforceTimeoutCondition_.wait_for(itsLock, std::chrono::milliseconds(minTimeout))) {
+
+ //Do not access members if the DBusConnection was destroyed during the unlocked phase.
+ enforceTimeoutMutex_.lock();
+ auto it = timeoutMap_.begin();
+ while (it != timeoutMap_.end()) {
+ int& currentTimeout = std::get<0>(it->second);
+
+ currentTimeout -= minTimeout;
+ if (currentTimeout <= 0) {
+ 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_pair(asyncHandler, dbusMessageCall));
+ } 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;
+ }
+ }
+ 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 {
+ ++it;
+ }
+ }
+ enforceTimeoutMutex_.unlock();
+ } else {
+ auto notifyTime = std::chrono::high_resolution_clock::now();
+ int elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(notifyTime - startTime).count();
+ for (auto &i : timeoutMap_)
+ std::get<0>(i.second) -= elapsed;
+ }
+ }
}
std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
const DBusMessage& dbusMessage,
std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
- int timeoutMilliseconds) const {
+ const CommonAPI::CallInfo *_info) const {
assert(dbusMessage);
assert(isConnected());
@@ -556,10 +537,14 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
dbus_bool_t libdbusSuccess;
suspendDispatching();
- libdbusSuccess = dbus_connection_send_with_reply(libdbusConnection_,
- dbusMessage.libdbusMessage_,
+ libdbusSuccess = dbus_connection_send_with_reply(connection_,
+ dbusMessage.message_,
&libdbusPendingCall,
- timeoutMilliseconds);
+ _info->timeout_);
+
+ if (_info->sender_ != 0) {
+ COMMONAPI_DEBUG("Message sent: SenderID: ", _info->sender_, " - Serial number: ", dbusMessage.getSerial());
+ }
if (!libdbusSuccess || !libdbusPendingCall) {
dbusMessageReplyAsyncHandler->onDBusMessageReply(CallStatus::CONNECTION_FAILED, dbusMessage.createMethodError(DBUS_ERROR_DISCONNECTED));
@@ -567,32 +552,39 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
return dbusMessageReplyAsyncHandler->getFuture();
}
- libdbusSuccess = dbus_pending_call_set_notify(
- libdbusPendingCall,
- onLibdbusPendingCallNotifyThunk,
- dbusMessageReplyAsyncHandler.get(),
- onLibdbusDataCleanup);
-
- if (!libdbusSuccess) {
- dbusMessageReplyAsyncHandler->onDBusMessageReply(CallStatus::OUT_OF_MEMORY, dbusMessage);
- dbus_pending_call_unref(libdbusPendingCall);
- resumeDispatching();
- return dbusMessageReplyAsyncHandler->getFuture();
- }
+ sendLock_.lock();
+ if (dbus_pending_call_get_completed (libdbusPendingCall)) {
+ onLibdbusPendingCallNotifyThunk(libdbusPendingCall, dbusMessageReplyAsyncHandler.get());
+ onLibdbusDataCleanup(dbusMessageReplyAsyncHandler.get());
+
+ } else {
+ libdbusSuccess = dbus_pending_call_set_notify(
+ libdbusPendingCall,
+ onLibdbusPendingCallNotifyThunk,
+ dbusMessageReplyAsyncHandler.get(),
+ onLibdbusDataCleanup);
+
+ if (!libdbusSuccess) {
+ dbusMessageReplyAsyncHandler->onDBusMessageReply(CallStatus::OUT_OF_MEMORY, dbusMessage);
+ dbus_pending_call_unref(libdbusPendingCall);
+ resumeDispatching();
+ sendLock_.unlock();
+ return dbusMessageReplyAsyncHandler->getFuture();
+ }
+ }
+ sendLock_.unlock();
DBusMessageReplyAsyncHandler* replyAsyncHandler = dbusMessageReplyAsyncHandler.release();
- const bool mainloopContextIsPresent = (bool) mainLoopContext_.lock();
- if (!mainloopContextIsPresent && timeoutMilliseconds != DBUS_TIMEOUT_INFINITE) {
+ if (_info->timeout_ != DBUS_TIMEOUT_INFINITE) {
dbus_pending_call_ref(libdbusPendingCall);
- std::tuple<int, DBusMessageReplyAsyncHandler*, DBusMessage> toInsert {timeoutMilliseconds, replyAsyncHandler, dbusMessage};
+ std::tuple<int, DBusMessageReplyAsyncHandler*, DBusMessage> toInsert { _info->timeout_, replyAsyncHandler, dbusMessage };
enforceTimeoutMutex_.lock();
- timeoutMap_.insert( {libdbusPendingCall, toInsert } );
- if (!enforcerThread_) {
- enforcerThread_ = std::make_shared<std::thread>(std::bind(&DBusConnection::enforceAsynchronousTimeouts, this->shared_from_this()));
- }
+ timeoutMap_.insert( { libdbusPendingCall, toInsert } );
enforceTimeoutMutex_.unlock();
+
+ enforceTimeoutCondition_.notify_all();
}
std::future<CallStatus> result = replyAsyncHandler->getFuture();
@@ -602,21 +594,24 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
return result;
}
-
DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage& dbusMessage,
DBusError& dbusError,
- int timeoutMilliseconds) const {
+ const CommonAPI::CallInfo *_info) const {
assert(dbusMessage);
assert(!dbusError);
assert(isConnected());
suspendDispatching();
- ::DBusMessage* libdbusMessageReply = dbus_connection_send_with_reply_and_block(libdbusConnection_,
- dbusMessage.libdbusMessage_,
- timeoutMilliseconds,
+ ::DBusMessage* libdbusMessageReply = dbus_connection_send_with_reply_and_block(connection_,
+ dbusMessage.message_,
+ _info->timeout_,
&dbusError.libdbusError_);
+ if (_info->sender_ != 0) {
+ COMMONAPI_DEBUG("Message sent: SenderID: ", _info->sender_, " - Serial number: ", dbusMessage.getSerial());
+ }
+
resumeDispatching();
if (dbusError) {
@@ -629,11 +624,18 @@ DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage&
bool DBusConnection::singleDispatch() {
- return (dbus_connection_dispatch(libdbusConnection_) == DBUS_DISPATCH_DATA_REMAINS);
+ for (auto t : mainloopTimeouts_) {
+ t.first->onDBusMessageReply(CallStatus::REMOTE_ERROR, t.second.createMethodError(DBUS_ERROR_TIMEOUT));
+ delete t.first;
+ }
+ mainloopTimeouts_.clear();
+
+ return (dbus_connection_dispatch(connection_) == DBUS_DISPATCH_DATA_REMAINS);
}
bool DBusConnection::isDispatchReady() {
- return (dbus_connection_get_dispatch_status(libdbusConnection_) == DBUS_DISPATCH_DATA_REMAINS);
+ return (dbus_connection_get_dispatch_status(connection_) == DBUS_DISPATCH_DATA_REMAINS ||
+ !mainloopTimeouts_.empty());
}
DBusProxyConnection::DBusSignalHandlerToken DBusConnection::subscribeForSelectiveBroadcast(
@@ -648,22 +650,22 @@ DBusProxyConnection::DBusSignalHandlerToken DBusConnection::subscribeForSelectiv
std::string methodName = "subscribeFor" + interfaceMemberName + "Selective";
subscriptionAccepted = false;
+
CommonAPI::CallStatus callStatus;
DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
CommonAPI::DBus::DBusSerializableArguments<bool>>::callMethodWithReply(
- *callingProxy, methodName.c_str(), "", callStatus, subscriptionAccepted);
+ *callingProxy, methodName.c_str(), "", &CommonAPI::DBus::defaultCallInfo, callStatus, subscriptionAccepted);
DBusProxyConnection::DBusSignalHandlerToken subscriptionToken;
-
if (callStatus == CommonAPI::CallStatus::SUCCESS && subscriptionAccepted) {
subscriptionToken = addSignalMemberHandler(
- objectPath,
- interfaceName,
- interfaceMemberName,
- interfaceMemberSignature,
- dbusSignalHandler,
- true);
-
+ objectPath,
+ interfaceName,
+ interfaceMemberName,
+ interfaceMemberSignature,
+ dbusSignalHandler,
+ true
+ );
subscriptionAccepted = true;
}
@@ -682,7 +684,7 @@ void DBusConnection::unsubscribeFromSelectiveBroadcast(const std::string& eventN
CommonAPI::CallStatus callStatus;
DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
CommonAPI::DBus::DBusSerializableArguments<>>::callMethodWithReply(
- *callingProxy, methodName.c_str(), "", callStatus);
+ *callingProxy, methodName.c_str(), "", &CommonAPI::DBus::defaultCallInfo, callStatus);
}
}
@@ -698,56 +700,43 @@ DBusProxyConnection::DBusSignalHandlerToken DBusConnection::addSignalMemberHandl
interfaceMemberName,
interfaceMemberSignature);
std::lock_guard < std::mutex > dbusSignalLock(signalGuard_);
- const bool isFirstSignalMemberHandler = dbusSignalHandlerTable_.find(dbusSignalHandlerPath)
- == dbusSignalHandlerTable_.end();
- dbusSignalHandlerTable_.insert(DBusSignalHandlerTable::value_type(dbusSignalHandlerPath, dbusSignalHandler));
+ auto signalEntry = dbusSignalHandlerTable_.find(dbusSignalHandlerPath);
+ const bool isFirstSignalMemberHandler = (signalEntry == dbusSignalHandlerTable_.end());
if (isFirstSignalMemberHandler) {
addLibdbusSignalMatchRule(objectPath, interfaceName, interfaceMemberName, justAddFilter);
+ std::set<DBusSignalHandler*> handlerList;
+ handlerList.insert(dbusSignalHandler);
+
+ dbusSignalHandlerTable_.insert( {
+ dbusSignalHandlerPath,
+ std::make_pair(std::make_shared<std::recursive_mutex>(), std::move(handlerList))
+ } );
+ } else {
+ signalEntry->second.first->lock();
+ signalEntry->second.second.insert(dbusSignalHandler);
+ signalEntry->second.first->unlock();
}
return dbusSignalHandlerPath;
}
-bool DBusConnection::removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken,
- const DBusSignalHandler* dbusSignalHandler) {
+bool DBusConnection::removeSignalMemberHandler(const DBusSignalHandlerToken &dbusSignalHandlerToken,
+ const DBusSignalHandler *dbusSignalHandler) {
bool lastHandlerRemoved = false;
+ std::lock_guard < std::mutex > dbusSignalLock(signalGuard_);
- std::lock_guard<std::mutex> dbusSignalLock(signalGuard_);
- auto equalRangeIteratorPair = dbusSignalHandlerTable_.equal_range(dbusSignalHandlerToken);
- if (equalRangeIteratorPair.first != equalRangeIteratorPair.second) {
- // advance to the next element
- auto iteratorToNextElement = equalRangeIteratorPair.first;
- iteratorToNextElement++;
-
- // check if the first element was the only element
- const bool isLastSignalMemberHandler = iteratorToNextElement == equalRangeIteratorPair.second;
-
- if (isLastSignalMemberHandler) {
- const std::string& objectPath = std::get<0>(dbusSignalHandlerToken);
- const std::string& interfaceName = std::get<1>(dbusSignalHandlerToken);
- const std::string& interfaceMemberName = std::get<2>(dbusSignalHandlerToken);
+ auto signalEntry = dbusSignalHandlerTable_.find(dbusSignalHandlerToken);
+ if (signalEntry != dbusSignalHandlerTable_.end()) {
- removeLibdbusSignalMatchRule(objectPath, interfaceName, interfaceMemberName);
- lastHandlerRemoved = true;
- }
-
- if(dbusSignalHandler == NULL) {
- // remove all handlers
- dbusSignalHandlerTable_.erase(dbusSignalHandlerToken);
- } else {
- // just remove specific handler
- while(equalRangeIteratorPair.first != equalRangeIteratorPair.second) {
- if(equalRangeIteratorPair.first->second == dbusSignalHandler) {
- equalRangeIteratorPair.first = dbusSignalHandlerTable_.erase(equalRangeIteratorPair.first);
- }
- else {
- equalRangeIteratorPair.first++;
- }
- }
+ signalEntry->second.first->lock();
+ auto selectedHandler = signalEntry->second.second.find(const_cast<DBusSignalHandler*>(dbusSignalHandler));
+ if (selectedHandler != signalEntry->second.second.end()) {
+ signalEntry->second.second.erase(selectedHandler);
+ lastHandlerRemoved = (signalEntry->second.second.empty());
}
+ signalEntry->second.first->unlock();
}
-
return lastHandlerRemoved;
}
@@ -758,6 +747,7 @@ bool DBusConnection::addObjectManagerSignalMemberHandler(const std::string& dbus
}
std::lock_guard<std::mutex> dbusSignalLock(dbusObjectManagerSignalGuard_);
+
auto dbusSignalMatchRuleIterator = dbusObjectManagerSignalMatchRulesMap_.find(dbusBusName);
const bool isDBusSignalMatchRuleFound = (dbusSignalMatchRuleIterator != dbusObjectManagerSignalMatchRulesMap_.end());
@@ -774,17 +764,15 @@ bool DBusConnection::addObjectManagerSignalMemberHandler(const std::string& dbus
const bool isRemoveSignalMatchRuleSuccessful = removeObjectManagerSignalMatchRule(dbusBusName);
assert(isRemoveSignalMatchRuleSuccessful);
}
-
return false;
}
dbusSignalMatchRuleIterator = insertResult.first;
}
- size_t& dbusSignalMatchRuleRefernceCount = dbusSignalMatchRuleIterator->second;
- dbusSignalMatchRuleRefernceCount++;
-
- dbusObjectManagerSignalHandlerTable_.insert({ dbusBusName, dbusSignalHandler });
+ size_t &dbusSignalMatchRuleReferenceCount = dbusSignalMatchRuleIterator->second;
+ dbusSignalMatchRuleReferenceCount++;
+ dbusObjectManagerSignalHandlerTable_.insert( { dbusBusName, dbusSignalHandler } );
return true;
}
@@ -794,6 +782,7 @@ bool DBusConnection::removeObjectManagerSignalMemberHandler(const std::string& d
assert(!dbusBusName.empty());
std::lock_guard<std::mutex> dbusSignalLock(dbusObjectManagerSignalGuard_);
+
auto dbusSignalMatchRuleIterator = dbusObjectManagerSignalMatchRulesMap_.find(dbusBusName);
const bool isDBusSignalMatchRuleFound = (dbusSignalMatchRuleIterator != dbusObjectManagerSignalMatchRulesMap_.end());
@@ -807,7 +796,6 @@ bool DBusConnection::removeObjectManagerSignalMemberHandler(const std::string& d
dbusObjectManagerSignalHandlerRange.second,
[&](decltype(*dbusObjectManagerSignalHandlerRange.first)& it) { return it.second == dbusSignalHandler; });
const bool isDBusSignalHandlerFound = (dbusObjectManagerSignalHandlerIterator != dbusObjectManagerSignalHandlerRange.second);
-
if (!isDBusSignalHandlerFound) {
return false;
}
@@ -833,21 +821,17 @@ bool DBusConnection::removeObjectManagerSignalMemberHandler(const std::string& d
bool DBusConnection::addObjectManagerSignalMatchRule(const std::string& dbusBusName) {
std::ostringstream dbusMatchRuleStringStream;
-
dbusMatchRuleStringStream << "type='signal'"
<< ",sender='" << dbusBusName << "'"
<< ",interface='org.freedesktop.DBus.ObjectManager'";
-
return addLibdbusSignalMatchRule(dbusMatchRuleStringStream.str());
}
bool DBusConnection::removeObjectManagerSignalMatchRule(const std::string& dbusBusName) {
std::ostringstream dbusMatchRuleStringStream;
-
dbusMatchRuleStringStream << "type='signal'"
<< ",sender='" << dbusBusName << "'"
<< ",interface='org.freedesktop.DBus.ObjectManager'";
-
return removeLibdbusSignalMatchRule(dbusMatchRuleStringStream.str());
}
@@ -864,17 +848,18 @@ bool DBusConnection::addLibdbusSignalMatchRule(const std::string& dbusMatchRule)
// add the libdbus message signal filter
if (!libdbusSignalMatchRulesCount_) {
- libdbusSuccess = (bool) dbus_connection_add_filter(
- libdbusConnection_,
+ libdbusSuccess = 0 != dbus_connection_add_filter(
+ connection_,
&onLibdbusSignalFilterThunk,
this,
- NULL);
+ NULL
+ );
}
// finally add the match rule
if (libdbusSuccess) {
DBusError dbusError;
- dbus_bus_add_match(libdbusConnection_, dbusMatchRule.c_str(), &dbusError.libdbusError_);
+ dbus_bus_add_match(connection_, dbusMatchRule.c_str(), &dbusError.libdbusError_);
libdbusSuccess = !dbusError;
}
@@ -894,21 +879,17 @@ bool DBusConnection::addLibdbusSignalMatchRule(const std::string& dbusMatchRule)
* @return
*/
bool DBusConnection::removeLibdbusSignalMatchRule(const std::string& dbusMatchRule) {
- //assert(libdbusSignalMatchRulesCount_ > 0);
if(libdbusSignalMatchRulesCount_ == 0)
return true;
suspendDispatching();
- DBusError dbusError;
- dbus_bus_remove_match(libdbusConnection_, dbusMatchRule.c_str(), &dbusError.libdbusError_);
+ dbus_bus_remove_match(connection_, dbusMatchRule.c_str(), NULL);
- if (!dbusError) {
- libdbusSignalMatchRulesCount_--;
- if (libdbusSignalMatchRulesCount_ == 0) {
- dbus_connection_remove_filter(libdbusConnection_, &onLibdbusSignalFilterThunk, this);
- }
- }
+ libdbusSignalMatchRulesCount_--;
+ if (libdbusSignalMatchRulesCount_ == 0) {
+ dbus_connection_remove_filter(connection_, &onLibdbusSignalFilterThunk, this);
+ }
resumeDispatching();
@@ -932,7 +913,7 @@ void DBusConnection::registerObjectPath(const std::string& objectPath) {
if (isConnected()) {
DBusError dbusError;
- const dbus_bool_t libdbusSuccess = dbus_connection_try_register_object_path(libdbusConnection_,
+ const dbus_bool_t libdbusSuccess = dbus_connection_try_register_object_path(connection_,
objectPath.c_str(),
getDBusObjectPathVTable(),
this,
@@ -960,9 +941,8 @@ void DBusConnection::unregisterObjectPath(const std::string& objectPath) {
libdbusRegisteredObjectPaths_.erase(handlerIterator);
if (isConnected()) {
- dbus_bool_t libdbusSuccess = dbus_connection_unregister_object_path(libdbusConnection_,
- objectPath.c_str());
-
+ dbus_bool_t libdbusSuccess
+ = dbus_connection_unregister_object_path(connection_, objectPath.c_str());
assert(libdbusSuccess);
}
}
@@ -999,13 +979,16 @@ void DBusConnection::addLibdbusSignalMatchRule(const std::string& objectPath,
assert(success.second);
if (isConnected()) {
+ bool libdbusSuccess = true;
suspendDispatching();
// add the libdbus message signal filter
if (isFirstMatchRule) {
- const dbus_bool_t libdbusSuccess = dbus_connection_add_filter(libdbusConnection_,
- &onLibdbusSignalFilterThunk,
- this,
- NULL);
+
+ libdbusSuccess = 0 != dbus_connection_add_filter(
+ connection_,
+ &onLibdbusSignalFilterThunk,
+ this,
+ NULL);
assert(libdbusSuccess);
}
@@ -1013,10 +996,14 @@ void DBusConnection::addLibdbusSignalMatchRule(const std::string& objectPath,
{
// finally add the match rule
DBusError dbusError;
- dbus_bus_add_match(libdbusConnection_, matchRuleString.c_str(), &dbusError.libdbusError_);
+ dbus_bus_add_match(connection_, matchRuleString.c_str(), &dbusError.libdbusError_);
assert(!dbusError);
}
+ if (libdbusSuccess) {
+ libdbusSignalMatchRulesCount_++;
+ }
+
resumeDispatching();
}
}
@@ -1057,14 +1044,14 @@ void DBusConnection::initLibdbusObjectPathHandlerAfterConnect() {
DBusError dbusError;
dbus_bool_t libdbusSuccess;
- for ( auto handlerIterator = libdbusRegisteredObjectPaths_.begin();
- handlerIterator != libdbusRegisteredObjectPaths_.end();
- handlerIterator++) {
+ for (auto handlerIterator = libdbusRegisteredObjectPaths_.begin();
+ handlerIterator != libdbusRegisteredObjectPaths_.end();
+ handlerIterator++) {
const std::string& objectPath = handlerIterator->first;
dbusError.clear();
- libdbusSuccess = dbus_connection_try_register_object_path(libdbusConnection_,
+ libdbusSuccess = dbus_connection_try_register_object_path(connection_,
objectPath.c_str(),
getDBusObjectPathVTable(),
this,
@@ -1107,24 +1094,38 @@ void DBusConnection::initLibdbusSignalFilterAfterConnect() {
template<typename DBusSignalHandlersTable>
void notifyDBusSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable,
- std::pair<typename DBusSignalHandlersTable::iterator,
- typename DBusSignalHandlersTable::iterator>& equalRange,
+ typename DBusSignalHandlersTable::iterator& signalEntry,
const CommonAPI::DBus::DBusMessage& dbusMessage,
::DBusHandlerResult& dbusHandlerResult) {
- if (equalRange.first != equalRange.second) {
+ if (signalEntry == dbusSignalHandlerstable.end() || signalEntry->second.second.empty()) {
dbusHandlerResult = DBUS_HANDLER_RESULT_HANDLED;
+ return;
+ }
+
+ signalEntry->second.first->lock();
+ auto handlerEntry = signalEntry->second.second.begin();
+ while (handlerEntry != signalEntry->second.second.end()) {
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler = *handlerEntry;
+ dbusSignalHandler->onSignalDBusMessage(dbusMessage);
+ handlerEntry++;
}
+ dbusHandlerResult = DBUS_HANDLER_RESULT_HANDLED;
+ signalEntry->second.first->unlock();
+}
+template<typename DBusSignalHandlersTable>
+void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable,
+ std::pair<typename DBusSignalHandlersTable::iterator,
+ typename DBusSignalHandlersTable::iterator>& equalRange,
+ const CommonAPI::DBus::DBusMessage &dbusMessage,
+ ::DBusHandlerResult &dbusHandlerResult) {
+ if (equalRange.first != equalRange.second) {
+ dbusHandlerResult = DBUS_HANDLER_RESULT_HANDLED;
+ }
while (equalRange.first != equalRange.second) {
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler = equalRange.first->second;
-
- auto dbusSignalHandlerSubscriptionStatus = dbusSignalHandler->onSignalDBusMessage(dbusMessage);
-
- if (dbusSignalHandlerSubscriptionStatus == SubscriptionStatus::CANCEL) {
- equalRange.first = dbusSignalHandlerstable.erase(equalRange.first);
- } else {
- equalRange.first++;
- }
+ dbusSignalHandler->onSignalDBusMessage(dbusMessage);
+ equalRange.first++;
}
}
@@ -1152,24 +1153,23 @@ void notifyDBusSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable,
::DBusHandlerResult dbusHandlerResult = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
signalGuard_.lock();
- auto dbusSignalHandlerIteratorPair = dbusSignalHandlerTable_.equal_range(DBusSignalHandlerPath(
+ auto signalEntry = dbusSignalHandlerTable_.find(DBusSignalHandlerPath(
objectPath,
interfaceName,
interfaceMemberName,
interfaceMemberSignature));
- notifyDBusSignalHandlers(dbusSignalHandlerTable_,
- dbusSignalHandlerIteratorPair,
- dbusMessage,
- dbusHandlerResult);
signalGuard_.unlock();
+ notifyDBusSignalHandlers(dbusSignalHandlerTable_,
+ signalEntry, dbusMessage, dbusHandlerResult);
+
if (dbusMessage.hasInterfaceName("org.freedesktop.DBus.ObjectManager")) {
- const char* dbusSenderName = dbusMessage.getSenderName();
+ const char* dbusSenderName = dbusMessage.getSender();
assert(dbusSenderName);
dbusObjectManagerSignalGuard_.lock();
auto dbusObjectManagerSignalHandlerIteratorPair = dbusObjectManagerSignalHandlerTable_.equal_range(dbusSenderName);
- notifyDBusSignalHandlers(dbusObjectManagerSignalHandlerTable_,
+ notifyDBusOMSignalHandlers(dbusObjectManagerSignalHandlerTable_,
dbusObjectManagerSignalHandlerIteratorPair,
dbusMessage,
dbusHandlerResult);
@@ -1179,53 +1179,36 @@ void notifyDBusSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable,
return dbusHandlerResult;
}
-::DBusHandlerResult DBusConnection::onLibdbusSignalFilterThunk(::DBusConnection* libdbusConnection,
+::DBusHandlerResult DBusConnection::onLibdbusSignalFilterThunk(::DBusConnection *_dbusConnection,
::DBusMessage* libdbusMessage,
void* userData) {
- assert(libdbusConnection);
+ assert(_dbusConnection);
assert(libdbusMessage);
assert(userData);
DBusConnection* dbusConnection = reinterpret_cast<DBusConnection*>(userData);
-
- assert(dbusConnection->libdbusConnection_ == libdbusConnection);
-
+ assert(dbusConnection->connection_ == _dbusConnection);
return dbusConnection->onLibdbusSignalFilter(libdbusMessage);
}
-::DBusHandlerResult DBusConnection::onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
+::DBusHandlerResult DBusConnection::onLibdbusObjectPathMessageThunk(::DBusConnection *_dbusConnection,
::DBusMessage* libdbusMessage,
void* userData) {
- assert(libdbusConnection);
+ assert(_dbusConnection);
assert(libdbusMessage);
assert(userData);
DBusConnection* dbusConnection = reinterpret_cast<DBusConnection*>(userData);
-
- assert(dbusConnection->libdbusConnection_ == libdbusConnection);
-
+ assert(dbusConnection->connection_ == _dbusConnection);
return dbusConnection->onLibdbusObjectPathMessage(libdbusMessage);
}
-
-std::shared_ptr<DBusConnection> DBusConnection::getBus(const BusType& busType) {
- return std::make_shared<DBusConnection>(busType);
-}
-
-std::shared_ptr<DBusConnection> DBusConnection::wrapLibDBus(::DBusConnection* libDbusConnection) {
- return std::make_shared<DBusConnection>(libDbusConnection);
-}
-
-std::shared_ptr<DBusConnection> DBusConnection::getSessionBus() {
- return getBus(BusType::SESSION);
-}
-
-std::shared_ptr<DBusConnection> DBusConnection::getSystemBus() {
- return getBus(BusType::SYSTEM);
+std::shared_ptr<DBusConnection> DBusConnection::getBus(const DBusType_t &_type) {
+ return std::make_shared<DBusConnection>(_type);
}
-std::shared_ptr<DBusConnection> DBusConnection::getStarterBus() {
- return getBus(BusType::STARTER);
+std::shared_ptr<DBusConnection> DBusConnection::wrap(::DBusConnection *_connection) {
+ return std::make_shared<DBusConnection>(_connection);
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusConnection.h b/src/CommonAPI/DBus/DBusConnection.h
deleted file mode 100644
index 7550c10..0000000
--- a/src/CommonAPI/DBus/DBusConnection.h
+++ /dev/null
@@ -1,242 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_CONNECTION_H_
-#define COMMONAPI_DBUS_DBUS_CONNECTION_H_
-
-#include "DBusProxyConnection.h"
-#include "DBusDaemonProxy.h"
-#include "DBusServiceRegistry.h"
-#include "DBusObjectManager.h"
-#include "DBusMainLoopContext.h"
-#include "DBusConnectionBusType.h"
-
-#include <dbus/dbus.h>
-
-#include <atomic>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusObjectManager;
-
-class DBusConnectionStatusEvent: public DBusProxyConnection::ConnectionStatusEvent {
- friend class DBusConnection;
-
- public:
- DBusConnectionStatusEvent(DBusConnection* dbusConnection);
-
- protected:
- virtual void onListenerAdded(const CancellableListener& listener);
-
- DBusConnection* dbusConnection_;
-};
-
-struct WatchContext {
- WatchContext(std::weak_ptr<MainLoopContext> mainLoopContext, DispatchSource* dispatchSource) :
- mainLoopContext_(mainLoopContext), dispatchSource_(dispatchSource) {
- }
-
- std::weak_ptr<MainLoopContext> mainLoopContext_;
- DispatchSource* dispatchSource_;
-};
-
-class DBusConnection: public DBusProxyConnection, public std::enable_shared_from_this<DBusConnection> {
- public:
- DBusConnection(BusType busType);
-
- static std::shared_ptr<DBusConnection> getBus(const BusType& dbusBusType);
- static std::shared_ptr<DBusConnection> wrapLibDBus(::DBusConnection* libDbusConnection);
- static std::shared_ptr<DBusConnection> getSessionBus();
- static std::shared_ptr<DBusConnection> getSystemBus();
- static std::shared_ptr<DBusConnection> getStarterBus();
-
- DBusConnection(const DBusConnection&) = delete;
- DBusConnection(::DBusConnection* libDbusConnection);
-
- DBusConnection& operator=(const DBusConnection&) = delete;
- virtual ~DBusConnection();
-
- BusType getBusType() const;
-
- bool connect(bool startDispatchThread = true);
- bool connect(DBusError& dbusError, bool startDispatchThread = true);
- void disconnect();
-
- virtual bool isConnected() const;
-
- virtual ConnectionStatusEvent& getConnectionStatusEvent();
-
- virtual bool requestServiceNameAndBlock(const std::string& serviceName) const;
- virtual bool releaseServiceName(const std::string& serviceName) const;
-
- bool sendDBusMessage(const DBusMessage& dbusMessage, uint32_t* allocatedSerial = NULL) const;
-
- static const int kDefaultSendTimeoutMs = 5000;
-
- std::future<CallStatus> sendDBusMessageWithReplyAsync(
- const DBusMessage& dbusMessage,
- std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
- int timeoutMilliseconds = kDefaultSendTimeoutMs) const;
-
- DBusMessage sendDBusMessageWithReplyAndBlock(const DBusMessage& dbusMessage,
- DBusError& dbusError,
- int timeoutMilliseconds = kDefaultSendTimeoutMs) const;
-
- virtual bool addObjectManagerSignalMemberHandler(const std::string& dbusBusName,
- DBusSignalHandler* dbusSignalHandler);
- virtual bool removeObjectManagerSignalMemberHandler(const std::string& dbusBusName,
- DBusSignalHandler* dbusSignalHandler);
-
- DBusSignalHandlerToken addSignalMemberHandler(const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName,
- const std::string& interfaceMemberSignature,
- DBusSignalHandler* dbusSignalHandler,
- const bool justAddFilter = false);
-
- DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcast(bool& subscriptionAccepted,
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName,
- const std::string& interfaceMemberSignature,
- DBusSignalHandler* dbusSignalHandler,
- DBusProxy* callingProxy);
-
- void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
- DBusProxyConnection::DBusSignalHandlerToken subscription,
- DBusProxy* callingProxy,
- const DBusSignalHandler* dbusSignalHandler);
-
- void registerObjectPath(const std::string& objectPath);
- void unregisterObjectPath(const std::string& objectPath);
-
- bool removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken,
- const DBusSignalHandler* dbusSignalHandler = NULL);
- bool readWriteDispatch(int timeoutMilliseconds = -1);
-
- virtual const std::shared_ptr<DBusServiceRegistry> getDBusServiceRegistry();
- virtual const std::shared_ptr<DBusObjectManager> getDBusObjectManager();
-
- void setObjectPathMessageHandler(DBusObjectPathMessageHandler);
- bool isObjectPathMessageHandlerSet();
-
- virtual bool attachMainLoopContext(std::weak_ptr<MainLoopContext>);
-
- bool isDispatchReady();
- bool singleDispatch();
-
- 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:
- void dispatch();
- void suspendDispatching() const;
- void resumeDispatching() const;
-
- std::thread* dispatchThread_;
- bool stopDispatching_;
-
- std::weak_ptr<MainLoopContext> mainLoopContext_;
- DispatchSource* dispatchSource_;
- WatchContext* watchContext_;
-
- mutable bool pauseDispatching_;
- mutable std::mutex dispatchSuspendLock_;
-
- void addLibdbusSignalMatchRule(const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName,
- const bool justAddFilter = false);
-
- void removeLibdbusSignalMatchRule(const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName);
-
- void initLibdbusSignalFilterAfterConnect();
- ::DBusHandlerResult onLibdbusSignalFilter(::DBusMessage* libdbusMessage);
-
- void initLibdbusObjectPathHandlerAfterConnect();
- ::DBusHandlerResult onLibdbusObjectPathMessage(::DBusMessage* libdbusMessage);
-
- static void onLibdbusPendingCallNotifyThunk(::DBusPendingCall* libdbusPendingCall, void* userData);
- static void onLibdbusDataCleanup(void* userData);
-
- static ::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
- ::DBusMessage* libdbusMessage,
- void* userData);
-
- static ::DBusHandlerResult onLibdbusSignalFilterThunk(::DBusConnection* libdbusConnection,
- ::DBusMessage* libdbusMessage,
- void* userData);
-
- static dbus_bool_t onAddWatch(::DBusWatch* libdbusWatch, void* data);
- static void onRemoveWatch(::DBusWatch* libdbusWatch, void* data);
- static void onToggleWatch(::DBusWatch* libdbusWatch, void* data);
-
- static dbus_bool_t onAddTimeout(::DBusTimeout* dbus_timeout, void* data);
- static void onRemoveTimeout(::DBusTimeout* dbus_timeout, void* data);
- static void onToggleTimeout(::DBusTimeout* dbus_timeout, void* data);
-
- static void onWakeupMainContext(void* data);
-
- void enforceAsynchronousTimeouts() const;
- static const DBusObjectPathVTable* getDBusObjectPathVTable();
-
- ::DBusConnection* libdbusConnection_;
- mutable std::mutex libdbusConnectionGuard_;
- std::mutex signalGuard_;
- std::mutex objectManagerGuard_;
- std::mutex serviceRegistryGuard_;
-
- BusType busType_;
-
- std::weak_ptr<DBusServiceRegistry> dbusServiceRegistry_;
- std::shared_ptr<DBusObjectManager> dbusObjectManager_;
-
- DBusConnectionStatusEvent dbusConnectionStatusEvent_;
-
- DBusSignalMatchRulesMap dbusSignalMatchRulesMap_;
-
- DBusSignalHandlerTable dbusSignalHandlerTable_;
-
- std::unordered_map<std::string, size_t> dbusObjectManagerSignalMatchRulesMap_;
- std::unordered_multimap<std::string, DBusSignalHandler*> dbusObjectManagerSignalHandlerTable_;
- std::mutex dbusObjectManagerSignalGuard_;
-
- bool addObjectManagerSignalMatchRule(const std::string& dbusBusName);
- bool removeObjectManagerSignalMatchRule(const std::string& dbusBusName);
-
- bool addLibdbusSignalMatchRule(const std::string& dbusMatchRule);
- bool removeLibdbusSignalMatchRule(const std::string& dbusMatchRule);
-
- std::atomic_size_t libdbusSignalMatchRulesCount_;
-
- // objectPath, referenceCount
- typedef std::unordered_map<std::string, uint32_t> LibdbusRegisteredObjectPathHandlersTable;
- LibdbusRegisteredObjectPathHandlersTable libdbusRegisteredObjectPaths_;
-
- DBusObjectPathMessageHandler dbusObjectMessageHandler_;
-
- mutable std::unordered_map<std::string, uint16_t> connectionNameCount_;
-
- typedef std::pair<DBusPendingCall*, std::tuple<int, DBusMessageReplyAsyncHandler*, DBusMessage> > TimeoutMapElement;
- mutable std::map<DBusPendingCall*, std::tuple<int, DBusMessageReplyAsyncHandler*, DBusMessage>> timeoutMap_;
- mutable std::shared_ptr<std::thread> enforcerThread_;
- mutable std::mutex enforceTimeoutMutex_;
-};
-
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_CONNECTION_H_
diff --git a/src/CommonAPI/DBus/DBusConnectionBusType.h b/src/CommonAPI/DBus/DBusConnectionBusType.h
deleted file mode 100644
index bdb98d9..0000000
--- a/src/CommonAPI/DBus/DBusConnectionBusType.h
+++ /dev/null
@@ -1,26 +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 DBUSCONNECTIONBUSTYPE_H_
-#define DBUSCONNECTIONBUSTYPE_H_
-
-#include <dbus/dbus-shared.h>
-
-namespace CommonAPI {
-namespace DBus {
-
-enum BusType {
- SESSION = DBUS_BUS_SESSION,
- SYSTEM = DBUS_BUS_SYSTEM,
- STARTER = DBUS_BUS_STARTER,
- WRAPPED
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif /* DBUSCONNECTIONBUSTYPE_H_ */
diff --git a/src/CommonAPI/DBus/DBusDaemonProxy.cpp b/src/CommonAPI/DBus/DBusDaemonProxy.cpp
index e6ed98c..489f06b 100644
--- a/src/CommonAPI/DBus/DBusDaemonProxy.cpp
+++ b/src/CommonAPI/DBus/DBusDaemonProxy.cpp
@@ -1,12 +1,12 @@
-/* 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 "DBusDaemonProxy.h"
-#include "DBusProxyHelper.h"
+// 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 <CommonAPI/Address.hpp>
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusDaemonProxy.hpp>
+#include <CommonAPI/DBus/DBusProxyHelper.hpp>
namespace CommonAPI {
namespace DBus {
@@ -15,12 +15,14 @@ StaticInterfaceVersionAttribute::StaticInterfaceVersionAttribute(const uint32_t&
version_(majorValue, minorValue) {
}
-void StaticInterfaceVersionAttribute::getValue(CallStatus& callStatus, Version& version) const {
- version = version_;
- callStatus = CallStatus::SUCCESS;
+void StaticInterfaceVersionAttribute::getValue(CallStatus &_status, Version &_version,
+ const CommonAPI::CallInfo *_info) const {
+ _version = version_;
+ _status = CallStatus::SUCCESS;
}
-std::future<CallStatus> StaticInterfaceVersionAttribute::getValueAsync(AttributeAsyncCallback attributeAsyncCallback) {
+std::future<CallStatus> StaticInterfaceVersionAttribute::getValueAsync(AttributeAsyncCallback attributeAsyncCallback,
+ const CommonAPI::CallInfo *_info) {
attributeAsyncCallback(CallStatus::SUCCESS, version_);
std::promise<CallStatus> versionPromise;
@@ -29,44 +31,22 @@ std::future<CallStatus> StaticInterfaceVersionAttribute::getValueAsync(Attribute
return versionPromise.get_future();
}
-
-static const std::string dbusDaemonBusName_ = "org.freedesktop.DBus";
-static const std::string dbusDaemonObjectPath_ = "/org/freedesktop/DBus";
-static const std::string dbusDaemonInterfaceName_ = DBusDaemonProxy::getInterfaceId();
-static const std::string commonApiParticipantId_ = "org.freedesktop.DBus-/org/freedesktop/DBus";
-
+//static const char *DAEMON_COMMONAPI_ADDRESS = "org.freedesktop.DBus-/org/freedesktop/DBus";
+static const char *DAEMON_DBUS_INTERFACE = DBusDaemonProxy::getInterfaceId();
+static const char *DAEMON_DBUS_OBJECT_PATH = "/org/freedesktop/DBus";
+static const char *DAEMON_DBUS_BUS = "org.freedesktop.DBus";
+static DBusAddress dbusProxyAddress(DAEMON_DBUS_INTERFACE, DAEMON_DBUS_OBJECT_PATH, DAEMON_DBUS_BUS);
+static CommonAPI::CallInfo daemonProxyInfo(2000);
DBusDaemonProxy::DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection):
- DBusProxyBase(dbusConnection),
- nameOwnerChangedEvent_(*this, "NameOwnerChanged", "sss"),
+ DBusProxyBase(dbusProxyAddress, dbusConnection),
+ nameOwnerChangedEvent_(*this,
+ "NameOwnerChanged", "sss",
+ std::tuple<std::string, std::string, std::string>()),
interfaceVersionAttribute_(1, 0) {
}
void DBusDaemonProxy::init() {
-
-}
-
-std::string DBusDaemonProxy::getAddress() const {
- return getDomain() + ":" + getServiceId() + ":" + getInstanceId();
-}
-const std::string& DBusDaemonProxy::getDomain() const {
- return commonApiDomain_;
-}
-const std::string& DBusDaemonProxy::getServiceId() const {
- return dbusDaemonInterfaceName_;
-}
-const std::string& DBusDaemonProxy::getInstanceId() const {
- return commonApiParticipantId_;
-}
-
-const std::string& DBusDaemonProxy::getDBusBusName() const {
- return dbusDaemonBusName_;
-}
-const std::string& DBusDaemonProxy::getDBusObjectPath() const {
- return dbusDaemonObjectPath_;
-}
-const std::string& DBusDaemonProxy::getInterfaceName() const {
- return dbusDaemonInterfaceName_;
}
bool DBusDaemonProxy::isAvailable() const {
@@ -93,7 +73,8 @@ void DBusDaemonProxy::listNames(CommonAPI::CallStatus& callStatus, std::vector<s
DBusMessage dbusMethodCall = createMethodCall("ListNames", "");
DBusError dbusError;
- DBusMessage dbusMessageReply = getDBusConnection()->sendDBusMessageWithReplyAndBlock(dbusMethodCall, dbusError);
+ DBusMessage dbusMessageReply
+ = getDBusConnection()->sendDBusMessageWithReplyAndBlock(dbusMethodCall, dbusError, &daemonProxyInfo);
if (dbusError || !dbusMessageReply.isMethodReturnType()) {
callStatus = CallStatus::REMOTE_ERROR;
@@ -112,11 +93,10 @@ void DBusDaemonProxy::listNames(CommonAPI::CallStatus& callStatus, std::vector<s
std::future<CallStatus> DBusDaemonProxy::listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const {
DBusMessage dbusMessage = createMethodCall("ListNames", "");
-
return getDBusConnection()->sendDBusMessageWithReplyAsync(
dbusMessage,
- DBusProxyAsyncCallbackHandler<std::vector<std::string>>::create(listNamesAsyncCallback),
- 2000);
+ DBusProxyAsyncCallbackHandler<std::vector<std::string>>::create(listNamesAsyncCallback, std::tuple<std::vector<std::string>>()),
+ &daemonProxyInfo);
}
void DBusDaemonProxy::nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const {
@@ -133,7 +113,8 @@ void DBusDaemonProxy::nameHasOwner(const std::string& busName, CommonAPI::CallSt
DBusError dbusError;
DBusMessage dbusMessageReply = getDBusConnection()->sendDBusMessageWithReplyAndBlock(
dbusMethodCall,
- dbusError);
+ dbusError,
+ &daemonProxyInfo);
if (dbusError || !dbusMessageReply.isMethodReturnType()) {
callStatus = CallStatus::REMOTE_ERROR;
return;
@@ -162,23 +143,20 @@ std::future<CallStatus> DBusDaemonProxy::nameHasOwnerAsync(const std::string& bu
return getDBusConnection()->sendDBusMessageWithReplyAsync(
dbusMessage,
- DBusProxyAsyncCallbackHandler<bool>::create(nameHasOwnerAsyncCallback),
- 2000);
+ DBusProxyAsyncCallbackHandler<bool>::create(nameHasOwnerAsyncCallback, std::tuple<bool>()),
+ &daemonProxyInfo);
}
std::future<CallStatus> DBusDaemonProxy::getManagedObjectsAsync(const std::string& forDBusServiceName, GetManagedObjectsAsyncCallback callback) const {
- // resolve remote objects
- auto dbusMethodCallMessage = DBusMessage::createMethodCall(
- forDBusServiceName,
- "/",
- "org.freedesktop.DBus.ObjectManager",
- "GetManagedObjects",
- "");
+ static DBusAddress address(forDBusServiceName, "/", "org.freedesktop.DBus.ObjectManager");
+ auto dbusMethodCallMessage = DBusMessage::createMethodCall(address, "GetManagedObjects", "");
return getDBusConnection()->sendDBusMessageWithReplyAsync(
dbusMethodCallMessage,
- DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(callback),
- 2000);
+ DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(
+ callback, std::tuple<DBusObjectToInterfaceDict>()
+ ),
+ &daemonProxyInfo);
}
std::future<CallStatus> DBusDaemonProxy::getNameOwnerAsync(const std::string& busName, GetNameOwnerAsyncCallback getNameOwnerAsyncCallback) const {
@@ -195,8 +173,8 @@ std::future<CallStatus> DBusDaemonProxy::getNameOwnerAsync(const std::string& bu
return getDBusConnection()->sendDBusMessageWithReplyAsync(
dbusMessage,
- DBusProxyAsyncCallbackHandler<std::string>::create(getNameOwnerAsyncCallback),
- 2000);
+ DBusProxyAsyncCallbackHandler<std::string>::create(getNameOwnerAsyncCallback, std::tuple<std::string>()),
+ &daemonProxyInfo);
}
const char* DBusDaemonProxy::getInterfaceId() {
diff --git a/src/CommonAPI/DBus/DBusDaemonProxy.h b/src/CommonAPI/DBus/DBusDaemonProxy.h
deleted file mode 100644
index 5db2932..0000000
--- a/src/CommonAPI/DBus/DBusDaemonProxy.h
+++ /dev/null
@@ -1,101 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_
-#define COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_
-
-#include "DBusProxyBase.h"
-#include "DBusEvent.h"
-
-#include <functional>
-#include <string>
-#include <vector>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-class StaticInterfaceVersionAttribute: public InterfaceVersionAttribute {
- public:
- StaticInterfaceVersionAttribute(const uint32_t& majorValue, const uint32_t& minorValue);
-
- void getValue(CallStatus& callStatus, Version& version) const;
- std::future<CallStatus> getValueAsync(AttributeAsyncCallback attributeAsyncCallback);
-
- private:
- Version version_;
-};
-
-
-class DBusDaemonProxy: public DBusProxyBase {
- public:
- 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::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;
-
- DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection);
-
- virtual bool isAvailable() const;
- virtual bool isAvailableBlocking() const;
- virtual ProxyStatusEvent& getProxyStatusEvent();
- virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- void init();
-
- static const char* getInterfaceId();
-
- NameOwnerChangedEvent& getNameOwnerChangedEvent();
-
- void listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const;
- std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const;
-
- void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const;
- std::future<CallStatus> nameHasOwnerAsync(const std::string& busName,
- NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const;
-
- std::future<CallStatus> getManagedObjectsAsync(const std::string& forDBusServiceName,
- GetManagedObjectsAsyncCallback) const;
-
- /**
- * Get the unique connection/bus name of the primary owner of the name given
- *
- * @param busName Name to get the owner of
- * @param getNameOwnerAsyncCallback callback functor
- *
- * @return CallStatus::REMOTE_ERROR if the name is unknown, otherwise CallStatus::SUCCESS and the uniq name of the owner
- */
- std::future<CallStatus> getNameOwnerAsync(const std::string& busName, GetNameOwnerAsyncCallback getNameOwnerAsyncCallback) const;
-
- virtual std::string getAddress() const;
- virtual const std::string& getDomain() const;
- virtual const std::string& getServiceId() const;
- virtual const std::string& getInstanceId() const;
-
- virtual const std::string& getDBusBusName() const;
- virtual const std::string& getDBusObjectPath() const;
- virtual const std::string& getInterfaceName() const;
-
- private:
- DBusEvent<NameOwnerChangedEvent> nameOwnerChangedEvent_;
- StaticInterfaceVersionAttribute interfaceVersionAttribute_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_
diff --git a/src/CommonAPI/DBus/DBusDeployment.cpp b/src/CommonAPI/DBus/DBusDeployment.cpp
new file mode 100644
index 0000000..973d5ff
--- /dev/null
+++ b/src/CommonAPI/DBus/DBusDeployment.cpp
@@ -0,0 +1,14 @@
+// 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 4b58a5e..9dfb082 100644
--- a/src/CommonAPI/DBus/DBusError.cpp
+++ b/src/CommonAPI/DBus/DBusError.cpp
@@ -1,18 +1,16 @@
-/* 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 "DBusError.h"
+// 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 <cassert>
#include <cstring>
+#include <CommonAPI/DBus/DBusError.hpp>
+
namespace CommonAPI {
namespace DBus {
-
DBusError::DBusError() {
dbus_error_init(&libdbusError_);
}
@@ -22,7 +20,7 @@ DBusError::~DBusError() {
}
DBusError::operator bool() const {
- return dbus_error_is_set(&libdbusError_);
+ return 0 != dbus_error_is_set(&libdbusError_);
}
void DBusError::clear() {
diff --git a/src/CommonAPI/DBus/DBusError.h b/src/CommonAPI/DBus/DBusError.h
deleted file mode 100644
index 8feaa99..0000000
--- a/src/CommonAPI/DBus/DBusError.h
+++ /dev/null
@@ -1,45 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_ERROR_H_
-#define COMMONAPI_DBUS_DBUS_ERROR_H_
-
-#include <string>
-#include <dbus/dbus.h>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusConnection;
-
-
-class DBusError {
- public:
- DBusError();
- ~DBusError();
-
- operator bool() const;
-
- void clear();
-
- std::string getName() const;
- std::string getMessage() const;
-
- private:
- ::DBusError libdbusError_;
-
- friend class DBusConnection;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_ERROR_H_
diff --git a/src/CommonAPI/DBus/DBusEvent.h b/src/CommonAPI/DBus/DBusEvent.h
deleted file mode 100644
index df21e24..0000000
--- a/src/CommonAPI/DBus/DBusEvent.h
+++ /dev/null
@@ -1,110 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_EVENT_H_
-#define COMMONAPI_DBUS_DBUS_EVENT_H_
-
-#include "DBusProxyConnection.h"
-#include "DBusMessage.h"
-#include "DBusSerializableArguments.h"
-#include "DBusHelper.h"
-
-#include <CommonAPI/Event.h>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusProxyBase;
-
-
-template <typename _EventType, typename _DBusProxy = DBusProxyBase>
-class DBusEvent: public _EventType, public DBusProxyConnection::DBusSignalHandler {
- public:
- typedef typename _EventType::ArgumentsTuple ArgumentsTuple;
- typedef typename _EventType::CancellableListener CancellableListener;
-
-
- DBusEvent(_DBusProxy& dbusProxy, const char* eventName, const char* eventSignature):
- dbusProxy_(dbusProxy),
- eventName_(eventName),
- eventSignature_(eventSignature) {
- interfaceName_ = dbusProxy.getInterfaceName().c_str();
- objectPath_ = dbusProxy_.getDBusObjectPath().c_str();
- assert(eventName_);
- assert(eventSignature_);
- assert(objectPath_);
- assert(interfaceName_);
- }
-
- DBusEvent(_DBusProxy& dbusProxy, const char* eventName, const char* eventSignature, const char* objPath, const char* interfaceName) :
- dbusProxy_(dbusProxy),
- eventName_(eventName),
- eventSignature_(eventSignature),
- objectPath_(objPath),
- interfaceName_(interfaceName) {
- assert(eventName);
- assert(eventSignature);
- assert(objPath);
- assert(interfaceName);
- }
-
- virtual ~DBusEvent() {
- if (this->hasListeners())
- dbusProxy_.removeSignalMemberHandler(subscription_, this);
- }
-
- virtual SubscriptionStatus onSignalDBusMessage(const DBusMessage& dbusMessage) {
- return unpackArgumentsAndHandleSignalDBusMessage(dbusMessage, ArgumentsTuple());
- }
- protected:
- virtual void onFirstListenerAdded(const CancellableListener&) {
- subscription_ = dbusProxy_.addSignalMemberHandler(objectPath_,
- interfaceName_,
- eventName_,
- eventSignature_,
- this);
- }
-
- virtual void onLastListenerRemoved(const CancellableListener&) {
- dbusProxy_.removeSignalMemberHandler(subscription_, this);
- }
-
- template<typename ... _Arguments>
- inline SubscriptionStatus unpackArgumentsAndHandleSignalDBusMessage(const DBusMessage& dbusMessage,
- std::tuple<_Arguments...> argTuple) {
- return handleSignalDBusMessage(dbusMessage, std::move(argTuple), typename make_sequence<sizeof...(_Arguments)>::type());
- }
-
- template<typename ... _Arguments, int ... _ArgIndices>
- inline SubscriptionStatus handleSignalDBusMessage(const DBusMessage& dbusMessage,
- std::tuple<_Arguments...> argTuple,
- index_sequence<_ArgIndices...>) {
- DBusInputStream dbusInputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_Arguments...>::deserialize(
- dbusInputStream,
- std::get<_ArgIndices>(argTuple)...);
- // Continue subscription if deserialization failed
- return success ? this->notifyListeners(std::get<_ArgIndices>(argTuple)...) : SubscriptionStatus::RETAIN;
- }
-
- _DBusProxy& dbusProxy_;
- const char* eventName_;
- const char* eventSignature_;
- const char* objectPath_;
- const char* interfaceName_;
- DBusProxyConnection::DBusSignalHandlerToken subscription_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_EVENT_H_
-
diff --git a/src/CommonAPI/DBus/DBusFactory.cpp b/src/CommonAPI/DBus/DBusFactory.cpp
index c0b2cdd..4f7e0b9 100644
--- a/src/CommonAPI/DBus/DBusFactory.cpp
+++ b/src/CommonAPI/DBus/DBusFactory.cpp
@@ -1,217 +1,346 @@
-/* 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 "DBusProxy.h"
-#include "DBusConnection.h"
-#include "DBusFactory.h"
-#include "DBusServiceRegistry.h"
-#include "DBusUtils.h"
-#include "DBusServicePublisher.h"
-
-#include <algorithm>
-#include <cassert>
+// 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 <iostream>
#include <sstream>
-#include <unordered_map>
-#include <vector>
+
+#include <CommonAPI/Logger.hpp>
+#include <CommonAPI/Runtime.hpp>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
namespace CommonAPI {
namespace DBus {
-
-std::unordered_map<std::string, DBusProxyFactoryFunction>* registeredProxyFactoryFunctions_;
-std::unordered_map<std::string, DBusAdapterFactoryFunction>* registeredAdapterFactoryFunctions_;
-
-
-void DBusFactory::registerProxyFactoryMethod(std::string interfaceName, DBusProxyFactoryFunction proxyFactoryMethod) {
- if(!registeredProxyFactoryFunctions_) {
- registeredProxyFactoryFunctions_ = new std::unordered_map<std::string, DBusProxyFactoryFunction>();
- }
- registeredProxyFactoryFunctions_->insert({interfaceName, proxyFactoryMethod});
+INITIALIZER(FactoryInit) {
+ Runtime::get()->registerFactory("dbus", Factory::get());
}
-void DBusFactory::registerAdapterFactoryMethod(std::string interfaceName, DBusAdapterFactoryFunction adapterFactoryMethod) {
- if(!registeredAdapterFactoryFunctions_) {
- registeredAdapterFactoryFunctions_ = new std::unordered_map<std::string, DBusAdapterFactoryFunction>();
- }
- registeredAdapterFactoryFunctions_->insert({interfaceName, adapterFactoryMethod});
+std::shared_ptr<CommonAPI::DBus::Factory>
+Factory::get() {
+ static std::shared_ptr<Factory> theFactory = std::make_shared<Factory>();
+ return theFactory;
}
-
-DBusFactory::DBusFactory(std::shared_ptr<Runtime> runtime,
- const MiddlewareInfo* middlewareInfo,
- std::shared_ptr<MainLoopContext> mainLoopContext,
- const DBusFactoryConfig& DBusFactoryConfig) :
- CommonAPI::Factory(runtime, middlewareInfo),
- mainLoopContext_(mainLoopContext),
- DBusFactoryConfig_(DBusFactoryConfig){
-
- dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(DBusFactoryConfig_.busType_);
- bool startDispatchThread = !mainLoopContext_;
- dbusConnection_->connect(startDispatchThread);
- if (mainLoopContext_) {
- dbusConnection_->attachMainLoopContext(mainLoopContext_);
- }
+Factory::Factory()
+ : defaultBusType_(DBusType_t::SESSION) {
}
-
-DBusFactory::~DBusFactory() {
+Factory::~Factory() {
}
-
-std::vector<std::string> DBusFactory::getAvailableServiceInstances(const std::string& serviceName,
- const std::string& domainName) {
- return dbusConnection_->getDBusServiceRegistry()->getAvailableServiceInstances(serviceName, domainName);
+void
+Factory::registerProxyCreateMethod(
+ const std::string &_interface, ProxyCreateFunction _function) {
+ proxyCreateFunctions_[_interface] = _function;
}
-
-void DBusFactory::getAvailableServiceInstancesAsync(Factory::GetAvailableServiceInstancesCallback callback, const std::string& serviceName, const std::string& serviceDomainName) {
- dbusConnection_->getDBusServiceRegistry()->getAvailableServiceInstancesAsync(callback, serviceName, serviceDomainName);
+void
+Factory::registerStubAdapterCreateMethod(
+ const std::string &_interface, StubAdapterCreateFunction _function) {
+ stubAdapterCreateFunctions_[_interface] = _function;
}
-
-bool DBusFactory::isServiceInstanceAlive(const std::string& serviceAddress) {
- std::vector<std::string> parts = split(serviceAddress, ':');
- assert(parts[0] == "local");
-
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
- DBusAddressTranslator::getInstance().searchForDBusAddress(serviceAddress, interfaceName, connectionName, objectPath);
-
- return dbusConnection_->getDBusServiceRegistry()->isServiceInstanceAlive(interfaceName, connectionName, objectPath);
+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;
}
-
-bool DBusFactory::isServiceInstanceAlive(const std::string& participantId,
- const std::string& serviceName,
- const std::string& domainName) {
- std::string serviceAddress = domainName + ":" + serviceName + ":" + participantId;
- return isServiceInstanceAlive(serviceAddress);
+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;
}
-
-SubscriptionStatus DBusFactory::isServiceInstanceAliveCallbackThunk(Factory::IsServiceInstanceAliveCallback callback, const AvailabilityStatus& status, std::shared_ptr<DBusServiceRegistry> serviceRegistry) {
- callback(status == AvailabilityStatus::AVAILABLE);
- return SubscriptionStatus::CANCEL;
+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;
}
-void DBusFactory::isServiceInstanceAliveAsync(Factory::IsServiceInstanceAliveCallback callback, const std::string& serviceAddress) {
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
-
- DBusAddressTranslator::getInstance().searchForDBusAddress(serviceAddress, interfaceName, connectionName, objectPath);
-
- std::shared_ptr<DBusServiceRegistry> serviceRegistry = dbusConnection_->getDBusServiceRegistry();
-
- serviceRegistry->subscribeAvailabilityListener(
- serviceAddress,
- std::bind(&DBusFactory::isServiceInstanceAliveCallbackThunk,
- this,
- callback,
- std::placeholders::_1,
- serviceRegistry)
- );
+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;
}
-std::shared_ptr<CommonAPI::DBus::DBusConnection> DBusFactory::getDbusConnection() {
- return dbusConnection_;
+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;
}
-void DBusFactory::isServiceInstanceAliveAsync(Factory::IsServiceInstanceAliveCallback callback,
- const std::string& serviceInstanceID,
- const std::string& serviceName,
- const std::string& serviceDomainName) {
- std::string commonApiAddress = serviceDomainName + ":" + serviceName + ":" + serviceInstanceID;
- isServiceInstanceAliveAsync(callback, commonApiAddress);
+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;
}
+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;
+}
-std::shared_ptr<Proxy> DBusFactory::createProxy(const char* interfaceId,
- const std::string& participantId,
- const std::string& serviceName,
- const std::string& domain) {
- std::string commonApiAddress = domain + ":" + serviceName + ":" + participantId;
-
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
-
- DBusAddressTranslator::getInstance().searchForDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);
+///////////////////////////////////////////////////////////////////////////////
+// Connections
+///////////////////////////////////////////////////////////////////////////////
+std::shared_ptr<DBusConnection>
+Factory::getConnection(const ConnectionId_t &_connectionId) {
- if(!registeredProxyFactoryFunctions_) {
- registeredProxyFactoryFunctions_ = new std::unordered_map<std::string, DBusProxyFactoryFunction> {};
- }
+ auto itsConnectionIterator = connections_.find(_connectionId);
+ if (itsConnectionIterator != connections_.end()) {
+ return itsConnectionIterator->second;
+ }
- for (auto it = registeredProxyFactoryFunctions_->begin(); it != registeredProxyFactoryFunctions_->end(); ++it) {
- if(it->first == interfaceId) {
- std::shared_ptr<DBusProxy> proxy = (it->second)(shared_from_this(), commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection_);
- proxy->init();
- return proxy;
- }
- }
+ // No connection found, lets create and initialize one
+ std::shared_ptr<DBusConnection> itsConnection
+ = std::make_shared<DBusConnection>(defaultBusType_);
+ connections_.insert({ _connectionId, itsConnection });
- return NULL;
+ itsConnection->connect(true);
+ return itsConnection;
}
-std::shared_ptr<DBusStubAdapter> DBusFactory::createDBusStubAdapter(const std::shared_ptr<StubBase>& stubBase,
- const char* interfaceId,
- const std::string& participantId,
- const std::string& serviceName,
- const std::string& domain) {
- assert(dbusConnection_->isConnected());
-
- std::string commonApiAddress = domain + ":" + serviceName + ":" + participantId;
+std::shared_ptr<DBusConnection>
+Factory::getConnection(std::shared_ptr<MainLoopContext> _context) {
+ if (!_context)
+ return getConnection(DEFAULT_CONNECTION_ID);
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
+ auto itsConnectionIterator = contextConnections_.find(_context.get());
+ if (itsConnectionIterator != contextConnections_.end()) {
+ return itsConnectionIterator->second;
+ }
- DBusAddressTranslator::getInstance().searchForDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);
+ // No connection found, lets create and initialize one
+ std::shared_ptr<DBusConnection> itsConnection
+ = std::make_shared<DBusConnection>(defaultBusType_);
+ contextConnections_.insert({ _context.get(), itsConnection } );
- if (!registeredAdapterFactoryFunctions_) {
- registeredAdapterFactoryFunctions_ = new std::unordered_map<std::string, DBusAdapterFactoryFunction> {};
- }
-
- auto registeredAdapterFactoryFunctionsIter = registeredAdapterFactoryFunctions_->find(interfaceId);
- const bool hasRegisteredAdapterFactoryFunctions = (registeredAdapterFactoryFunctionsIter != registeredAdapterFactoryFunctions_->end());
- std::shared_ptr<DBusStubAdapter> dbusStubAdapter;
+ itsConnection->connect(false);
+ if (_context)
+ itsConnection->attachMainLoopContext(_context);
- if (hasRegisteredAdapterFactoryFunctions) {
- const auto& dbusAdapterFactoryFunction = registeredAdapterFactoryFunctionsIter->second;
+ return itsConnection;
+}
- dbusStubAdapter = dbusAdapterFactoryFunction(shared_from_this(), commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection_, stubBase);
- dbusStubAdapter->init(dbusStubAdapter);
+///////////////////////////////////////////////////////////////////////////////
+// Service registration
+///////////////////////////////////////////////////////////////////////////////
+std::shared_ptr<DBusStubAdapter>
+Factory::getRegisteredService(const std::string &_address) {
+ auto serviceIterator = services_.find(_address);
+ if (serviceIterator != services_.end()) {
+ return serviceIterator->second;
}
+ return nullptr;
+}
- return dbusStubAdapter;
+///////////////////////////////////////////////////////////////////////////////
+// Managed Services
+///////////////////////////////////////////////////////////////////////////////
+std::shared_ptr<DBusStubAdapter>
+Factory::createDBusStubAdapter(
+ const std::shared_ptr<StubBase> &_stub,
+ const std::string &_interface,
+ 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);
+ if (stubAdapter)
+ stubAdapter->init(stubAdapter);
+ }
+ return stubAdapter;
}
-bool DBusFactory::unregisterService(const std::string& participantId, const std::string& serviceName, const std::string& domain) {
- std::string serviceAddress(domain + ":" + serviceName + ":" + participantId);
- return DBusServicePublisher::getInstance()->unregisterService(serviceAddress);
+bool
+Factory::registerManagedService(const std::shared_ptr<DBusStubAdapter> &_stubAdapter) {
+ auto itsAddress = _stubAdapter->getAddress().getAddress();
+
+ 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;
+ }
+
+ return false;
}
-COMMONAPI_DEPRECATED bool DBusFactory::registerAdapter(std::shared_ptr<StubBase> stubBase,
- const char* interfaceId,
- const std::string& participantId,
- const std::string& serviceName,
- const std::string& domain) {
- std::shared_ptr<DBusServicePublisher> pub = std::dynamic_pointer_cast<DBusServicePublisher>(runtime_->getServicePublisher());
- return pub->registerService(
- stubBase,
- interfaceId,
- participantId,
- serviceName,
- domain,
- shared_from_this());
+bool
+Factory::unregisterManagedService(const std::string &_address) {
+ return unregisterManagedService(services_.find(_address));
}
+bool
+Factory::unregisterManagedService(const ServicesMap::iterator &iterator) {
+ if (iterator == services_.end())
+ return true;
+
+ 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);
+ if (isUnregistered) {
+ connection->releaseServiceName(serviceName);
+ services_.erase(iterator);
+ }
+ // TODO: log error
+ return isUnregistered;
+}
} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusFactory.h b/src/CommonAPI/DBus/DBusFactory.h
deleted file mode 100644
index 8b290fe..0000000
--- a/src/CommonAPI/DBus/DBusFactory.h
+++ /dev/null
@@ -1,93 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_FACTORY_H_
-#define COMMONAPI_DBUS_DBUS_FACTORY_H_
-
-#include <thread>
-
-#include <CommonAPI/Factory.h>
-
-#include "DBusStubAdapter.h"
-#include "DBusConnection.h"
-#include "DBusProxy.h"
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusMainLoopContext;
-class DBusFactory;
-
-typedef std::shared_ptr<DBusProxy> (*DBusProxyFactoryFunction)(const std::shared_ptr<DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<DBusProxyConnection>& dbusProxyConnection);
-
-typedef std::shared_ptr<DBusStubAdapter> (*DBusAdapterFactoryFunction) (const std::shared_ptr<DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<StubBase>& stubBase);
-
-class DBusFactory: public Factory, public std::enable_shared_from_this<DBusFactory> {
- public:
- DBusFactory(std::shared_ptr<Runtime> runtime, const MiddlewareInfo* middlewareInfo, std::shared_ptr<MainLoopContext> mainLoopContext, const DBusFactoryConfig& dbusFactoryConfig = DBusFactoryConfig());
-
-
- virtual ~DBusFactory();
-
- static void registerProxyFactoryMethod(std::string interfaceName, DBusProxyFactoryFunction proxyFactoryFunction);
- static void registerAdapterFactoryMethod(std::string interfaceName, DBusAdapterFactoryFunction adapterFactoryMethod);
-
- virtual std::vector<std::string> getAvailableServiceInstances(const std::string& serviceInterfaceName, const std::string& serviceDomainName = "local");
- virtual bool isServiceInstanceAlive(const std::string& serviceAddress);
- virtual bool isServiceInstanceAlive(const std::string& participantId, const std::string& serviceName, const std::string& domain = "local");
-
- virtual void getAvailableServiceInstancesAsync(GetAvailableServiceInstancesCallback callback, const std::string& serviceName, const std::string& serviceDomainName = "local");
- virtual void isServiceInstanceAliveAsync(IsServiceInstanceAliveCallback callback, const std::string& serviceAddress);
- virtual void isServiceInstanceAliveAsync(IsServiceInstanceAliveCallback callback, const std::string& serviceInstanceID, const std::string& serviceName, const std::string& serviceDomainName = "local");
-
- virtual bool unregisterService(const std::string& participantId, const std::string& serviceName, const std::string& domain = "local");
-
- std::shared_ptr<DBusStubAdapter> createDBusStubAdapter(const std::shared_ptr<StubBase>& stubBase,
- const char* interfaceId,
- const std::string& participantId,
- const std::string& serviceName,
- const std::string& domain);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> getDbusConnection();
-
- virtual std::shared_ptr<Proxy> createProxy(const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain);
-
- protected:
-
- COMMONAPI_DEPRECATED virtual bool registerAdapter(std::shared_ptr<StubBase> stubBase,
- const char* interfaceId,
- const std::string& participantId,
- const std::string& serviceName,
- const std::string& domain);
-
- private:
- SubscriptionStatus isServiceInstanceAliveCallbackThunk(Factory::IsServiceInstanceAliveCallback callback, const AvailabilityStatus& status, std::shared_ptr<DBusServiceRegistry> serviceRegistry);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> dbusConnection_;
- std::shared_ptr<MainLoopContext> mainLoopContext_;
- DBusFactoryConfig DBusFactoryConfig_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_FACTORY_H_
diff --git a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp b/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
index 9823af5..7d9ce62 100644
--- a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
+++ b/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
@@ -1,109 +1,105 @@
-/* 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 "DBusFreedesktopPropertiesStub.h"
-#include "DBusStubAdapter.h"
-#include "DBusServicePublisher.h"
-#include "DBusOutputStream.h"
-#include "DBusInputStream.h"
+// 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 <cassert>
#include <vector>
+#include <CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+
namespace CommonAPI {
namespace DBus {
-DBusFreedesktopPropertiesStub::DBusFreedesktopPropertiesStub(const std::string& dbusObjectPath,
- const std::string& dbusInterfaceName,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<DBusStubAdapter>& dbusStubAdapter) :
- dbusObjectPath_(dbusObjectPath),
- dbusConnection_(dbusConnection),
- dbusStubAdapter_(dbusStubAdapter) {
- assert(!dbusObjectPath.empty());
- assert(dbusObjectPath[0] == '/');
- assert(dbusConnection);
+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) {
+ assert(!path_.empty());
+ assert(path_[0] == '/');
+ assert(_connection);
dbusInterfacesLock_.lock();
- if(managedInterfaces_.find(dbusInterfaceName) == managedInterfaces_.end()) {
- managedInterfaces_.insert({dbusInterfaceName, dbusStubAdapter});
+ if(managedInterfaces_.find(_interface) == managedInterfaces_.end()) {
+ managedInterfaces_.insert({ _interface, _adapter });
}
dbusInterfacesLock_.unlock();
-
}
DBusFreedesktopPropertiesStub::~DBusFreedesktopPropertiesStub() {
- // TODO: maybee some deregistration etc.
+ // TODO: Check if there is some deregistration etc. necessary
}
const char* DBusFreedesktopPropertiesStub::getMethodsDBusIntrospectionXmlData() const {
- return "<interface name=\"org.freedesktop.DBus.Properties\">\n"
- "<method name=\"Get\">\n"
- "<arg type=\"s\" name=\"interface_name\" direction=\"in\"/>\n"
- "<arg type=\"s\" name=\"property_name\" direction=\"in\"/>\n"
- "<arg type=\"v\" name=\"value\" direction=\"out\"/>\n"
- "</method>\n"
- "<method name=\"GetAll\">\n"
- "<arg type=\"s\" name=\"interface_name\" direction=\"in\"/>\n"
- "<arg type=\"a{sv}\" name=\"properties\" direction=\"out\"/>\n"
- "</method>\n"
- "<method name=\"Set\">\n"
- "<arg type=\"s\" name=\"interface_name\" direction=\"in\"/>\n"
- "<arg type=\"s\" name=\"property_name\" direction=\"in\"/>\n"
- "<arg type=\"v\" name=\"value\" direction=\"in\"/>\n"
- "</method>\n"
- "<signal name=\"PropertiesChanged\">\n"
- "<arg type=\"s\" name=\"interface_name\"/>\n"
- "<arg type=\"a{sv}\" name=\"changed_properties\"/>\n"
- "<arg type=\"as\" name=\"invalidated_properties\"/>\n"
- "</signal>\n"
- "</interface>\n";
+ return "<method name=\"Get\">\n"
+ "<arg type=\"s\" name=\"interface_name\" direction=\"in\"/>\n"
+ "<arg type=\"s\" name=\"property_name\" direction=\"in\"/>\n"
+ "<arg type=\"v\" name=\"value\" direction=\"out\"/>\n"
+ "</method>\n"
+ "<method name=\"GetAll\">\n"
+ "<arg type=\"s\" name=\"interface_name\" direction=\"in\"/>\n"
+ "<arg type=\"a{sv}\" name=\"properties\" direction=\"out\"/>\n"
+ "</method>\n"
+ "<method name=\"Set\">\n"
+ "<arg type=\"s\" name=\"interface_name\" direction=\"in\"/>\n"
+ "<arg type=\"s\" name=\"property_name\" direction=\"in\"/>\n"
+ "<arg type=\"v\" name=\"value\" direction=\"in\"/>\n"
+ "</method>\n"
+ "<signal name=\"PropertiesChanged\">\n"
+ "<arg type=\"s\" name=\"interface_name\"/>\n"
+ "<arg type=\"a{sv}\" name=\"changed_properties\"/>\n"
+ "<arg type=\"as\" name=\"invalidated_properties\"/>\n"
+ "</signal>\n";
}
-bool DBusFreedesktopPropertiesStub::onInterfaceDBusMessage(const DBusMessage& dbusMessage) {
- auto dbusConnection = dbusConnection_.lock();
-
- if (!dbusConnection || !dbusConnection->isConnected()) {
+bool
+DBusFreedesktopPropertiesStub::onInterfaceDBusMessage(const DBusMessage &_message) {
+ auto connection = connection_.lock();
+ if (!connection || !connection->isConnected()) {
return false;
}
- if (!dbusMessage.isMethodCallType() || !(dbusMessage.hasMemberName("Get") || dbusMessage.hasMemberName("GetAll") || dbusMessage.hasMemberName("Set"))) {
+ if (!_message.isMethodCallType() ||
+ !(_message.hasMemberName("Get") ||
+ _message.hasMemberName("GetAll") ||
+ _message.hasMemberName("Set"))) {
return false;
}
- DBusInputStream dbusInputStream(dbusMessage);
- std::string interfaceName;
-
- dbusInputStream >> interfaceName;
-
- if(dbusInputStream.hasError()) {
+ std::string interface;
+ DBusInputStream input(_message);
+ input >> interface;
+ if(input.hasError()) {
return false;
}
- std::lock_guard<std::mutex> dbusInterfacesLock(dbusInterfacesLock_);
-
- auto managedInterfacesIterator = managedInterfaces_.find(interfaceName);
+ std::lock_guard<std::mutex> itsLock(dbusInterfacesLock_);
- if(managedInterfacesIterator == managedInterfaces_.end()) {
+ auto it = managedInterfaces_.find(interface);
+ if(it == managedInterfaces_.end()) {
return false;
}
- return managedInterfacesIterator->second->onInterfaceDBusFreedesktopPropertiesMessage(dbusMessage);
+ return it->second->onInterfaceDBusFreedesktopPropertiesMessage(_message);
}
const bool DBusFreedesktopPropertiesStub::hasFreedesktopProperties() {
return false;
}
-const std::string& DBusFreedesktopPropertiesStub::getDBusObjectPath() const {
- return dbusObjectPath_;
+const std::string &DBusFreedesktopPropertiesStub::getObjectPath() const {
+ return path_;
}
-const char* DBusFreedesktopPropertiesStub::getInterfaceName() {
- return "org.freedesktop.DBus.Properties";
+const std::string &DBusFreedesktopPropertiesStub::getInterface() {
+ static std::string theInterface("org.freedesktop.DBus.Properties");
+ return theInterface;
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.h b/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.h
deleted file mode 100644
index c6b38a0..0000000
--- a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.h
+++ /dev/null
@@ -1,60 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_FREEDESKTOP_PROPERTIES_STUB_H_
-#define COMMONAPI_DBUS_DBUS_FREEDESKTOP_PROPERTIES_STUB_H_
-
-#include "DBusInterfaceHandler.h"
-
-#include <memory>
-#include <mutex>
-#include <string>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusStubAdapter;
-
-/**
- * Stub for standard <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">org.freedesktop.dbus.Properties</a> interface.
- *
- * DBusFreedesktopPropertiesStub gets the DBusStubAdapter for handling the actual properties with instantiation.
- */
-class DBusFreedesktopPropertiesStub: public DBusInterfaceHandler {
-public:
- DBusFreedesktopPropertiesStub(const std::string& dbusObjectPath,
- const std::string& dbusInterfaceName,
- const std::shared_ptr<DBusProxyConnection>&,
- const std::shared_ptr<DBusStubAdapter>& dbusStubAdapter);
-
- virtual ~DBusFreedesktopPropertiesStub();
-
- const std::string& getDBusObjectPath() const;
- static const char* getInterfaceName();
-
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
- virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage);
- virtual const bool hasFreedesktopProperties();
-private:
- std::string dbusObjectPath_;
- std::weak_ptr<DBusProxyConnection> dbusConnection_;
- std::shared_ptr<DBusStubAdapter> dbusStubAdapter_;
-
- typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> DBusInterfacesMap;
- DBusInterfacesMap managedInterfaces_;
-
- std::mutex dbusInterfacesLock_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_FREEDESKTOP_PROPERTIES_STUB_H_
diff --git a/src/CommonAPI/DBus/DBusFunctionalHash.cpp b/src/CommonAPI/DBus/DBusFunctionalHash.cpp
index a3a334a..7eeb67f 100644
--- a/src/CommonAPI/DBus/DBusFunctionalHash.cpp
+++ b/src/CommonAPI/DBus/DBusFunctionalHash.cpp
@@ -1,16 +1,15 @@
-/* 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 "DBusFunctionalHash.h"
-
-#include <murmurhash/MurmurHash3.h>
+// 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 <cassert>
#include <cstring>
+#include <murmurhash/MurmurHash3.h>
+
+#include <CommonAPI/DBus/DBusFunctionalHash.hpp>
+
/*
* @see http://code.google.com/p/smhasher/
*/
diff --git a/src/CommonAPI/DBus/DBusFunctionalHash.h b/src/CommonAPI/DBus/DBusFunctionalHash.h
deleted file mode 100644
index 7ffec89..0000000
--- a/src/CommonAPI/DBus/DBusFunctionalHash.h
+++ /dev/null
@@ -1,80 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_FUNCTIONAL_HASH_H_
-#define COMMONAPI_DBUS_DBUS_FUNCTIONAL_HASH_H_
-
-#include <functional>
-#include <string>
-#include <tuple>
-
-namespace std {
-
-template<>
-struct hash<pair<const char*, const char*> > :
- public unary_function<pair<const char*, const char*>, size_t> {
-
- size_t operator()(const pair<const char*, const char*>& t) const;
-};
-
-template<>
-struct hash<const char*> :
- public unary_function<const char*, size_t> {
-
- size_t operator()(const char* const t) const;
-};
-
-template<>
-struct hash<pair<string, string> > :
- public unary_function<pair<string, string>, size_t> {
-
- size_t operator()(const pair<string, string>& t) const;
-};
-
-template<>
-struct hash<tuple<string, string, string> > :
- public unary_function<tuple<string, string, string>, size_t> {
-
- size_t operator()(const tuple<string, string, string>& t) const;
-};
-
-template<>
-struct hash<tuple<string, string, string, bool> > :
- public unary_function<tuple<string, string, string, bool>, size_t> {
-
- size_t operator()(const tuple<string, string, string, bool>& t) const;
-};
-
-template<>
-struct hash<tuple<string, string, string, int> > :
- public unary_function<tuple<string, string, string, int>, size_t> {
-
- size_t operator()(const tuple<string, string, string, int>& t) const;
-};
-
-template<>
-struct hash<tuple<string, string, string, string> > :
- public std::unary_function<tuple<string, string, string, string>, size_t> {
-
- size_t operator()(const tuple<string, string, string, string>& t) const;
-};
-
-template<>
-struct equal_to<pair<const char*, const char*> > : public binary_function<pair<const char*, const char*>,
- pair<const char*, const char*>,
- bool> {
-
- bool operator()(const pair<const char*, const char*>& a, const pair<const char*, const char*>& b) const;
-};
-
-} // namespace std
-
-#endif // COMMONAPI_DBUS_DBUS_FUNCTIONAL_HASH_H_
diff --git a/src/CommonAPI/DBus/DBusHelper.h b/src/CommonAPI/DBus/DBusHelper.h
deleted file mode 100644
index bcf80d1..0000000
--- a/src/CommonAPI/DBus/DBusHelper.h
+++ /dev/null
@@ -1,42 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_HELPER_H_
-#define COMMONAPI_DBUS_DBUS_HELPER_H_
-
-namespace CommonAPI {
-namespace DBus {
-
-template <int ...>
-struct index_sequence {};
-
-
-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 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;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_HELPER_H_
diff --git a/src/CommonAPI/DBus/DBusInputStream.cpp b/src/CommonAPI/DBus/DBusInputStream.cpp
index c1ef4a3..07964d8 100644
--- a/src/CommonAPI/DBus/DBusInputStream.cpp
+++ b/src/CommonAPI/DBus/DBusInputStream.cpp
@@ -1,354 +1,141 @@
-/* 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 "DBusInputStream.h"
+// 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 <iomanip>
+
+#include <CommonAPI/DBus/DBusInputStream.hpp>
namespace CommonAPI {
namespace DBus {
-DBusInputStream::DBusInputStream(const CommonAPI::DBus::DBusMessage& message) :
- dataBegin_(message.getBodyData()),
- currentDataPosition_(0),
- dataLength_(message.getBodyLength()),
- exception_(nullptr),
- message_(message) {
+DBusInputStream::DBusInputStream(const CommonAPI::DBus::DBusMessage &_message)
+ : begin_(_message.getBodyData()),
+ current_(0),
+ size_(_message.getBodyLength()),
+ exception_(nullptr),
+ message_(_message) {
}
DBusInputStream::~DBusInputStream() {}
const CommonAPI::DBus::DBusError& DBusInputStream::getError() const {
- return *exception_;
+ return (*exception_);
}
bool DBusInputStream::isErrorSet() const {
- return exception_ != nullptr;
+ return (exception_ != nullptr);
}
void DBusInputStream::clearError() {
exception_ = nullptr;
}
-void DBusInputStream::alignToBoundary(const size_t alignBoundary) {
- const unsigned int alignMask = alignBoundary - 1;
- currentDataPosition_ = (currentDataPosition_ + alignMask) & (~alignMask);
-}
-
-char* DBusInputStream::readRawData(const size_t numBytesToRead) {
- assert((currentDataPosition_ + numBytesToRead) <= dataLength_);
-
- char* dataPtr = (char*) (dataBegin_ + currentDataPosition_);
- currentDataPosition_ += numBytesToRead;
- return dataPtr;
-}
-
-template<>
-DBusInputStream& DBusInputStream::readBasicTypeValue<float>(float& val) {
- if (sizeof(val) > 1)
- alignToBoundary(sizeof(double));
-
- val = (float) (*(reinterpret_cast<double*>(readRawData(sizeof(double)))));
- return *this;
-}
-
-InputStream& DBusInputStream::readValue(bool& boolValue) {
- alignToBoundary(4);
- readBasicTypeValue(boolValue);
- alignToBoundary(4);
- return *this;
-}
-
-InputStream& DBusInputStream::readValue(int8_t& int8Value) {
- return readBasicTypeValue(int8Value);
-}
-InputStream& DBusInputStream::readValue(int16_t& int16Value) {
- return readBasicTypeValue(int16Value);
-}
-InputStream& DBusInputStream::readValue(int32_t& int32Value) {
- return readBasicTypeValue(int32Value);
-}
-InputStream& DBusInputStream::readValue(int64_t& int64Value) {
- return readBasicTypeValue(int64Value);
-}
-
-InputStream& DBusInputStream::readValue(uint8_t& uint8Value) {
- return readBasicTypeValue(uint8Value);
-}
-InputStream& DBusInputStream::readValue(uint16_t& uint16Value) {
- return readBasicTypeValue(uint16Value);
-}
-InputStream& DBusInputStream::readValue(uint32_t& uint32Value) {
- return readBasicTypeValue(uint32Value);
-}
-InputStream& DBusInputStream::readValue(uint64_t& uint64Value) {
- return readBasicTypeValue(uint64Value);
+void DBusInputStream::align(const size_t _boundary) {
+ const unsigned int mask = _boundary - 1;
+ current_ = (current_ + mask) & (~mask);
}
-InputStream& DBusInputStream::readValue(float& floatValue) {
- return readBasicTypeValue(floatValue);
-}
-InputStream& DBusInputStream::readValue(double& doubleValue) {
- return readBasicTypeValue(doubleValue);
-}
-
-InputStream& DBusInputStream::readValue(std::string& stringValue) {
- uint32_t lengthOfString;
- readValue(lengthOfString);
-
- // length field does not include terminating 0-byte, therefore length of data to read is +1
- char* dataPtr = readRawData(lengthOfString + 1);
-
- // The string contained in a DBus-message is required to be 0-terminated, therefore the following line works
- stringValue = dataPtr;
-
- return *this;
-}
-
-InputStream& DBusInputStream::readValue(ByteBuffer& byteBufferValue) {
- *this >> byteBufferValue;
- return *this;
-}
-
-InputStream& DBusInputStream::readEnumValue(int8_t& int8BackingTypeValue) {
- return readValue(int8BackingTypeValue);
-}
-InputStream& DBusInputStream::readEnumValue(int16_t& int16BackingTypeValue) {
- return readValue(int16BackingTypeValue);
-}
-InputStream& DBusInputStream::readEnumValue(int32_t& int32BackingTypeValue) {
- return readValue(int32BackingTypeValue);
-}
-InputStream& DBusInputStream::readEnumValue(int64_t& int64BackingTypeValue) {
- return readValue(int64BackingTypeValue);
-}
-InputStream& DBusInputStream::readEnumValue(uint8_t& uint8BackingTypeValue) {
- return readValue(uint8BackingTypeValue);
-}
-InputStream& DBusInputStream::readEnumValue(uint16_t& uint16BackingTypeValue) {
- return readValue(uint16BackingTypeValue);
-}
-InputStream& DBusInputStream::readEnumValue(uint32_t& uint32BackingTypeValue) {
- return readValue(uint32BackingTypeValue);
-}
-InputStream& DBusInputStream::readEnumValue(uint64_t& uint64BackingTypeValue) {
- return readValue(uint64BackingTypeValue);
-}
-
-InputStream& DBusInputStream::readVersionValue(Version& versionValue) {
- alignToBoundary(8);
- readValue(versionValue.Major);
- readValue(versionValue.Minor);
- return *this;
-}
+char *DBusInputStream::_readRaw(const size_t _size) {
+ assert(current_ + _size <= size_);
-void DBusInputStream::beginReadSerializableStruct(const SerializableStruct& serializableStruct) {
- alignToBoundary(8);
+ char *data = (char *) (begin_ + current_);
+ current_ += _size;
+ return data;
}
-void DBusInputStream::endReadSerializableStruct(const SerializableStruct& serializableStruct) {
-}
-
-void DBusInputStream::beginReadSerializablePolymorphicStruct(uint32_t& serialId) {
- alignToBoundary(8);
- readValue(serialId);
- skipOverSignature();
- alignToBoundary(8);
-}
-
-void DBusInputStream::endReadSerializablePolymorphicStruct(const uint32_t& serialId) {
-}
-
-void DBusInputStream::readSerializableVariant(SerializableVariant& serializableVariant) {
- alignToBoundary(8);
- uint8_t containedTypeIndex;
- readValue(containedTypeIndex);
- skipOverSignature();
-
- serializableVariant.readFromInputStream(containedTypeIndex, *this);
-}
-
-void DBusInputStream::beginReadBoolVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadInt8Vector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadInt16Vector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadInt32Vector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadInt64Vector() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadUInt8Vector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadUInt16Vector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadUInt32Vector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadUInt64Vector() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadFloatVector() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadDoubleVector() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadStringVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadByteBufferVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
-}
-
-void DBusInputStream::beginReadVersionVector() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
+void DBusInputStream::setError() {
+ exception_ = new CommonAPI::DBus::DBusError();
}
-void DBusInputStream::beginReadInt8EnumVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
+void DBusInputStream::pushPosition() {
+ positions_.push(current_);
}
-void DBusInputStream::beginReadInt16EnumVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
+size_t DBusInputStream::popPosition() {
+ size_t itsPosition = positions_.top();
+ positions_.pop();
+ return itsPosition;
}
-void DBusInputStream::beginReadInt32EnumVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
+void DBusInputStream::pushSize(size_t _size) {
+ sizes_.push(_size);
}
-void DBusInputStream::beginReadInt64EnumVector() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
+size_t DBusInputStream::popSize() {
+ size_t itsSize = sizes_.top();
+ sizes_.pop();
+ return itsSize;
}
-void DBusInputStream::beginReadUInt8EnumVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(bool &_value, const EmptyDeployment *_depl) {
+ uint32_t tmp;
+ readValue(tmp, _depl);
+ if (tmp > 1)
+ setError();
+ _value = (tmp != 0);
+ return (*this);
}
-void DBusInputStream::beginReadUInt16EnumVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(int8_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadUInt32EnumVector() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(int16_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadUInt64EnumVector() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(int32_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadVectorOfSerializableStructs() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(int64_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadVectorOfSerializableVariants() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(uint8_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadVectorOfVectors() {
- beginReadGenericVector();
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(uint16_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadVectorOfMaps() {
- beginReadGenericVector();
- alignToBoundary(4);
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(uint32_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadVectorOfSerializablePolymorphicStructs() {
- beginReadGenericVector();
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
+InputStream<DBusInputStream> &DBusInputStream::readValue(uint64_t &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-bool DBusInputStream::hasMoreVectorElements() {
- return bytesToRead_.top() > currentDataPosition_ - savedStreamPositions_.top();
+InputStream<DBusInputStream> &DBusInputStream::readValue(float &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::endReadVector() {
- bytesToRead_.pop();
- savedStreamPositions_.pop();
+InputStream<DBusInputStream> &DBusInputStream::readValue(double &_value, const EmptyDeployment *_depl) {
+ return _readValue(_value);
}
-void DBusInputStream::beginReadMap() {
- uint32_t vectorByteSize;
- readBasicTypeValue(vectorByteSize);
- bytesToRead_.push(vectorByteSize);
- alignToBoundary(8);
- savedStreamPositions_.push(currentDataPosition_);
-}
+InputStream<DBusInputStream> &DBusInputStream::readValue(std::string &_value, const EmptyDeployment *_depl) {
+ uint32_t length;
+ _readValue(length);
-bool DBusInputStream::hasMoreMapElements() {
- return bytesToRead_.top() > currentDataPosition_ - savedStreamPositions_.top();
-}
+ // length field does not include terminating 0-byte, therefore length of data to read is +1
+ char *data = _readRaw(length + 1);
-void DBusInputStream::endReadMap() {
- bytesToRead_.pop();
- savedStreamPositions_.pop();
-}
+ // The string contained in a DBus-message is required to be 0-terminated, therefore the following line works
+ _value = data;
-void DBusInputStream::beginReadMapElement() {
- alignToBoundary(8);
-}
-void DBusInputStream::endReadMapElement() {
+ return (*this);
}
-void DBusInputStream::setError() {
- exception_ = new CommonAPI::DBus::DBusError();
+InputStream<DBusInputStream> &DBusInputStream::readValue(Version &_value, const EmptyDeployment *_depl) {
+ align(8);
+ _readValue(_value.Major);
+ _readValue(_value.Minor);
+ return *this;
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusInputStream.h b/src/CommonAPI/DBus/DBusInputStream.h
deleted file mode 100644
index b91583c..0000000
--- a/src/CommonAPI/DBus/DBusInputStream.h
+++ /dev/null
@@ -1,233 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_INPUT_STREAM_H_
-#define COMMONAPI_DBUS_DBUS_INPUT_STREAM_H_
-
-#include "DBusError.h"
-#include "DBusMessage.h"
-
-#include <CommonAPI/InputStream.h>
-
-#include <stdint.h>
-#include <cassert>
-#include <string>
-#include <vector>
-#include <stack>
-
-namespace CommonAPI {
-namespace DBus {
-
-/**
- * Used to mark the position of a pointer within an array of bytes.
- */
-typedef uint32_t position_t;
-
-/**
- * @class DBusInputMessageStream
- *
- * Used to deserialize and read data from a #DBusMessage. For all data types that can be read from a #DBusMessage, a ">>"-operator should be defined to handle the reading
- * (this operator is predefined for all basic data types and for vectors).
- */
-class DBusInputStream: public InputStream {
-public:
- virtual bool hasError() const {
- return isErrorSet();
- }
-
- virtual InputStream& readValue(bool& boolValue);
-
- virtual InputStream& readValue(int8_t& int8Value);
- virtual InputStream& readValue(int16_t& int16Value);
- virtual InputStream& readValue(int32_t& int32Value);
- virtual InputStream& readValue(int64_t& int64Value);
-
- virtual InputStream& readValue(uint8_t& uint8Value);
- virtual InputStream& readValue(uint16_t& uint16Value);
- virtual InputStream& readValue(uint32_t& uint32Value);
- virtual InputStream& readValue(uint64_t& uint64Value);
-
- virtual InputStream& readValue(float& floatValue);
- virtual InputStream& readValue(double& doubleValue);
-
- virtual InputStream& readValue(std::string& stringValue);
- virtual InputStream& readValue(ByteBuffer& byteBufferValue);
-
- virtual InputStream& readEnumValue(int8_t& int8BackingTypeValue);
- virtual InputStream& readEnumValue(int16_t& int16BackingTypeValue);
- virtual InputStream& readEnumValue(int32_t& int32BackingTypeValue);
- virtual InputStream& readEnumValue(int64_t& int64BackingTypeValue);
- virtual InputStream& readEnumValue(uint8_t& uint8BackingTypeValue);
- virtual InputStream& readEnumValue(uint16_t& uint16BackingTypeValue);
- virtual InputStream& readEnumValue(uint32_t& uint32BackingTypeValue);
- virtual InputStream& readEnumValue(uint64_t& uint64BackingTypeValue);
-
- virtual InputStream& readVersionValue(Version& versionValue);
-
- virtual void beginReadSerializableStruct(const SerializableStruct& serializableStruct);
- virtual void endReadSerializableStruct(const SerializableStruct& serializableStruct);
-
- virtual void beginReadSerializablePolymorphicStruct(uint32_t& serialId);
- virtual void endReadSerializablePolymorphicStruct(const uint32_t& serialId);
-
- virtual void readSerializableVariant(SerializableVariant& serializableVariant);
-
- virtual void beginReadBoolVector();
- virtual void beginReadInt8Vector();
- virtual void beginReadInt16Vector();
- virtual void beginReadInt32Vector();
- virtual void beginReadInt64Vector();
- virtual void beginReadUInt8Vector();
- virtual void beginReadUInt16Vector();
- virtual void beginReadUInt32Vector();
- virtual void beginReadUInt64Vector();
- virtual void beginReadFloatVector();
- virtual void beginReadDoubleVector();
- virtual void beginReadStringVector();
- virtual void beginReadByteBufferVector();
- virtual void beginReadVersionVector();
-
- virtual void beginReadInt8EnumVector();
- virtual void beginReadInt16EnumVector();
- virtual void beginReadInt32EnumVector();
- virtual void beginReadInt64EnumVector();
- virtual void beginReadUInt8EnumVector();
- virtual void beginReadUInt16EnumVector();
- virtual void beginReadUInt32EnumVector();
- virtual void beginReadUInt64EnumVector();
-
- virtual void beginReadVectorOfSerializableStructs();
- virtual void beginReadVectorOfSerializableVariants();
- virtual void beginReadVectorOfVectors();
- virtual void beginReadVectorOfMaps();
-
- virtual void beginReadVectorOfSerializablePolymorphicStructs();
-
- virtual bool hasMoreVectorElements();
- virtual void endReadVector();
-
- virtual void beginReadMap();
- virtual bool hasMoreMapElements();
- virtual void endReadMap();
- virtual void beginReadMapElement();
- virtual void endReadMapElement();
-
- /**
- * Creates a #DBusInputMessageStream which can be used to deserialize and read data from the given #DBusMessage.
- * As no message-signature is checked, the user is responsible to ensure that the correct data types are read in the correct order.
- *
- * @param message the #DBusMessage from which data should be read.
- */
- DBusInputStream(const CommonAPI::DBus::DBusMessage& message);
- DBusInputStream(const DBusInputStream& imessagestream) = 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.
- */
- ~DBusInputStream();
-
- /**
- * Marks the stream as erroneous.
- */
- void setError();
-
- /**
- * @return An instance of #DBusError if this stream is in an erroneous state, NULL otherwise
- */
- const CommonAPI::DBus::DBusError& getError() const;
-
- /**
- * @return true if this stream is in an erroneous state, false otherwise.
- */
- 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.
- */
- 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
- * starting from the given boundary.
- *
- * @param alignBoundary the byte boundary to which the stream needs to be aligned.
- */
- void alignToBoundary(const size_t alignBoundary);
-
- /**
- * Reads the given number of bytes and returns them as an array of characters.
- *
- * Actually, for performance reasons this command only returns a pointer to the current position in the stream,
- * and then increases the position of this pointer by the number of bytes indicated by the given parameter.
- * It is the user's responsibility to actually use only the number of bytes he indicated he would use.
- * It is assumed the user knows what kind of value is stored next in the #DBusMessage the data is streamed from.
- * Using a reinterpret_cast on the returned pointer should then restore the original value.
- *
- * Example use case:
- * @code
- * ...
- * inputMessageStream.alignForBasicType(sizeof(int32_t));
- * char* const dataPtr = inputMessageStream.read(sizeof(int32_t));
- * int32_t val = *(reinterpret_cast<int32_t*>(dataPtr));
- * ...
- * @endcode
- */
- char* readRawData(const size_t numBytesToRead);
-
- /**
- * Handles all reading of basic types from a given #DBusInputMessageStream.
- * Basic types in this context are: uint8_t, uint16_t, uint32_t, uint64_t, int8_t, int16_t, int32_t, int64_t, float, double.
- * Any types not listed here (especially all complex types, e.g. structs, unions etc.) need to provide a
- * specialized implementation of this operator.
- *
- * @tparam _BasicType The type of the value that is to be read from the given stream.
- * @param val The variable in which the retrieved value is to be stored
- * @param inputMessageStream The stream which the value is to be read from
- * @return The given inputMessageStream to allow for successive reading
- */
- template<typename _BasicType>
- DBusInputStream& readBasicTypeValue(_BasicType& val) {
- if (sizeof(val) > 1)
- alignToBoundary(sizeof(_BasicType));
-
- val = *(reinterpret_cast<_BasicType*>(readRawData(sizeof(_BasicType))));
- return *this;
- }
-
-private:
- inline void beginReadGenericVector() {
- uint32_t vectorByteSize;
- readBasicTypeValue(vectorByteSize);
- bytesToRead_.push(vectorByteSize);
- }
-
- inline void skipOverSignature() {
- uint8_t signatureLength;
- readValue(signatureLength);
- readRawData(signatureLength + 1);
- }
-
- char* dataBegin_;
- position_t currentDataPosition_;
- size_t dataLength_;
- CommonAPI::DBus::DBusError* exception_;
- CommonAPI::DBus::DBusMessage message_;
-
- std::stack<uint32_t> bytesToRead_;
- std::stack<position_t> savedStreamPositions_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_INPUT_STREAM_H_
diff --git a/src/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.h b/src/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.h
deleted file mode 100644
index f9e5a1e..0000000
--- a/src/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.h
+++ /dev/null
@@ -1,140 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_INSTANCE_AVAILABILITY_STATUS_CHANGED_EVENT_H_
-#define COMMONAPI_DBUS_DBUS_INSTANCE_AVAILABILITY_STATUS_CHANGED_EVENT_H_
-
-#include <CommonAPI/ProxyManager.h>
-
-#include "DBusProxy.h"
-#include "DBusObjectManagerStub.h"
-#include "DBusInstanceAvailabilityStatusChangedEvent.h"
-
-#include <functional>
-#include <future>
-#include <string>
-#include <vector>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-// TODO move logic to DBusServiceRegistry, now every proxy will deserialize the messages!
-class DBusInstanceAvailabilityStatusChangedEvent:
- public ProxyManager::InstanceAvailabilityStatusChangedEvent,
- public DBusProxyConnection::DBusSignalHandler {
- public:
- DBusInstanceAvailabilityStatusChangedEvent(DBusProxy& dbusProxy, const std::string& interfaceName) :
- dbusProxy_(dbusProxy),
- observedInterfaceName_(interfaceName) {
- }
-
- virtual SubscriptionStatus onSignalDBusMessage(const DBusMessage& dbusMessage) {
- if (dbusMessage.hasMemberName("InterfacesAdded")) {
- onInterfacesAddedSignal(dbusMessage);
- } else if (dbusMessage.hasMemberName("InterfacesRemoved")) {
- onInterfacesRemovedSignal(dbusMessage);
- }
-
- return CommonAPI::SubscriptionStatus::RETAIN;
- }
-
- virtual ~DBusInstanceAvailabilityStatusChangedEvent() {
- dbusProxy_.removeSignalMemberHandler(interfacesAddedSubscription_);
- dbusProxy_.removeSignalMemberHandler(interfacesRemovedSubscription_);
- }
-
- protected:
- virtual void onFirstListenerAdded(const CancellableListener&) {
- interfacesAddedSubscription_ = dbusProxy_.addSignalMemberHandler(
- dbusProxy_.getDBusObjectPath(),
- DBusObjectManagerStub::getInterfaceName(),
- "InterfacesAdded",
- "oa{sa{sv}}",
- this);
-
- interfacesRemovedSubscription_ = dbusProxy_.addSignalMemberHandler(
- dbusProxy_.getDBusObjectPath(),
- DBusObjectManagerStub::getInterfaceName(),
- "InterfacesRemoved",
- "oas",
- this);
- }
-
- virtual void onLastListenerRemoved(const CancellableListener&) {
- dbusProxy_.removeSignalMemberHandler(interfacesAddedSubscription_);
- dbusProxy_.removeSignalMemberHandler(interfacesRemovedSubscription_);
- }
-
- private:
- inline void onInterfacesAddedSignal(const DBusMessage& dbusMessage) {
- DBusInputStream dbusInputStream(dbusMessage);
- std::string dbusObjectPath;
- DBusObjectManagerStub::DBusInterfacesAndPropertiesDict dbusInterfacesAndPropertiesDict;
-
- dbusInputStream >> dbusObjectPath;
- assert(!dbusInputStream.hasError());
-
- dbusInputStream >> dbusInterfacesAndPropertiesDict;
- assert(!dbusInputStream.hasError());
-
- for (const auto& dbusInterfaceIterator : dbusInterfacesAndPropertiesDict) {
- const std::string& dbusInterfaceName = dbusInterfaceIterator.first;
-
- if(dbusInterfaceName == observedInterfaceName_) {
- notifyInterfaceStatusChanged(dbusObjectPath, dbusInterfaceName, AvailabilityStatus::AVAILABLE);
- }
- }
- }
-
- inline void onInterfacesRemovedSignal(const DBusMessage& dbusMessage) {
- DBusInputStream dbusInputStream(dbusMessage);
- std::string dbusObjectPath;
- std::vector<std::string> dbusInterfaceNames;
-
- dbusInputStream >> dbusObjectPath;
- assert(!dbusInputStream.hasError());
-
- dbusInputStream >> dbusInterfaceNames;
- assert(!dbusInputStream.hasError());
-
- for (const auto& dbusInterfaceName : dbusInterfaceNames) {
- if(dbusInterfaceName == observedInterfaceName_) {
- notifyInterfaceStatusChanged(dbusObjectPath, dbusInterfaceName, AvailabilityStatus::NOT_AVAILABLE);
- }
- }
- }
-
- void notifyInterfaceStatusChanged(const std::string& dbusObjectPath,
- const std::string& dbusInterfaceName,
- const AvailabilityStatus& availabilityStatus) {
- std::string commonApiAddress;
-
- DBusAddressTranslator::getInstance().searchForCommonAddress(
- dbusInterfaceName,
- dbusProxy_.getDBusBusName(),
- dbusObjectPath,
- commonApiAddress);
-
- notifyListeners(commonApiAddress, availabilityStatus);
- }
-
-
- DBusProxy& dbusProxy_;
- std::string observedInterfaceName_;
- DBusProxyConnection::DBusSignalHandlerToken interfacesAddedSubscription_;
- DBusProxyConnection::DBusSignalHandlerToken interfacesRemovedSubscription_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_INSTANCE_AVAILABILITY_STATUS_CHANGED_EVENT_H_
diff --git a/src/CommonAPI/DBus/DBusInterfaceHandler.h b/src/CommonAPI/DBus/DBusInterfaceHandler.h
deleted file mode 100644
index 1ee2cb1..0000000
--- a/src/CommonAPI/DBus/DBusInterfaceHandler.h
+++ /dev/null
@@ -1,32 +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_DBUS_INTERFACE_HANDLER_H_
-#define COMMONAPI_DBUS_INTERFACE_HANDLER_H_
-
-#include "DBusProxyConnection.h"
-#include "DBusMessage.h"
-
-#include <memory>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusInterfaceHandler {
- public:
- virtual ~DBusInterfaceHandler() { }
-
- virtual const char* getMethodsDBusIntrospectionXmlData() const = 0;
-
- virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) = 0;
-
- virtual const bool hasFreedesktopProperties() = 0;
-};
-
-} // namespace dbus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_INTERFACE_HANDLER_H_
diff --git a/src/CommonAPI/DBus/DBusLegacyVariant.h b/src/CommonAPI/DBus/DBusLegacyVariant.h
deleted file mode 100644
index ec3b5c9..0000000
--- a/src/CommonAPI/DBus/DBusLegacyVariant.h
+++ /dev/null
@@ -1,138 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef DBUSLEGACYVARIANT_H_
-#define DBUSLEGACYVARIANT_H_
-
-#include <CommonAPI/SerializableVariant.h>
-#include "DBusOutputStream.h"
-#include "DBusInputStream.h"
-
-namespace CommonAPI {
-namespace DBus {
-
-template<class Visitor, class Variant, typename ... _Types>
-struct ApplyIndexForStringVisitor
-;
-
-template<class Visitor, class Variant>
-struct ApplyIndexForStringVisitor<Visitor, Variant> {
- static const uint8_t index = 0;
-
- static uint8_t visit(Visitor&, const Variant&) {
- //won't be called
- assert(false);
- return 0;
- }
-};
-
-template<class Visitor, class Variant, typename _Type, typename ... _Types>
-struct ApplyIndexForStringVisitor<Visitor, Variant, _Type, _Types...> {
- static const uint8_t index = ApplyIndexForStringVisitor<Visitor, Variant,
- _Types...>::index + 1;
-
- static uint8_t visit(Visitor& visitor, const Variant& var) {
- DBusTypeOutputStream typeStream_;
- TypeWriter<_Type>::writeType(typeStream_);
- const std::string sig = typeStream_.retrieveSignature();
-#ifdef WIN32
- if (visitor.operator()<_Type>(sig)) {
-#else
- if (visitor.template operator()<_Type>(sig)) {
-#endif
- return index;
- } else {
- return ApplyIndexForStringVisitor<Visitor, Variant, _Types...>::visit(visitor,
- var);
- }
- }
-};
-
-template<typename ... _Types>
-struct TypeOutputStreamCompareVisitor {
-public:
- TypeOutputStreamCompareVisitor(const std::string& type) :
- type_(type) {
- }
-
- template<typename _Type>
- bool operator()(const std::string& ntype) const {
- int comp = type_.compare(0, type_.size(), ntype);
- if (comp == 0) {
- return true;
- } else {
- return false;
- }
- }
-private:
- const std::string type_;
-
-};
-
-template< class >
-class DBusLegacyVariantWrapper;
-
-template <
- template <class...> class _Type, class... _Types>
-class DBusLegacyVariantWrapper<_Type<_Types...>> {
-public:
-
- DBusLegacyVariantWrapper() :
- contained_() {
- }
-
- DBusLegacyVariantWrapper(CommonAPI::Variant<_Types...>& cont) :
- contained_(cont) {
- }
-
-
- uint8_t getIndexForType(const std::string& type) const {
- TypeOutputStreamCompareVisitor<_Types...> visitor(type);
- return ApplyIndexForStringVisitor<TypeOutputStreamCompareVisitor<_Types...>, Variant<_Types...>, _Types...>::visit(
- visitor, contained_);
- }
-
- CommonAPI::Variant<_Types...> contained_;
-};
-
-} /* namespace DBus */
-
-//template <template <class...> class _Type, class... _Types>
-template <typename ... _Types>
-inline OutputStream& operator<<(OutputStream& outputStream, const DBus::DBusLegacyVariantWrapper<Variant<_Types...> >& serializableVariant) {
- DBus::DBusTypeOutputStream typeOutputStream;
- serializableVariant.contained_.writeToTypeOutputStream(typeOutputStream);
- std::string sigStr = typeOutputStream.retrieveSignature();
- uint8_t length = (uint8_t) sigStr.length();
- assert(length < 256);
- outputStream << length;
- outputStream.writeRawData(sigStr.c_str(), length + 1);
- serializableVariant.contained_.writeToOutputStream(outputStream);
- return outputStream;
-}
-
-//template <template <class...> class _Type, class... _Types>
-template <typename ... _Types>
-inline InputStream& operator>>(InputStream& inputStream, DBus::DBusLegacyVariantWrapper<Variant<_Types...> >& serializableVariant) {
- uint8_t signatureLength;
- inputStream.readValue(signatureLength);
- assert(signatureLength < 256);
- char * buf = inputStream.readRawData(signatureLength + 1);
- std::string sigString;
- sigString.assign(buf, buf + signatureLength);
- uint8_t containedTypeIndex = serializableVariant.getIndexForType(sigString);
- serializableVariant.contained_.readFromInputStream(containedTypeIndex, inputStream);
- return inputStream;
-}
-
-} /* namespace CommonAPI */
-
-#endif /* DBUSLEGACYVARIANT_H_ */
diff --git a/src/CommonAPI/DBus/DBusMainLoopContext.cpp b/src/CommonAPI/DBus/DBusMainLoopContext.cpp
index c093a67..dea1ff9 100644
--- a/src/CommonAPI/DBus/DBusMainLoopContext.cpp
+++ b/src/CommonAPI/DBus/DBusMainLoopContext.cpp
@@ -1,26 +1,22 @@
-/* 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 "DBusMainLoopContext.h"
-#include "DBusConnection.h"
+// 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>
#else
#include <poll.h>
#endif
+
#include <chrono>
+#include <CommonAPI/DBus/DBusMainLoopContext.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
namespace CommonAPI {
namespace DBus {
-
DBusDispatchSource::DBusDispatchSource(DBusConnection* dbusConnection):
dbusConnection_(dbusConnection) {
}
@@ -48,14 +44,18 @@ DBusWatch::DBusWatch(::DBusWatch* libdbusWatch, std::weak_ptr<MainLoopContext>&
}
bool DBusWatch::isReadyToBeWatched() {
- return dbus_watch_get_enabled(libdbusWatch_);
+ return 0 != dbus_watch_get_enabled(libdbusWatch_);
}
void DBusWatch::startWatching() {
if(!dbus_watch_get_enabled(libdbusWatch_)) stopWatching();
unsigned int channelFlags_ = dbus_watch_get_flags(libdbusWatch_);
- short int pollFlags = POLLERR | POLLHUP;
+#ifdef WIN32
+ short int pollFlags = 0;
+#else
+ short int pollFlags = POLLERR | POLLHUP;
+#endif
if(channelFlags_ & DBUS_WATCH_READABLE) {
pollFlags |= POLLIN;
}
@@ -63,7 +63,12 @@ void DBusWatch::startWatching() {
pollFlags |= POLLOUT;
}
- pollFileDescriptor_.fd = dbus_watch_get_unix_fd(libdbusWatch_);
+#ifdef WIN32
+ pollFileDescriptor_.fd = dbus_watch_get_socket(libdbusWatch_);
+#else
+ pollFileDescriptor_.fd = dbus_watch_get_unix_fd(libdbusWatch_);
+#endif
+
pollFileDescriptor_.events = pollFlags;
pollFileDescriptor_.revents = 0;
@@ -74,8 +79,9 @@ void DBusWatch::startWatching() {
void DBusWatch::stopWatching() {
auto lockedContext = mainLoopContext_.lock();
- assert(lockedContext);
- lockedContext->deregisterWatch(this);
+ if (lockedContext) {
+ lockedContext->deregisterWatch(this);
+ }
}
const pollfd& DBusWatch::getAssociatedFileDescriptor() {
@@ -83,7 +89,13 @@ const pollfd& DBusWatch::getAssociatedFileDescriptor() {
}
void DBusWatch::dispatch(unsigned int eventFlags) {
- dbus_watch_handle(libdbusWatch_, eventFlags);
+ // Pollflags do not correspond directly to DBus watch flags
+ unsigned int dbusWatchFlags = (eventFlags & POLLIN) |
+ ((eventFlags & POLLOUT) >> 1) |
+ ((eventFlags & POLLERR) >> 1) |
+ ((eventFlags & POLLHUP) >> 1);
+
+ dbus_watch_handle(libdbusWatch_, dbusWatchFlags);
}
const std::vector<DispatchSource*>& DBusWatch::getDependentDispatchSources() {
@@ -102,7 +114,7 @@ DBusTimeout::DBusTimeout(::DBusTimeout* libdbusTimeout, std::weak_ptr<MainLoopCo
}
bool DBusTimeout::isReadyToBeMonitored() {
- return dbus_timeout_get_enabled(libdbusTimeout_);
+ return 0 != dbus_timeout_get_enabled(libdbusTimeout_);
}
void DBusTimeout::startMonitoring() {
@@ -115,8 +127,9 @@ void DBusTimeout::startMonitoring() {
void DBusTimeout::stopMonitoring() {
dueTimeInMs_ = TIMEOUT_INFINITE;
auto lockedContext = mainLoopContext_.lock();
- assert(lockedContext);
- lockedContext->deregisterTimeoutSource(this);
+ if (lockedContext) {
+ lockedContext->deregisterTimeoutSource(this);
+ }
}
bool DBusTimeout::dispatch() {
@@ -142,6 +155,5 @@ void DBusTimeout::recalculateDueTime() {
}
}
-
} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusMainLoopContext.h b/src/CommonAPI/DBus/DBusMainLoopContext.h
deleted file mode 100644
index 439d530..0000000
--- a/src/CommonAPI/DBus/DBusMainLoopContext.h
+++ /dev/null
@@ -1,92 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef DBUS_MAINLOOPCONTEXT_H_
-#define DBUS_MAINLOOPCONTEXT_H_
-
-#include <list>
-#include <memory>
-#include <CommonAPI/MainLoopContext.h>
-
-#include <dbus/dbus.h>
-
-
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusConnection;
-
-
-
-class DBusDispatchSource: public DispatchSource {
- public:
- DBusDispatchSource(DBusConnection* dbusConnection);
- ~DBusDispatchSource();
-
- bool prepare(int64_t& timeout);
- bool check();
- bool dispatch();
-
- private:
- DBusConnection* dbusConnection_;
-};
-
-class DBusWatch: public Watch {
- public:
- DBusWatch(::DBusWatch* libdbusWatch, std::weak_ptr<MainLoopContext>& mainLoopContext);
-
- bool isReadyToBeWatched();
- void startWatching();
- void stopWatching();
-
- void dispatch(unsigned int eventFlags);
-
- const pollfd& getAssociatedFileDescriptor();
-
- const std::vector<DispatchSource*>& getDependentDispatchSources();
- void addDependentDispatchSource(DispatchSource* dispatchSource);
- private:
- bool isReady();
-
- ::DBusWatch* libdbusWatch_;
- pollfd pollFileDescriptor_;
- std::vector<DispatchSource*> dependentDispatchSources_;
-
- std::weak_ptr<MainLoopContext> mainLoopContext_;
-};
-
-
-class DBusTimeout: public Timeout {
- public:
- DBusTimeout(::DBusTimeout* libdbusTimeout, std::weak_ptr<MainLoopContext>& mainLoopContext);
-
- bool isReadyToBeMonitored();
- void startMonitoring();
- void stopMonitoring();
-
- bool dispatch();
-
- int64_t getTimeoutInterval() const;
- int64_t getReadyTime() const;
- private:
- void recalculateDueTime();
-
- int64_t dueTimeInMs_;
- ::DBusTimeout* libdbusTimeout_;
- std::weak_ptr<MainLoopContext> mainLoopContext_;
-};
-
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif
diff --git a/src/CommonAPI/DBus/DBusMessage.cpp b/src/CommonAPI/DBus/DBusMessage.cpp
index 512ed57..e041b79 100644
--- a/src/CommonAPI/DBus/DBusMessage.cpp
+++ b/src/CommonAPI/DBus/DBusMessage.cpp
@@ -1,280 +1,242 @@
-/* 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 "DBusMessage.h"
+// 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 <cassert>
#include <cstring>
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+
namespace CommonAPI {
namespace DBus {
-DBusMessage::DBusMessage():
- libdbusMessage_(NULL) {
+DBusMessage::DBusMessage()
+ : message_(NULL) {
}
-DBusMessage::DBusMessage(::DBusMessage* libdbusMessage) {
- libdbusMessage_ = libdbusMessage != NULL ? dbus_message_ref(libdbusMessage) : NULL;
+DBusMessage::DBusMessage(::DBusMessage *_message) {
+ message_ = (_message != nullptr ? dbus_message_ref(_message) : nullptr);
}
-DBusMessage::DBusMessage(::DBusMessage* libdbusMessage, bool increaseReferenceCount) {
- assert(libdbusMessage);
-
- libdbusMessage_ = increaseReferenceCount ? dbus_message_ref(libdbusMessage) : libdbusMessage;
+DBusMessage::DBusMessage(::DBusMessage *_message, bool reference) {
+ assert(_message);
+ message_ = (reference ? dbus_message_ref(message_) : _message);
}
-DBusMessage::DBusMessage(const DBusMessage& src) {
- libdbusMessage_ = src.libdbusMessage_ != NULL ? dbus_message_ref(src.libdbusMessage_) : NULL;
+DBusMessage::DBusMessage(const DBusMessage &_source) {
+ message_ = (_source.message_ != nullptr ?
+ dbus_message_ref(_source.message_) : nullptr);
}
-DBusMessage::DBusMessage(DBusMessage&& rsrc) {
- libdbusMessage_ = rsrc.libdbusMessage_;
- rsrc.libdbusMessage_ = NULL;
+DBusMessage::DBusMessage(DBusMessage &&_source) {
+ message_ = _source.message_;
+ _source.message_ = nullptr;
}
DBusMessage::~DBusMessage() {
- if (libdbusMessage_)
- dbus_message_unref(libdbusMessage_);
+ if (message_)
+ dbus_message_unref(message_);
}
-DBusMessage& DBusMessage::operator=(const DBusMessage& src) {
- if (this != &src) {
- if (libdbusMessage_)
- dbus_message_unref(libdbusMessage_);
+DBusMessage &
+DBusMessage::operator=(const DBusMessage &_source) {
+ if (this != &_source) {
+ if (message_)
+ dbus_message_unref(message_);
- libdbusMessage_ = src.libdbusMessage_ != NULL ? dbus_message_ref(src.libdbusMessage_) : NULL;
+ message_ = (_source.message_ != nullptr ?
+ dbus_message_ref(_source.message_) : nullptr);
}
-
- return *this;
+ return (*this);
}
-DBusMessage& DBusMessage::operator=(DBusMessage&& rsrc) {
- if (this != &rsrc) {
- if (libdbusMessage_)
- dbus_message_unref(libdbusMessage_);
+DBusMessage &
+DBusMessage::operator=(DBusMessage &&_source) {
+ if (this != &_source) {
+ if (message_)
+ dbus_message_unref(message_);
- libdbusMessage_ = rsrc.libdbusMessage_;
- rsrc.libdbusMessage_ = NULL;
+ message_ = _source.message_;
+ _source.message_ = NULL;
}
-
- return *this;
+ return (*this);
}
DBusMessage::operator bool() const {
- const bool isNotNullDBusMessage = (libdbusMessage_ != NULL);
- return isNotNullDBusMessage;
+ return (nullptr != message_);
}
-DBusMessage DBusMessage::createOrgFreedesktopOrgMethodCall(const char* methodName, const char* signature) {
- return DBusMessage::createMethodCall("org.freedesktop.DBus",
- "/",
- "org.freedesktop.DBus",
- methodName,
- signature);
-}
-
-DBusMessage DBusMessage::createOrgFreedesktopOrgMethodCall(const std::string& methodName,
- const std::string& signature) {
- assert(!methodName.empty());
+DBusMessage
+DBusMessage::createOrgFreedesktopOrgMethodCall(
+ const std::string &_method, const std::string &_signature) {
- return createOrgFreedesktopOrgMethodCall(methodName.c_str(),
- signature.empty() ? NULL : signature.c_str());
+ static DBusAddress address("org.freedesktop.DBus", "/", "org.freedesktop.DBus");
+ return DBusMessage::createMethodCall(address, _method, _signature);
}
-DBusMessage DBusMessage::createMethodCall(const char* busName,
- const char* objectPath,
- const char* interfaceName,
- const char* methodName,
- const char* signature) {
- assert(busName);
- assert(objectPath);
- assert(interfaceName);
- assert(methodName);
+DBusMessage
+DBusMessage::createMethodCall(
+ const DBusAddress &_address,
+ const std::string &_method, const std::string &_signature) {
- ::DBusMessage* libdbusMessageCall = dbus_message_new_method_call(busName,
- objectPath,
- interfaceName,
- methodName);
- assert(libdbusMessageCall);
+ std::string service = _address.getService();
+ std::string path = _address.getObjectPath();
+ std::string interface = _address.getInterface();
- if (signature)
- dbus_message_set_signature(libdbusMessageCall, signature);
+ ::DBusMessage *methodCall = dbus_message_new_method_call(
+ service.c_str(), path.c_str(),
+ interface.c_str(), _method.c_str());
+ assert(methodCall);
- const bool increaseLibdbusMessageReferenceCount = false;
- return DBusMessage(libdbusMessageCall, increaseLibdbusMessageReferenceCount);
-}
+ if ("" != _signature)
+ dbus_message_set_signature(methodCall, _signature.c_str());
-DBusMessage DBusMessage::createMethodCall(const std::string& busName,
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& methodName,
- const std::string& signature) {
- assert(!busName.empty());
- assert(!objectPath.empty());
- assert(!interfaceName.empty());
- assert(!methodName.empty());
-
- return createMethodCall(busName.c_str(),
- objectPath.c_str(),
- interfaceName.c_str(),
- methodName.c_str(),
- signature.empty() ? NULL : signature.c_str());
+ return DBusMessage(methodCall, false);
}
-DBusMessage DBusMessage::createMethodReturn(const char* signature) const {
- ::DBusMessage* libdbusMessageReturn = dbus_message_new_method_return(libdbusMessage_);
- assert(libdbusMessageReturn);
+DBusMessage
+DBusMessage::createMethodReturn(const std::string &_signature) const {
+ ::DBusMessage *methodReturn = dbus_message_new_method_return(message_);
+ assert(methodReturn);
- if (signature)
- dbus_message_set_signature(libdbusMessageReturn, signature);
+ if ("" != _signature)
+ dbus_message_set_signature(methodReturn, _signature.c_str());
- const bool increaseLibdbusMessageReferenceCount = false;
- return DBusMessage(libdbusMessageReturn, increaseLibdbusMessageReferenceCount);
+ return DBusMessage(methodReturn, false);
}
-DBusMessage DBusMessage::createMethodReturn(const std::string& signature) const {
- return createMethodReturn(signature.empty() ? NULL : signature.c_str());
-}
+DBusMessage
+DBusMessage::createMethodError(
+ const std::string &_code, const std::string &_info) const {
-DBusMessage DBusMessage::createMethodError(const std::string& name, const std::string& reason) const {
- ::DBusMessage* libdbusMessageError = dbus_message_new_error(libdbusMessage_, name.c_str(), reason.c_str());
- assert(libdbusMessageError);
+ ::DBusMessage *methodError
+ = dbus_message_new_error(message_, _code.c_str(), _info.c_str());
+ assert(methodError);
- const bool increaseLibdbusMessageReferenceCount = false;
- return DBusMessage(libdbusMessageError, increaseLibdbusMessageReferenceCount);
+ return DBusMessage(methodError, false);
}
-DBusMessage DBusMessage::createSignal(const char* objectPath,
- const char* interfaceName,
- const char* signalName,
- const char* signature) {
- assert(objectPath);
- assert(interfaceName);
- assert(signalName);
-
- ::DBusMessage* libdbusMessageSignal = dbus_message_new_signal(objectPath,
- interfaceName,
- signalName);
- assert(libdbusMessageSignal);
+DBusMessage
+DBusMessage::createSignal(
+ const std::string &_path, const std::string &_interface,
+ const std::string &_signal, const std::string &_signature) {
- if (signature)
- dbus_message_set_signature(libdbusMessageSignal, signature);
+ ::DBusMessage *messageSignal
+ = dbus_message_new_signal(_path.c_str(), _interface.c_str(), _signal.c_str());
+ assert(messageSignal);
- const bool increaseLibdbusMessageReferenceCount = false;
- return DBusMessage(libdbusMessageSignal, increaseLibdbusMessageReferenceCount);
-}
-
-DBusMessage DBusMessage::createSignal(const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& signalName,
- const std::string& signature) {
- assert(!objectPath.empty());
- assert(!interfaceName.empty());
- assert(!signalName.empty());
+ if ("" != _signature)
+ dbus_message_set_signature(messageSignal, _signature.c_str());
- return createSignal(objectPath.c_str(),
- interfaceName.c_str(),
- signalName.c_str(),
- signature.empty() ? NULL : signature.c_str());
+ return DBusMessage(messageSignal, false);
}
-const char* DBusMessage::getObjectPath() const {
- return dbus_message_get_path(libdbusMessage_);
+const char *
+DBusMessage::getObjectPath() const {
+ return dbus_message_get_path(message_);
}
-const char* DBusMessage::getSenderName() const {
- return dbus_message_get_sender(libdbusMessage_);
+const char *
+DBusMessage::getSender() const {
+ return dbus_message_get_sender(message_);
}
-const char* DBusMessage::getInterfaceName() const {
- return dbus_message_get_interface(libdbusMessage_);
+const char *
+DBusMessage::getInterface() const {
+ return dbus_message_get_interface(message_);
}
-const char* DBusMessage::getMemberName() const {
- return dbus_message_get_member(libdbusMessage_);
+const char *
+DBusMessage::getMember() const {
+ return dbus_message_get_member(message_);
}
-const char* DBusMessage::getSignatureString() const {
- return dbus_message_get_signature(libdbusMessage_);
+const char *
+DBusMessage::getSignature() const {
+ return dbus_message_get_signature(message_);
}
-const char* DBusMessage::getErrorName() const {
+const char *
+DBusMessage::getError() const {
assert(isErrorType());
+ return dbus_message_get_error_name(message_);
+}
- return dbus_message_get_error_name(libdbusMessage_);
+const char *
+DBusMessage::getDestination() const {
+ return dbus_message_get_destination(message_);
}
-const char* DBusMessage::getDestination() const {
- return dbus_message_get_destination(libdbusMessage_);
+const uint32_t DBusMessage::getSerial() const {
+ return dbus_message_get_serial(message_);
}
-bool DBusMessage::hasObjectPath(const char* objectPath) const {
- const char* dbusMessageObjectPath = getObjectPath();
+bool
+DBusMessage::hasObjectPath(const char *_path) const {
+ const char *path = getObjectPath();
- assert(objectPath);
- assert(dbusMessageObjectPath);
+ assert(_path);
+ assert(path);
- return !strcmp(dbusMessageObjectPath, objectPath);
+ return (!strcmp(path, _path));
}
-bool DBusMessage::hasInterfaceName(const char* interfaceName) const {
- const char* dbusMessageInterfaceName = getInterfaceName();
+bool DBusMessage::hasInterfaceName(const char *_interface) const {
+ const char *interface = getInterface();
- assert(interfaceName);
- assert(dbusMessageInterfaceName);
+ assert(_interface);
+ assert(interface);
- return !strcmp(dbusMessageInterfaceName, interfaceName);
+ return (!strcmp(interface, _interface));
}
-bool DBusMessage::hasMemberName(const char* memberName) const {
- const char* dbusMessageMemberName = getMemberName();
+bool DBusMessage::hasMemberName(const char *_member) const {
+ const char *member = getMember();
- assert(memberName);
- assert(dbusMessageMemberName);
+ assert(_member);
+ assert(member);
- return !strcmp(dbusMessageMemberName, memberName);
+ return (!strcmp(member, _member));
}
-bool DBusMessage::hasSignature(const char* signature) const {
- const char* dbusMessageSignature = getSignatureString();
+bool DBusMessage::hasSignature(const char *_signature) const {
+ const char *signature = getSignature();
+ assert(_signature);
assert(signature);
- assert(dbusMessageSignature);
- return !strcmp(dbusMessageSignature, signature);
+ return (!strcmp(signature, _signature));
}
const DBusMessage::Type DBusMessage::getType() const {
- const int libdbusType = dbus_message_get_type(libdbusMessage_);
- return static_cast<Type>(libdbusType);
+ return static_cast<Type>(dbus_message_get_type(message_));
}
-char* DBusMessage::getBodyData() const {
- return dbus_message_get_body(libdbusMessage_);
+char * DBusMessage::getBodyData() const {
+ return dbus_message_get_body(message_);
}
int DBusMessage::getBodyLength() const {
- return dbus_message_get_body_length(libdbusMessage_);
+ return dbus_message_get_body_length(message_);
}
int DBusMessage::getBodySize() const {
- return dbus_message_get_body_allocated(libdbusMessage_);
+ return dbus_message_get_body_allocated(message_);
}
-bool DBusMessage::setBodyLength(const int bodyLength) {
- return dbus_message_set_body_length(libdbusMessage_, bodyLength);
+bool DBusMessage::setBodyLength(const int _length) {
+ return 0 != dbus_message_set_body_length(message_, _length);
}
-bool DBusMessage::setDestination(const char* destination)
+bool DBusMessage::setDestination(const char *_destination)
{
- return dbus_message_set_destination(libdbusMessage_, destination);
+ return 0 != dbus_message_set_destination(message_, _destination);
}
-bool DBusMessage::hasObjectPath(const std::string& objectPath) const {
- return hasObjectPath(objectPath.c_str());
+bool DBusMessage::hasObjectPath(const std::string &_path) const {
+ return hasObjectPath(_path.c_str());
}
bool DBusMessage::isInvalidType() const {
diff --git a/src/CommonAPI/DBus/DBusMessage.h b/src/CommonAPI/DBus/DBusMessage.h
deleted file mode 100644
index 66addf3..0000000
--- a/src/CommonAPI/DBus/DBusMessage.h
+++ /dev/null
@@ -1,117 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_MESSAGE_H_
-#define COMMONAPI_DBUS_DBUS_MESSAGE_H_
-
-#include <string>
-
-#include <dbus/dbus.h>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusConnection;
-
-class DBusMessage {
- public:
- DBusMessage();
- DBusMessage(::DBusMessage* libdbusMessage);
- DBusMessage(::DBusMessage* libdbusMessage, bool increaseReferenceCount);
- DBusMessage(const DBusMessage& src);
- DBusMessage(DBusMessage&& src);
-
- ~DBusMessage();
-
- DBusMessage& operator=(const DBusMessage& src);
- DBusMessage& operator=(DBusMessage&& rsrc);
- operator bool() const;
-
- static DBusMessage createOrgFreedesktopOrgMethodCall(const char* methodName,
- const char* signature = NULL);
-
- static DBusMessage createOrgFreedesktopOrgMethodCall(const std::string& methodName,
- const std::string& signature = "");
-
- static DBusMessage createMethodCall(const char* busName,
- const char* objectPath,
- const char* interfaceName,
- const char* methodName,
- const char* signature = NULL);
-
- static DBusMessage createMethodCall(const std::string& busName,
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& methodName,
- const std::string& signature = "");
-
- DBusMessage createMethodReturn(const char* signature = NULL) const;
-
- DBusMessage createMethodReturn(const std::string& signature) const;
-
- DBusMessage createMethodError(const std::string& name, const std::string& reason = "") const;
-
- static DBusMessage createSignal(const char* objectPath,
- const char* interfaceName,
- const char* signalName,
- const char* signature = NULL);
-
- static DBusMessage createSignal(const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& signalName,
- const std::string& signature = "");
-
- const char* getSenderName() const;
- const char* getObjectPath() const;
- const char* getInterfaceName() const;
- const char* getMemberName() const;
- const char* getSignatureString() const;
- const char* getErrorName() const;
- const char* getDestination() const;
-
- bool hasObjectPath(const std::string& objectPath) const;
-
- bool hasObjectPath(const char* objectPath) const;
- bool hasInterfaceName(const char* interfaceName) const;
- bool hasMemberName(const char* memberName) const;
- bool hasSignature(const char* signature) const;
-
- enum class Type: int {
- Invalid = DBUS_MESSAGE_TYPE_INVALID,
- MethodCall = DBUS_MESSAGE_TYPE_METHOD_CALL,
- MethodReturn = DBUS_MESSAGE_TYPE_METHOD_RETURN,
- Error = DBUS_MESSAGE_TYPE_ERROR,
- Signal = DBUS_MESSAGE_TYPE_SIGNAL
- };
- const Type getType() const;
- bool isInvalidType() const;
- bool isMethodCallType() const;
- bool isMethodReturnType() const;
- bool isErrorType() const;
- bool isSignalType() const;
-
- char* getBodyData() const;
- int getBodyLength() const;
- int getBodySize() const;
-
- bool setBodyLength(const int bodyLength);
- bool setDestination(const char* destination);
-
- private:
- ::DBusMessage* libdbusMessage_;
-
- friend class DBusConnection;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_MESSAGE_H_
diff --git a/src/CommonAPI/DBus/DBusMultiEvent.h b/src/CommonAPI/DBus/DBusMultiEvent.h
deleted file mode 100644
index a98dd80..0000000
--- a/src/CommonAPI/DBus/DBusMultiEvent.h
+++ /dev/null
@@ -1,121 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_MULTI_EVENT_H_
-#define COMMONAPI_DBUS_DBUS_MULTI_EVENT_H_
-
-#include <CommonAPI/Event.h>
-
-#include <string>
-#include <unordered_map>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-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;
-
- Subscription subscribeAll(const Listener& listener);
- Subscription subscribe(const std::string& eventName, const Listener& listener);
-
- void unsubscribe(Subscription listenerSubscription);
-
- virtual ~DBusMultiEvent() { }
-
- protected:
- 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 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);
-
- 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...>::subscribe(const std::string& eventName, const Listener& listener) {
- const bool firstListenerAdded = listenersMap_.empty();
-
- auto listenerSubscription = listenersMap_.insert({eventName, listener});
-
- if (firstListenerAdded) {
- onFirstListenerAdded(eventName, listener);
- }
-
- onListenerAdded(eventName, listener);
-
- return listenerSubscription;
-}
-
-template <typename... _Arguments>
-void DBusMultiEvent<_Arguments...>::unsubscribe(Subscription listenerSubscription) {
- const std::string name = listenerSubscription->first;
- const Listener listener = listenerSubscription->second;
-
- listenersMap_.erase(listenerSubscription);
-
- onListenerRemoved(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...);
-
- if (subscriptionStatus == SubscriptionStatus::CANCEL)
- return SubscriptionStatus::CANCEL;
-
- 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;
-}
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_MULTI_EVENT_H_
diff --git a/src/CommonAPI/DBus/DBusObjectManager.cpp b/src/CommonAPI/DBus/DBusObjectManager.cpp
index df43bf0..35a3d4f 100644
--- a/src/CommonAPI/DBus/DBusObjectManager.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManager.cpp
@@ -1,26 +1,23 @@
-/* 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 "DBusObjectManager.h"
-#include "DBusDaemonProxy.h"
-#include "DBusStubAdapter.h"
-#include "DBusOutputStream.h"
-#include "DBusUtils.h"
-
-#include "DBusFreedesktopPropertiesStub.h"
-
-#include <CommonAPI/utils.h>
-
-#include <dbus/dbus-protocol.h>
+// 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 <cassert>
#include <sstream>
-
#include <unordered_set>
+#include <dbus/dbus-protocol.h>
+
+#include <CommonAPI/Utils.hpp>
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusDaemonProxy.hpp>
+#include <CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp>
+#include <CommonAPI/DBus/DBusObjectManager.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusUtils.hpp>
+
namespace CommonAPI {
namespace DBus {
@@ -48,34 +45,36 @@ DBusObjectManager::~DBusObjectManager() {
}
bool DBusObjectManager::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
- const auto& dbusStubAdapterObjectPath = dbusStubAdapter->getObjectPath();
- const auto& dbusStubAdapterInterfaceName = dbusStubAdapter->getInterfaceName();
+ const auto& dbusStubAdapterObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
+ const auto& dbusStubAdapterInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
DBusInterfaceHandlerPath dbusStubAdapterHandlerPath(dbusStubAdapterObjectPath, dbusStubAdapterInterfaceName);
bool isRegistrationSuccessful = false;
objectPathLock_.lock();
isRegistrationSuccessful = addDBusInterfaceHandler(dbusStubAdapterHandlerPath, dbusStubAdapter);
- if(isRegistrationSuccessful && dbusStubAdapter->hasFreedesktopProperties()) {
+ if (isRegistrationSuccessful && dbusStubAdapter->hasFreedesktopProperties()) {
const std::shared_ptr<DBusFreedesktopPropertiesStub> dbusFreedesktopPropertiesStub =
- std::make_shared<DBusFreedesktopPropertiesStub>(dbusStubAdapterObjectPath,
- dbusStubAdapterInterfaceName,
- dbusStubAdapter->getDBusConnection(),
- dbusStubAdapter);
+ std::make_shared<DBusFreedesktopPropertiesStub>(dbusStubAdapterObjectPath,
+ dbusStubAdapterInterfaceName,
+ dbusStubAdapter->getDBusConnection(),
+ dbusStubAdapter);
isRegistrationSuccessful = isRegistrationSuccessful
- && addDBusInterfaceHandler(
- {dbusFreedesktopPropertiesStub->getDBusObjectPath(),
- dbusFreedesktopPropertiesStub->getInterfaceName()
- },
- dbusFreedesktopPropertiesStub);
+ && addDBusInterfaceHandler({ dbusFreedesktopPropertiesStub->getObjectPath(),
+ dbusFreedesktopPropertiesStub->getInterface() },
+ dbusFreedesktopPropertiesStub);
}
- if (isRegistrationSuccessful && dbusStubAdapter->isManagingInterface()) {
+ if (isRegistrationSuccessful && dbusStubAdapter->isManaging()) {
auto managerStubIterator = managerStubs_.find(dbusStubAdapterObjectPath);
const bool managerStubExists = managerStubIterator != managerStubs_.end();
if (!managerStubExists) {
- const std::shared_ptr<DBusObjectManagerStub> newManagerStub = std::make_shared<DBusObjectManagerStub>(dbusStubAdapterObjectPath, dbusStubAdapter->getDBusConnection());
+ const std::shared_ptr<DBusObjectManagerStub> newManagerStub
+ = std::make_shared<DBusObjectManagerStub>(
+ dbusStubAdapterObjectPath,
+ dbusStubAdapter->getDBusConnection()
+ );
auto insertResult = managerStubs_.insert( {dbusStubAdapterObjectPath, {newManagerStub, 1} });
assert(insertResult.second);
managerStubIterator = insertResult.first;
@@ -109,15 +108,15 @@ bool DBusObjectManager::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter>
bool DBusObjectManager::unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
- const auto& dbusStubAdapterObjectPath = dbusStubAdapter->getObjectPath();
- const auto& dbusStubAdapterInterfaceName = dbusStubAdapter->getInterfaceName();
+ const auto& dbusStubAdapterObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
+ const auto& dbusStubAdapterInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
DBusInterfaceHandlerPath dbusStubAdapterHandlerPath(dbusStubAdapterObjectPath, dbusStubAdapterInterfaceName);
bool isDeregistrationSuccessful = false;
objectPathLock_.lock();
isDeregistrationSuccessful = removeDBusInterfaceHandler(dbusStubAdapterHandlerPath, dbusStubAdapter);
- if (isDeregistrationSuccessful && dbusStubAdapter->isManagingInterface()) {
+ if (isDeregistrationSuccessful && dbusStubAdapter->isManaging()) {
auto managerStubIterator = managerStubs_.find(dbusStubAdapterObjectPath);
assert(managerStubIterator != managerStubs_.end());
@@ -155,7 +154,7 @@ bool DBusObjectManager::exportManagedDBusStubAdapter(const std::string& parentOb
assert(foundManagerStubIterator != managerStubs_.end());
if (std::get<0>(foundManagerStubIterator->second)->exportManagedDBusStubAdapter(dbusStubAdapter)) {
- //XXX Other handling necessary?
+ // TODO Check if other handling is necessary?
return true;
}
return false;
@@ -168,7 +167,7 @@ bool DBusObjectManager::unexportManagedDBusStubAdapter(const std::string& parent
assert(foundManagerStubIterator != managerStubs_.end());
if (std::get<0>(foundManagerStubIterator->second)->unexportManagedDBusStubAdapter(dbusStubAdapter)) {
- //XXX Other handling necessary?
+ // Check if other handling is necessary?
return true;
}
return false;
@@ -177,7 +176,7 @@ bool DBusObjectManager::unexportManagedDBusStubAdapter(const std::string& parent
bool DBusObjectManager::handleMessage(const DBusMessage& dbusMessage) {
const char* objectPath = dbusMessage.getObjectPath();
- const char* interfaceName = dbusMessage.getInterfaceName();
+ const char* interfaceName = dbusMessage.getInterface();
assert(objectPath);
assert(interfaceName);
@@ -322,7 +321,6 @@ bool DBusObjectManager::onIntrospectableInterfaceDBusMessage(const DBusMessage&
return false;
}
-
std::shared_ptr<DBusObjectManagerStub> DBusObjectManager::getRootDBusObjectManagerStub() {
return rootDBusObjectManagerStub_;
}
diff --git a/src/CommonAPI/DBus/DBusObjectManager.h b/src/CommonAPI/DBus/DBusObjectManager.h
deleted file mode 100644
index 6ce6e6c..0000000
--- a/src/CommonAPI/DBus/DBusObjectManager.h
+++ /dev/null
@@ -1,72 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_
-#define COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_
-
-#include "DBusProxyConnection.h"
-#include "DBusMessage.h"
-#include "DBusObjectManagerStub.h"
-
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusStubAdapter;
-class DBusInterfaceHandler;
-
-class DBusObjectManager {
- public:
- DBusObjectManager(const std::shared_ptr<DBusProxyConnection>&);
- ~DBusObjectManager();
-
- bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
-
- //Zusammenfassbar mit "registerDBusStubAdapter"?
- bool exportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- bool unexportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
-
- bool handleMessage(const DBusMessage&);
-
- std::shared_ptr<DBusObjectManagerStub> getRootDBusObjectManagerStub();
-
- private:
- // objectPath, interfaceName
- typedef std::pair<std::string, std::string> DBusInterfaceHandlerPath;
-
- bool addDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
- std::shared_ptr<DBusInterfaceHandler> dbusInterfaceHandler);
-
- bool removeDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
- std::shared_ptr<DBusInterfaceHandler> dbusInterfaceHandler);
-
- bool onIntrospectableInterfaceDBusMessage(const DBusMessage& callMessage);
- bool onFreedesktopPropertiesDBusMessage(const DBusMessage& callMessage);
-
-
- typedef std::unordered_map<DBusInterfaceHandlerPath, std::shared_ptr<DBusInterfaceHandler>> DBusRegisteredObjectsTable;
- DBusRegisteredObjectsTable dbusRegisteredObjectsTable_;
-
- std::shared_ptr<DBusObjectManagerStub> rootDBusObjectManagerStub_;
-
- typedef std::pair<std::shared_ptr<DBusObjectManagerStub>, uint32_t> ReferenceCountedDBusObjectManagerStub;
- typedef std::unordered_map<std::string, ReferenceCountedDBusObjectManagerStub> RegisteredObjectManagersTable;
- RegisteredObjectManagersTable managerStubs_;
-
- std::weak_ptr<DBusProxyConnection> dbusConnection_;
- std::recursive_mutex objectPathLock_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_
diff --git a/src/CommonAPI/DBus/DBusObjectManagerStub.cpp b/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
index 970f366..e292473 100644
--- a/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
@@ -1,17 +1,16 @@
-/* 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 "DBusObjectManagerStub.h"
-#include "DBusStubAdapter.h"
-#include "DBusServicePublisher.h"
-#include "DBusOutputStream.h"
+// 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 <cassert>
#include <vector>
+#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusTypes.hpp>
+
namespace CommonAPI {
namespace DBus {
@@ -30,11 +29,12 @@ DBusObjectManagerStub::~DBusObjectManagerStub() {
for (auto& dbusInterfaceIterator : registeredDBusInterfacesMap) {
auto managedDBusStubAdapter = dbusInterfaceIterator.second;
- auto managedDBusStubAdapterServiceAddress = managedDBusStubAdapter->getAddress();
-
+ auto managedDBusStubAdapterServiceAddress = managedDBusStubAdapter->getDBusAddress();
+#ifdef LB_TODO
const bool isServiceUnregistered = DBusServicePublisher::getInstance()->unregisterManagedService(
managedDBusStubAdapterServiceAddress);
assert(isServiceUnregistered);
+#endif
}
}
}
@@ -88,8 +88,8 @@ bool DBusObjectManagerStub::unexportManagedDBusStubAdapter(std::shared_ptr<DBusS
bool DBusObjectManagerStub::isDBusStubAdapterExported(std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
assert(dbusStubAdapter);
- const auto& dbusObjectPath = dbusStubAdapter->getObjectPath();
- const auto& dbusInterfaceName = dbusStubAdapter->getInterfaceName();
+ const auto& dbusObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
+ const auto& dbusInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
std::lock_guard<std::mutex> dbusObjectManagerStubLock(dbusObjectManagerStubLock_);
@@ -113,8 +113,8 @@ bool DBusObjectManagerStub::isDBusStubAdapterExported(std::shared_ptr<DBusStubAd
}
bool DBusObjectManagerStub::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
- const auto& dbusObjectPath = dbusStubAdapter->getObjectPath();
- const auto& dbusInterfaceName = dbusStubAdapter->getInterfaceName();
+ const auto& dbusObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
+ const auto& dbusInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
const auto& registeredDBusObjectPathIterator = registeredDBusObjectPathsMap_.find(dbusObjectPath);
const bool isKnownDBusObjectPath = (registeredDBusObjectPathIterator != registeredDBusObjectPathsMap_.end());
bool isRegisterationSuccessful = false;
@@ -139,8 +139,8 @@ bool DBusObjectManagerStub::registerDBusStubAdapter(std::shared_ptr<DBusStubAdap
}
bool DBusObjectManagerStub::unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
- const auto& dbusObjectPath = dbusStubAdapter->getObjectPath();
- const auto& dbusInterfaceName = dbusStubAdapter->getInterfaceName();
+ const auto& dbusObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
+ const auto& dbusInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
const auto& registeredDBusObjectPathIterator = registeredDBusObjectPathsMap_.find(dbusObjectPath);
const bool isKnownDBusObjectPath = (registeredDBusObjectPathIterator != registeredDBusObjectPathsMap_.end());
@@ -174,15 +174,15 @@ bool DBusObjectManagerStub::emitInterfacesAddedSignal(std::shared_ptr<DBusStubAd
assert(dbusConnection);
assert(dbusConnection->isConnected());
- const auto& dbusStubObjectPath = dbusStubAdapter->getObjectPath();
- const auto& dbusStubInterfaceName = dbusStubAdapter->getInterfaceName();
+ const auto& dbusStubObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
+ const auto& dbusStubInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
DBusMessage dbusSignal = DBusMessage::createSignal(dbusObjectPath_, getInterfaceName(), "InterfacesAdded", "oa{sa{sv}}");
DBusOutputStream dbusOutputStream(dbusSignal);
DBusInterfacesAndPropertiesDict dbusInterfacesAndPropertiesDict({
{ dbusStubInterfaceName, DBusPropertiesChangedDict() }
});
- if (dbusStubAdapter->isManagingInterface()) {
+ if (dbusStubAdapter->isManaging()) {
dbusInterfacesAndPropertiesDict.insert({ getInterfaceName(), DBusPropertiesChangedDict() });
}
@@ -203,13 +203,13 @@ bool DBusObjectManagerStub::emitInterfacesRemovedSignal(std::shared_ptr<DBusStub
assert(dbusConnection);
assert(dbusConnection->isConnected());
- const auto& dbusStubObjectPath = dbusStubAdapter->getObjectPath();
- const auto& dbusStubInterfaceName = dbusStubAdapter->getInterfaceName();
+ const auto& dbusStubObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
+ const auto& dbusStubInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
DBusMessage dbusSignal = DBusMessage::createSignal(dbusObjectPath_, getInterfaceName(), "InterfacesRemoved", "oas");
DBusOutputStream dbusOutputStream(dbusSignal);
std::vector<std::string> removedInterfaces({ { dbusStubInterfaceName } });
- if (dbusStubAdapter->isManagingInterface()) {
+ if (dbusStubAdapter->isManaging()) {
removedInterfaces.push_back(getInterfaceName());
}
@@ -265,7 +265,7 @@ bool DBusObjectManagerStub::onInterfaceDBusMessage(const DBusMessage& dbusMessag
dbusInterfacesAndPropertiesDict.insert({ registeredDBusInterfaceName, DBusPropertiesChangedDict() });
- if (registeredDBusStubAdapter->isManagingInterface()) {
+ if (registeredDBusStubAdapter->isManaging()) {
dbusInterfacesAndPropertiesDict.insert({ getInterfaceName(), DBusPropertiesChangedDict() });
}
}
diff --git a/src/CommonAPI/DBus/DBusObjectManagerStub.h b/src/CommonAPI/DBus/DBusObjectManagerStub.h
deleted file mode 100644
index 7de54f2..0000000
--- a/src/CommonAPI/DBus/DBusObjectManagerStub.h
+++ /dev/null
@@ -1,127 +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_DBUS_DBUS_FREEDESKTOP_OBJECT_MANAGER_STUB_H_
-#define COMMONAPI_DBUS_DBUS_FREEDESKTOP_OBJECT_MANAGER_STUB_H_
-
-
-#include "DBusInterfaceHandler.h"
-
-#include <memory>
-#include <mutex>
-#include <string>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusStubAdapter;
-
-/**
- * Stub for standard <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">org.freedesktop.dbus.ObjectManager</a> interface.
- *
- * Instantiated within a manager stub and it must hold reference to all registered objects.
- * Whenever the manager gets destroyed all references to registered objects are lost too.
- * This duplicates the semantic of the CommonAPI::ServicePublisher class.
- *
- * Only one DBusStubAdapter instance could be registered per DBusObjectManagerStub instance.
- *
- * The owner of the DBusObjectManagerStub instance must take care of registering and unregistering it.
- *
- * Example stub life cycle:
- * - create CommonAPI::ServicePublisher
- * - create stub A
- * - register stub A to CommonAPI::ServicePublisher
- * - create stub B
- * - register stub B with stub A as object manager
- * - drop all references to stub B, stub A keeps a reference to stub B
- * - drop all references to stub A, CommonAPI::ServicePublisher keeps a reference to stub A
- * - reference overview: Application > CommonAPI::ServicePublisher > Stub A > Stub B
- * - drop all references to CommonAPI::ServicePublisher causes all object references to be dropped
- */
-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;
-
- public:
- DBusObjectManagerStub(const std::string& dbusObjectPath, const std::shared_ptr<DBusProxyConnection>&);
-
- /**
- * Unregisters all currently registered DBusStubAdapter instances from the DBusServicePublisher
- */
- virtual ~DBusObjectManagerStub();
-
- /**
- * Export DBusStubAdapter instance with the current DBusObjectManagerStub instance.
- *
- * The DBusStubAdapter must be registered with the DBusServicePublisher!
- *
- * On registering a
- * <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">InsterfaceAdded</a>
- * signal will be emitted with the DBusObjectManagerStub instance's current D-Bus object path.
- *
- * @param dbusStubAdapter a refernce to DBusStubAdapter instance
- *
- * @return false if the @a dbusStubAdapter instance was already registered
- * @return false if sending the InterfaceAdded signal fails
- *
- * @see ~DBusObjectManagerStub()
- * @see CommonAPI::ServicePublisher
- * @see DBusObjectManager
- */
- bool exportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
-
- /**
- * Unexport DBusStubAdapter instance from this DBusObjectManagerStub instance.
- *
- * On unregistering a
- * <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">InsterfaceRemoved</a>
- * signal will be emitted with the DBusObjectManagerStub instance's current D-Bus object path.
- *
- * @param dbusStubAdapter
- *
- * @return false if @a dbusStubAdapter wasn't registered
- * @return true even if sending the InterfaceRemoved signal fails
- *
- * @see exportDBusStubAdapter()
- */
- bool unexportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
-
- bool isDBusStubAdapterExported(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
-
- const std::string& getDBusObjectPath() const;
- static const char* getInterfaceName();
-
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
- virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage);
- virtual const bool hasFreedesktopProperties();
-
- private:
- bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
-
- bool emitInterfacesAddedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection) const;
-
- bool emitInterfacesRemovedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection) const;
-
- std::string dbusObjectPath_;
- std::weak_ptr<DBusProxyConnection> dbusConnection_;
-
- typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> DBusInterfacesMap;
- typedef std::unordered_map<std::string, DBusInterfacesMap> DBusObjectPathsMap;
- DBusObjectPathsMap registeredDBusObjectPathsMap_;
-
- std::mutex dbusObjectManagerStubLock_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_FREEDESKTOP_OBJECT_MANAGER_STUB_H_
diff --git a/src/CommonAPI/DBus/DBusOutputStream.cpp b/src/CommonAPI/DBus/DBusOutputStream.cpp
index 4dfc9fa..7d59360 100644
--- a/src/CommonAPI/DBus/DBusOutputStream.cpp
+++ b/src/CommonAPI/DBus/DBusOutputStream.cpp
@@ -1,297 +1,53 @@
-/* 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 "DBusOutputStream.h"
+// 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/.
-namespace CommonAPI {
-namespace DBus {
+//#define COMMONAPI_DBUS_DEBUG_SERIALIZATION
-DBusOutputStream::DBusOutputStream(DBusMessage dbusMessage) :
- dbusMessage_(dbusMessage) {
-}
+#ifdef COMMONAPI_DBUS_DEBUG_SERIALIZATION
+#include <iomanip>
+#include <sstream>
+#endif
-DBusOutputStream::~DBusOutputStream() {}
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
-OutputStream& DBusOutputStream::writeValue(const bool& boolValue) {
- alignToBoundary(4);
- writeBasicTypeValue(boolValue);
- alignToBoundary(4);
- return *this;
-}
-
-OutputStream& DBusOutputStream::writeValue(const int8_t& int8Value) {
- return writeBasicTypeValue(int8Value);
-}
-OutputStream& DBusOutputStream::writeValue(const int16_t& int16Value) {
- return writeBasicTypeValue(int16Value);
-}
-OutputStream& DBusOutputStream::writeValue(const int32_t& int32Value) {
- return writeBasicTypeValue(int32Value);
-}
-OutputStream& DBusOutputStream::writeValue(const int64_t& int64Value) {
- return writeBasicTypeValue(int64Value);
-}
-
-OutputStream& DBusOutputStream::writeValue(const uint8_t& uint8Value) {
- return writeBasicTypeValue(uint8Value);
-}
-OutputStream& DBusOutputStream::writeValue(const uint16_t& uint16Value) {
- return writeBasicTypeValue(uint16Value);
-}
-OutputStream& DBusOutputStream::writeValue(const uint32_t& uint32Value) {
- return writeBasicTypeValue(uint32Value);
-}
-OutputStream& DBusOutputStream::writeValue(const uint64_t& uint64Value) {
- return writeBasicTypeValue(uint64Value);
-}
-
-OutputStream& DBusOutputStream::writeValue(const float& floatValue) {
- return writeBasicTypeValue((double) floatValue);
-}
-OutputStream& DBusOutputStream::writeValue(const double& doubleValue) {
- return writeBasicTypeValue(doubleValue);
-}
-
-OutputStream& DBusOutputStream::writeValue(const std::string& stringValue) {
- return writeString(stringValue.c_str(), stringValue.length());
-}
-
-OutputStream& DBusOutputStream::writeValue(const ByteBuffer& byteBufferValue) {
- return *this;
-}
-
-OutputStream& DBusOutputStream::writeEnumValue(const int8_t& int8BackingTypeValue) {
- return writeValue(int8BackingTypeValue);
-}
-OutputStream& DBusOutputStream::writeEnumValue(const int16_t& int16BackingTypeValue) {
- return writeValue(int16BackingTypeValue);
-}
-OutputStream& DBusOutputStream::writeEnumValue(const int32_t& int32BackingTypeValue) {
- return writeValue(int32BackingTypeValue);
-}
-OutputStream& DBusOutputStream::writeEnumValue(const int64_t& int64BackingTypeValue) {
- return writeValue(int64BackingTypeValue);
-}
-OutputStream& DBusOutputStream::writeEnumValue(const uint8_t& uint8BackingTypeValue) {
- return writeValue(uint8BackingTypeValue);
-}
-OutputStream& DBusOutputStream::writeEnumValue(const uint16_t& uint16BackingTypeValue) {
- return writeValue(uint16BackingTypeValue);
-}
-OutputStream& DBusOutputStream::writeEnumValue(const uint32_t& uint32BackingTypeValue) {
- return writeValue(uint32BackingTypeValue);
-}
-OutputStream& DBusOutputStream::writeEnumValue(const uint64_t& uint64BackingTypeValue) {
- return writeValue(uint64BackingTypeValue);
-}
-
-void DBusOutputStream::beginWriteBoolVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteInt8Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteInt16Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteInt32Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteInt64Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt8Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt16Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt32Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt64Vector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteFloatVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteDoubleVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteStringVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteByteBufferVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteVersionVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-
-void DBusOutputStream::beginWriteInt8EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteInt16EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteInt32EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteInt64EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt8EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt16EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt32EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteUInt64EnumVector(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-
-void DBusOutputStream::beginWriteVectorOfSerializableStructs(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteVectorOfSerializableVariants(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteVectorOfVectors(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- rememberCurrentStreamPosition();
-}
-void DBusOutputStream::beginWriteVectorOfMaps(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(4);
- rememberCurrentStreamPosition();
-}
-
-void DBusOutputStream::beginWriteVectorOfSerializablePolymorphicStructs(uint32_t sizeOfVector) {
- beginWriteGenericVector();
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
-
-void DBusOutputStream::endWriteVector() {
- uint32_t numOfWrittenBytes = getCurrentStreamPosition() - popRememberedStreamPosition();
- writeBasicTypeValueAtPosition(popRememberedStreamPosition(), numOfWrittenBytes);
-}
-
-OutputStream& DBusOutputStream::writeVersionValue(const Version& versionValue) {
- alignToBoundary(8);
- writeValue(versionValue.Major);
- writeValue(versionValue.Minor);
- return *this;
-}
-
-void DBusOutputStream::beginWriteSerializableStruct(const SerializableStruct& serializableStruct) {
- alignToBoundary(8);
-}
-void DBusOutputStream::endWriteSerializableStruct(const SerializableStruct& serializableStruct) {
-}
-
-void DBusOutputStream::beginWriteSerializablePolymorphicStruct(const std::shared_ptr<SerializablePolymorphicStruct>& serializableStruct) {
- alignToBoundary(8);
- writeValue(serializableStruct->getSerialId());
-
- DBusTypeOutputStream typeOutputStream;
- typeOutputStream.beginWriteStructType();
- serializableStruct->createTypeSignature(typeOutputStream);
- typeOutputStream.endWriteStructType();
-
- writeSignature(std::move(typeOutputStream.retrieveSignature()));
-
- beginWriteSerializableStruct(*serializableStruct);
-}
-
-void DBusOutputStream::endWriteSerializablePolymorphicStruct(const std::shared_ptr<SerializablePolymorphicStruct>& serializableStruct) {
- endWriteSerializableStruct(*serializableStruct);
-}
-
-void DBusOutputStream::beginWriteMap(size_t elementCount) {
- alignToBoundary(sizeof(uint32_t));
- rememberCurrentStreamPosition();
- writeBasicTypeValue((uint32_t) 0);
- alignToBoundary(8);
- rememberCurrentStreamPosition();
-}
+namespace CommonAPI {
+namespace DBus {
-void DBusOutputStream::endWriteMap() {
- uint32_t numOfWrittenBytes = getCurrentStreamPosition() - popRememberedStreamPosition();
- writeBasicTypeValueAtPosition(popRememberedStreamPosition(), numOfWrittenBytes);
+DBusOutputStream::DBusOutputStream(DBusMessage dbusMessage)
+ : dbusMessage_(dbusMessage) {
}
-void DBusOutputStream::beginWriteMapElement() {
- alignToBoundary(8);
+// Internal
+size_t DBusOutputStream::getPosition() {
+ return payload_.size();
}
-void DBusOutputStream::endWriteMapElement() {
-}
-
-void DBusOutputStream::beginWriteSerializableVariant(const SerializableVariant& serializableVariant) {
- alignToBoundary(8);
- writeValue(serializableVariant.getValueType());
- DBusTypeOutputStream typeOutputStream;
- serializableVariant.writeToTypeOutputStream(typeOutputStream);
- writeSignature(std::move(typeOutputStream.retrieveSignature()));
+void DBusOutputStream::pushPosition() {
+ positions_.push(payload_.size());
}
-void DBusOutputStream::endWriteSerializableVariant(const SerializableVariant& serializableVariant) {
+size_t DBusOutputStream::popPosition() {
+ size_t itsPosition = positions_.top();
+ positions_.pop();
+ return itsPosition;
}
+// TODO Check where dbusError_ is set
bool DBusOutputStream::hasError() const {
return dbusError_;
}
-/**
- * Writes the data that was buffered within this #DBusOutputMessageStream to the #DBusMessage that was given to the constructor. Each call to flush()
- * 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().
- */
+// Writes the data that was buffered within this #DBusOutputMessageStream to
+// the #DBusMessage that was given to the constructor. Each call to flush()
+// 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().
void DBusOutputStream::flush() {
const int toWrite = payload_.size();
dbusMessage_.setBodyLength(toWrite);
char* destinationDataPtr = dbusMessage_.getBodyData();
-
memcpy(destinationDataPtr, payload_.c_str(), toWrite);
}
@@ -299,8 +55,10 @@ void DBusOutputStream::setError() {
}
/**
- * Reserves the given number of bytes for writing, thereby negating the need to dynamically allocate memory while writing.
- * Use this method for optimization: If possible, reserve as many bytes as you need for your data before doing any writing.
+ * Reserves the given number of bytes for writing, thereby negating the need to
+ * dynamically allocate memory while writing. Use this method for optimization:
+ * If possible, reserve as many bytes as you need for your data before doing
+ * any writing.
*
* @param numOfBytes The number of bytes that should be reserved for writing.
*/
@@ -309,49 +67,35 @@ void DBusOutputStream::reserveMemory(size_t numOfBytes) {
payload_.reserve(numOfBytes);
}
-DBusOutputStream& DBusOutputStream::writeString(const char* cString, const uint32_t& length) {
- assert(cString != NULL);
- assert(cString[length] == '\0');
-
- *this << length;
+DBusOutputStream& DBusOutputStream::writeString(const char *_value, const uint32_t &_length) {
+ assert(_value != NULL);
+ assert(_value[_length] == '\0');
- writeRawData(cString, length + 1);
+ _writeValue(_length);
+ _writeRaw(_value, _length + 1);
- return *this;
+ return (*this);
}
-//Additional 0-termination, so this is 8 byte of \0
+// Additional 0-termination, so this is 8 byte of \0
static const char eightByteZeroString[] = "\0\0\0\0\0\0\0";
-void DBusOutputStream::alignToBoundary(const size_t alignBoundary) {
- assert(alignBoundary > 0 && alignBoundary <= 8 && (alignBoundary % 2 == 0 || alignBoundary == 1));
+void DBusOutputStream::align(const size_t _boundary) {
+ assert(_boundary > 0 && _boundary <= 8 &&
+ (_boundary % 2 == 0 || _boundary == 1));
- size_t alignMask = alignBoundary - 1;
- size_t necessaryAlignment = ((alignMask - (payload_.size() & alignMask)) + 1) & alignMask;
+ size_t mask = _boundary - 1;
+ size_t necessary = ((mask - (payload_.size() & mask)) + 1) & mask;
- writeRawData(eightByteZeroString, necessaryAlignment);
+ _writeRaw(eightByteZeroString, necessary);
}
-bool DBusOutputStream::writeRawData(const char* rawDataPtr, const size_t sizeInByte) {
- assert(sizeInByte >= 0);
-
- payload_.append(rawDataPtr, sizeInByte);
-
- return true;
-}
-
-bool DBusOutputStream::writeRawDataAtPosition(size_t position, const char* rawDataPtr, const size_t sizeInByte) {
- assert(sizeInByte >= 0);
-
- payload_ = payload_.replace(position, sizeInByte, rawDataPtr, sizeInByte);
-
- return true;
+void DBusOutputStream::_writeRaw(const char *_data, const size_t _size) {
+ payload_.append(_data, _size);
}
-void DBusOutputStream::beginWriteGenericVector() {
- alignToBoundary(sizeof(uint32_t));
- rememberCurrentStreamPosition();
- writeBasicTypeValue((uint32_t) 0);
+void DBusOutputStream::_writeRawAt(const char *_data, const size_t _size, size_t _position) {
+ payload_ = payload_.replace(_position, _size, _data, _size);
}
void DBusOutputStream::writeSignature(const std::string& signature) {
@@ -359,22 +103,8 @@ void DBusOutputStream::writeSignature(const std::string& signature) {
assert(signatureLength > 0 && signatureLength < 256);
const uint8_t wireLength = (uint8_t) signatureLength;
- *this << wireLength;
- writeRawData(signature.c_str(), wireLength + 1);
-}
-
-void DBusOutputStream::rememberCurrentStreamPosition() {
- savedStreamPositions_.push(payload_.size());
-}
-
-size_t DBusOutputStream::popRememberedStreamPosition() {
- size_t val = savedStreamPositions_.top();
- savedStreamPositions_.pop();
- return val;
-}
-
-size_t DBusOutputStream::getCurrentStreamPosition() {
- return payload_.size();
+ (*this) << wireLength;
+ _writeRaw(signature.c_str(), wireLength + 1);
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusOutputStream.h b/src/CommonAPI/DBus/DBusOutputStream.h
deleted file mode 100644
index 51e5f2f..0000000
--- a/src/CommonAPI/DBus/DBusOutputStream.h
+++ /dev/null
@@ -1,351 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_OUTPUT_MESSAGE_STREAM_H_
-#define COMMONAPI_DBUS_DBUS_OUTPUT_MESSAGE_STREAM_H_
-
-#include "DBusMessage.h"
-#include "DBusError.h"
-
-#include <CommonAPI/OutputStream.h>
-
-#include <string>
-#include <cstring>
-#include <vector>
-#include <cassert>
-#include <stack>
-#include <memory>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusTypeOutputStream: public TypeOutputStream {
-public:
- DBusTypeOutputStream() :
- signature_("") {
-
- }
- virtual ~DBusTypeOutputStream() {}
-
- virtual void writeBoolType() {
- signature_.append("b");
- }
-
- virtual void writeInt8Type() {
- signature_.append("y");
- }
- virtual void writeInt16Type() {
- signature_.append("n");
- }
- virtual void writeInt32Type() {
- signature_.append("i");
- }
- virtual void writeInt64Type() {
- signature_.append("x");
- }
-
- virtual void writeUInt8Type() {
- signature_.append("y");
- }
- virtual void writeUInt16Type() {
- signature_.append("q");
- }
- virtual void writeUInt32Type() {
- signature_.append("u");
- }
- virtual void writeUInt64Type() {
- signature_.append("t");
- }
-
- virtual void writeInt8EnumType() {
- signature_.append("y");
- }
- virtual void writeInt16EnumType() {
- signature_.append("n");
- }
- virtual void writeInt32EnumType() {
- signature_.append("i");
- }
- virtual void writeInt64EnumType() {
- signature_.append("x");
- }
-
- virtual void writeUInt8EnumType() {
- signature_.append("y");
- }
- virtual void writeUInt16EnumType() {
- signature_.append("n");
- }
- virtual void writeUInt32EnumType() {
- signature_.append("u");
- }
- virtual void writeUInt64EnumType() {
- signature_.append("t");
- }
-
- virtual void writeFloatType() {
- signature_.append("d");
- }
- virtual void writeDoubleType() {
- signature_.append("d");
- }
-
- virtual void writeStringType() {
- signature_.append("s");
- }
- virtual void writeByteBufferType() {
- signature_.append("ay");
- }
- virtual void writeVersionType() {
- signature_.append("(uu)");
- }
-
- virtual void beginWriteStructType() {
- signature_.append("(");
- }
- virtual void endWriteStructType() {
- signature_.append(")");
- }
-
- virtual void beginWriteMapType() {
- signature_.append("a{");
- }
- virtual void endWriteMapType() {
- signature_.append("}");
- }
-
- virtual void beginWriteVectorType() {
- signature_.append("a");
- }
-
- virtual void endWriteVectorType() {
- }
-
- virtual void writeVariantType() {
- signature_.append("(yv)");
- }
-
- void writeLegacyVariantType() {
- signature_.append("v");
- }
-
- virtual std::string retrieveSignature() {
- return std::move(signature_);
- }
-
-private:
- std::string signature_;
-};
-
-/**
- * Used to mark the position of a pointer within an array of bytes.
- */
-typedef uint32_t position_t;
-
-/**
- * @class DBusOutputMessageStream
- *
- * Used to serialize and write data into a #DBusMessage. For all data types that may be written to a #DBusMessage, a "<<"-operator should be defined to handle the writing
- * (this operator is predefined for all basic data types and for vectors). The signature that has to be written to the #DBusMessage separately is assumed
- * to match the actual data that is inserted via the #DBusOutputMessageStream.
- */
-class DBusOutputStream: public OutputStream {
-public:
-
- /**
- * Creates a #DBusOutputMessageStream which can be used to serialize and write data into the given #DBusMessage. Any data written is buffered within the stream.
- * Remember to call flush() when you are done with writing: Only then the data actually is written to the #DBusMessage.
- *
- * @param dbusMessage The #DBusMessage any data pushed into this stream should be written to.
- */
- DBusOutputStream(DBusMessage dbusMessage);
-
- /**
- * 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, e.g. in order to send it,
- * now that you have written some payload into it.
- */
- virtual ~DBusOutputStream();
-
- virtual OutputStream& writeValue(const bool& boolValue);
-
- virtual OutputStream& writeValue(const int8_t& int8Value);
- virtual OutputStream& writeValue(const int16_t& int16Value);
- virtual OutputStream& writeValue(const int32_t& int32Value);
- virtual OutputStream& writeValue(const int64_t& int64Value);
-
- virtual OutputStream& writeValue(const uint8_t& uint8Value);
- virtual OutputStream& writeValue(const uint16_t& uint16Value);
- virtual OutputStream& writeValue(const uint32_t& uint32Value);
- virtual OutputStream& writeValue(const uint64_t& uint64Value);
-
- virtual OutputStream& writeValue(const float& floatValue);
- virtual OutputStream& writeValue(const double& doubleValue);
-
- virtual OutputStream& writeValue(const std::string& stringValue);
-
- virtual OutputStream& writeValue(const ByteBuffer& byteBufferValue);
-
- virtual OutputStream& writeEnumValue(const int8_t& int8BackingTypeValue);
- virtual OutputStream& writeEnumValue(const int16_t& int16BackingTypeValue);
- virtual OutputStream& writeEnumValue(const int32_t& int32BackingTypeValue);
- virtual OutputStream& writeEnumValue(const int64_t& int64BackingTypeValue);
- virtual OutputStream& writeEnumValue(const uint8_t& uint8BackingTypeValue);
- virtual OutputStream& writeEnumValue(const uint16_t& uint16BackingTypeValue);
- virtual OutputStream& writeEnumValue(const uint32_t& uint32BackingTypeValue);
- virtual OutputStream& writeEnumValue(const uint64_t& uint64BackingTypeValue);
-
- virtual void beginWriteBoolVector(uint32_t sizeOfVector);
- virtual void beginWriteInt8Vector(uint32_t sizeOfVector);
- virtual void beginWriteInt16Vector(uint32_t sizeOfVector);
- virtual void beginWriteInt32Vector(uint32_t sizeOfVector);
- virtual void beginWriteInt64Vector(uint32_t sizeOfVector);
- virtual void beginWriteUInt8Vector(uint32_t sizeOfVector);
- virtual void beginWriteUInt16Vector(uint32_t sizeOfVector);
- virtual void beginWriteUInt32Vector(uint32_t sizeOfVector);
- virtual void beginWriteUInt64Vector(uint32_t sizeOfVector);
- virtual void beginWriteFloatVector(uint32_t sizeOfVector);
- virtual void beginWriteDoubleVector(uint32_t sizeOfVector);
- virtual void beginWriteStringVector(uint32_t sizeOfVector);
- virtual void beginWriteByteBufferVector(uint32_t sizeOfVector);
- virtual void beginWriteVersionVector(uint32_t sizeOfVector);
-
- virtual void beginWriteInt8EnumVector(uint32_t sizeOfVector);
- virtual void beginWriteInt16EnumVector(uint32_t sizeOfVector);
- virtual void beginWriteInt32EnumVector(uint32_t sizeOfVector);
- virtual void beginWriteInt64EnumVector(uint32_t sizeOfVector);
- virtual void beginWriteUInt8EnumVector(uint32_t sizeOfVector);
- virtual void beginWriteUInt16EnumVector(uint32_t sizeOfVector);
- virtual void beginWriteUInt32EnumVector(uint32_t sizeOfVector);
- virtual void beginWriteUInt64EnumVector(uint32_t sizeOfVector);
-
- virtual void beginWriteVectorOfSerializableStructs(uint32_t sizeOfVector);
- virtual void beginWriteVectorOfSerializableVariants(uint32_t sizeOfVector);
- virtual void beginWriteVectorOfVectors(uint32_t sizeOfVector);
- virtual void beginWriteVectorOfMaps(uint32_t sizeOfVector);
-
- virtual void beginWriteVectorOfSerializablePolymorphicStructs(uint32_t sizeOfVector);
-
- virtual void endWriteVector();
-
- virtual OutputStream& writeVersionValue(const Version& versionValue);
-
- virtual void beginWriteSerializableStruct(const SerializableStruct& serializableStruct);
- virtual void endWriteSerializableStruct(const SerializableStruct& serializableStruct);
-
- virtual void beginWriteSerializablePolymorphicStruct(const std::shared_ptr<SerializablePolymorphicStruct>& serializableStruct);
- virtual void endWriteSerializablePolymorphicStruct(const std::shared_ptr<SerializablePolymorphicStruct>& serializableStruct);
-
- virtual void beginWriteMap(size_t elementCount);
- virtual void endWriteMap();
- virtual void beginWriteMapElement();
- virtual void endWriteMapElement();
-
- virtual void beginWriteSerializableVariant(const SerializableVariant& serializableVariant);
-
- virtual void endWriteSerializableVariant(const SerializableVariant& serializableVariant);
-
- virtual bool hasError() const;
-
- /**
- * Writes the data that was buffered within this #DBusOutputMessageStream to the #DBusMessage that was given to the constructor. Each call to flush()
- * 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().
- */
- void flush();
-
- void setError();
-
- /**
- * Reserves the given number of bytes for writing, thereby negating the need to dynamically allocate memory while writing.
- * Use this method for optimization: If possible, reserve as many bytes as you need for your data before doing any writing.
- *
- * @param numOfBytes The number of bytes that should be reserved for writing.
- */
- void reserveMemory(size_t numOfBytes);
-
- template<typename _BasicType>
- DBusOutputStream& writeBasicTypeValue(const _BasicType& basicValue) {
- if (sizeof(_BasicType) > 1)
- alignToBoundary(sizeof(_BasicType));
-
- writeRawData(reinterpret_cast<const char*>(&basicValue), sizeof(_BasicType));
-
- return *this;
- }
-
- template<typename _BasicType>
- bool writeBasicTypeValueAtPosition(size_t position, const _BasicType& basicValue) {
- assert(position + sizeof(_BasicType) <= payload_.size());
-
- return writeRawDataAtPosition(position, reinterpret_cast<const char*>(&basicValue), sizeof(_BasicType));
- }
-
- DBusOutputStream& writeString(const char* cString, const uint32_t& length);
-
- /**
- * Fills the stream with 0-bytes to make the next value be aligned to the boundary given.
- * This means that as many 0-bytes are written to the buffer as are necessary
- * to make the next value start with the given alignment.
- *
- * @param alignBoundary The byte-boundary to which the next value should be aligned.
- */
- virtual void alignToBoundary(const size_t alignBoundary);
-
- /**
- * Takes sizeInByte characters, starting from the character which val points to, and stores them for later writing.
- * When calling flush(), all values that were written to this stream are copied into the payload of the #DBusMessage.
- *
- * The array of characters might be created from a pointer to a given value by using a reinterpret_cast. Example:
- * @code
- * ...
- * int32_t val = 15;
- * outputMessageStream.alignForBasicType(sizeof(int32_t));
- * const char* const reinterpreted = reinterpret_cast<const char*>(&val);
- * outputMessageStream.writeValue(reinterpreted, sizeof(int32_t));
- * ...
- * @endcode
- *
- * @param val The array of chars that should serve as input
- * @param sizeInByte The number of bytes that should be written
- * @return true if writing was successful, false otherwise.
- *
- * @see DBusOutputMessageStream()
- * @see flush()
- */
- bool writeRawData(const char* rawDataPtr, const size_t sizeInByte);
-
- bool writeRawDataAtPosition(size_t position, const char* rawDataPtr, const size_t sizeInByte);
-
-protected:
- std::string payload_;
-
-private:
- void beginWriteGenericVector();
-
- void writeSignature(const std::string& signature);
-
- void rememberCurrentStreamPosition();
-
- size_t popRememberedStreamPosition();
-
- size_t getCurrentStreamPosition();
-
- DBusError dbusError_;
- DBusMessage dbusMessage_;
-
- std::stack<position_t> savedStreamPositions_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_OUTPUT_MESSAGE_STREAM_H_
diff --git a/src/CommonAPI/DBus/DBusProxy.cpp b/src/CommonAPI/DBus/DBusProxy.cpp
index 73fc54a..a28abff 100644
--- a/src/CommonAPI/DBus/DBusProxy.cpp
+++ b/src/CommonAPI/DBus/DBusProxy.cpp
@@ -1,64 +1,46 @@
-/* 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/. */
-// Workaround for libstdc++ bug
-#ifndef _GLIBCXX_USE_NANOSLEEP
-#define _GLIBCXX_USE_NANOSLEEP
-#endif
-
-#include "DBusProxy.h"
-#include "DBusUtils.h"
+// 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 <cassert>
#include <sstream>
+#include <CommonAPI/Utils.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
+#include <CommonAPI/DBus/DBusUtils.hpp>
namespace CommonAPI {
namespace DBus {
-DBusProxyStatusEvent::DBusProxyStatusEvent(DBusProxy* dbusProxy) :
- dbusProxy_(dbusProxy) {
+DBusProxyStatusEvent::DBusProxyStatusEvent(DBusProxy *_dbusProxy)
+ : dbusProxy_(_dbusProxy) {
}
-void DBusProxyStatusEvent::onListenerAdded(const CancellableListener& listener) {
+void DBusProxyStatusEvent::onListenerAdded(const Listener& listener) {
if (dbusProxy_->isAvailable())
listener(AvailabilityStatus::AVAILABLE);
}
-
-DBusProxy::DBusProxy(const std::shared_ptr<DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection):
- DBusProxyBase(dbusConnection),
+DBusProxy::DBusProxy(const DBusAddress &_dbusAddress,
+ const std::shared_ptr<DBusProxyConnection> &_connection):
+ DBusProxyBase(_dbusAddress, _connection),
dbusProxyStatusEvent_(this),
availabilityStatus_(AvailabilityStatus::UNKNOWN),
interfaceVersionAttribute_(*this, "uu", "getInterfaceVersion"),
- dbusServiceRegistry_(dbusConnection->getDBusServiceRegistry()),
- commonApiServiceId_(split(commonApiAddress, ':')[1]),
- commonApiParticipantId_(split(commonApiAddress, ':')[2]),
- dbusBusName_(dbusBusName),
- dbusObjectPath_(dbusObjectPath),
- dbusInterfaceName_(dbusInterfaceName),
- factory_(factory) {
+ dbusServiceRegistry_(DBusServiceRegistry::get(_connection))
+{
}
void DBusProxy::init() {
- std::stringstream ss;
- ss << "local:" << commonApiServiceId_ << ":" << commonApiParticipantId_;
dbusServiceRegistrySubscription_ = dbusServiceRegistry_->subscribeAvailabilityListener(
- ss.str(),
+ getAddress().getAddress(),
std::bind(&DBusProxy::onDBusServiceInstanceStatus, this, std::placeholders::_1));
}
DBusProxy::~DBusProxy() {
dbusServiceRegistry_->unsubscribeAvailabilityListener(
- getAddress(),
+ getAddress().getAddress(),
dbusServiceRegistrySubscription_);
}
@@ -87,38 +69,9 @@ InterfaceVersionAttribute& DBusProxy::getInterfaceVersionAttribute() {
return interfaceVersionAttribute_;
}
-SubscriptionStatus DBusProxy::onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus) {
+void DBusProxy::onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus) {
availabilityStatus_ = availabilityStatus;
dbusProxyStatusEvent_.notifyListeners(availabilityStatus);
- return SubscriptionStatus::RETAIN;
-}
-
-const std::string& DBusProxy::getDBusBusName() const {
- return dbusBusName_;
-}
-
-const std::string& DBusProxy::getDBusObjectPath() const {
- return dbusObjectPath_;
-}
-
-const std::string& DBusProxy::getInterfaceName() const {
- return dbusInterfaceName_;
-}
-
-const std::string& DBusProxy::getDomain() const {
- return commonApiDomain_;
-}
-
-const std::string& DBusProxy::getServiceId() const {
- return commonApiServiceId_;
-}
-
-const std::string& DBusProxy::getInstanceId() const {
- return commonApiParticipantId_;
-}
-
-std::string DBusProxy::getAddress() const {
- return commonApiDomain_ + ":" + commonApiServiceId_ + ":" + commonApiParticipantId_;
}
DBusProxyConnection::DBusSignalHandlerToken DBusProxy::subscribeForSelectiveBroadcastOnConnection(
diff --git a/src/CommonAPI/DBus/DBusProxy.h b/src/CommonAPI/DBus/DBusProxy.h
deleted file mode 100644
index 81b97ea..0000000
--- a/src/CommonAPI/DBus/DBusProxy.h
+++ /dev/null
@@ -1,106 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_PROXY_H_
-#define COMMONAPI_DBUS_DBUS_PROXY_H_
-
-#include "DBusProxyBase.h"
-#include "DBusAttribute.h"
-#include "DBusServiceRegistry.h"
-#include "DBusFactory.h"
-
-#include <functional>
-#include <memory>
-#include <string>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusProxyStatusEvent: public ProxyStatusEvent {
- friend class DBusProxy;
-
- public:
- DBusProxyStatusEvent(DBusProxy* dbusProxy);
-
- protected:
- virtual void onListenerAdded(const CancellableListener& listener);
-
- DBusProxy* dbusProxy_;
-};
-
-
-class DBusProxy: public DBusProxyBase {
- public:
- DBusProxy(const std::shared_ptr<DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection);
-
- virtual ~DBusProxy();
-
- virtual bool isAvailable() const;
- virtual ProxyStatusEvent& getProxyStatusEvent();
- virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- virtual bool isAvailableBlocking() const;
-
- virtual std::string getAddress() const;
- virtual const std::string& getDomain() const;
- virtual const std::string& getServiceId() const;
- virtual const std::string& getInstanceId() const;
-
- virtual const std::string& getDBusBusName() const;
- virtual const std::string& getDBusObjectPath() const;
- virtual const std::string& getInterfaceName() const;
- DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcastOnConnection(
- bool& subscriptionAccepted,
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName,
- const std::string& interfaceMemberSignature,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
- void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
- DBusProxyConnection::DBusSignalHandlerToken subscription,
- const DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
-
- void init();
- private:
- DBusProxy(const DBusProxy&) = delete;
-
- SubscriptionStatus onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus);
-
- DBusProxyStatusEvent dbusProxyStatusEvent_;
- DBusServiceRegistry::DBusServiceSubscription dbusServiceRegistrySubscription_;
- AvailabilityStatus availabilityStatus_;
-
- DBusReadonlyAttribute<InterfaceVersionAttribute> interfaceVersionAttribute_;
-
- std::shared_ptr<DBusServiceRegistry> dbusServiceRegistry_;
-
- const std::string commonApiServiceId_;
- const std::string commonApiParticipantId_;
-
- const std::string dbusBusName_;
- const std::string dbusObjectPath_;
- const std::string dbusInterfaceName_;
-
- const std::shared_ptr<DBusFactory>& factory_;
-};
-
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_PROXY_H_
-
diff --git a/src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h b/src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h
deleted file mode 100644
index 66a78f1..0000000
--- a/src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h
+++ /dev/null
@@ -1,79 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_PROXY_ASYNC_CALLBACK_HANDLER_H_
-#define COMMONAPI_DBUS_DBUS_PROXY_ASYNC_CALLBACK_HANDLER_H_
-
-#include "DBusProxyConnection.h"
-#include "DBusMessage.h"
-#include "DBusSerializableArguments.h"
-#include "DBusHelper.h"
-
-#include <functional>
-#include <future>
-#include <memory>
-
-namespace CommonAPI {
-namespace DBus {
-
-template<typename ... _ArgTypes>
-class DBusProxyAsyncCallbackHandler: public DBusProxyConnection::DBusMessageReplyAsyncHandler {
- public:
- typedef std::function<void(CallStatus, _ArgTypes...)> FunctionType;
-
- static std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler> create(
- FunctionType&& callback) {
- return std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(
- new DBusProxyAsyncCallbackHandler(std::move(callback)));
- }
-
- DBusProxyAsyncCallbackHandler() = delete;
- DBusProxyAsyncCallbackHandler(FunctionType&& callback):
- callback_(std::move(callback)) {
- }
-
- virtual std::future<CallStatus> getFuture() {
- return promise_.get_future();
- }
-
- virtual void onDBusMessageReply(const CallStatus& dbusMessageCallStatus, const DBusMessage& dbusMessage) {
- std::tuple<_ArgTypes...> argTuple;
- promise_.set_value(handleDBusMessageReply(dbusMessageCallStatus, dbusMessage, typename make_sequence<sizeof...(_ArgTypes)>::type(), argTuple));
- }
-
- private:
- template <int... _ArgIndices>
- inline CallStatus handleDBusMessageReply(const CallStatus dbusMessageCallStatus, const DBusMessage& dbusMessage, index_sequence<_ArgIndices...>, std::tuple<_ArgTypes...> argTuple) const {
- CallStatus callStatus = dbusMessageCallStatus;
-
- if (dbusMessageCallStatus == CallStatus::SUCCESS) {
- if (!dbusMessage.isErrorType()) {
- DBusInputStream dbusInputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_ArgTypes...>::deserialize(dbusInputStream, std::get<_ArgIndices>(argTuple)...);
- if (!success)
- callStatus = CallStatus::REMOTE_ERROR;
- } else {
- callStatus = CallStatus::REMOTE_ERROR;
- }
- }
-
- callback_(callStatus, std::move(std::get<_ArgIndices>(argTuple))...);
- return callStatus;
- }
-
- std::promise<CallStatus> promise_;
- const FunctionType callback_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_PROXY_ASYNC_CALLBACK_HANDLER_H_
diff --git a/src/CommonAPI/DBus/DBusProxyBase.cpp b/src/CommonAPI/DBus/DBusProxyBase.cpp
index a493606..56d5717 100644
--- a/src/CommonAPI/DBus/DBusProxyBase.cpp
+++ b/src/CommonAPI/DBus/DBusProxyBase.cpp
@@ -1,32 +1,38 @@
-/* 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 "DBusProxyBase.h"
-#include "DBusMessage.h"
+// 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 <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusProxyBase.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
namespace CommonAPI {
namespace DBus {
-DBusProxyBase::DBusProxyBase(const std::shared_ptr<DBusProxyConnection>& dbusConnection) :
- commonApiDomain_("local"),
- dbusConnection_(dbusConnection){
+DBusProxyBase::DBusProxyBase(
+ const DBusAddress &_dbusAddress,
+ const std::shared_ptr<DBusProxyConnection> &_connection)
+ : dbusAddress_(_dbusAddress),
+ connection_(_connection) {
+ DBusAddressTranslator::get()->translate(dbusAddress_, address_);
+}
+
+DBusMessage
+DBusProxyBase::createMethodCall(const std::string &_method, const std::string &_signature) const {
+ return DBusMessage::createMethodCall(getDBusAddress(), _method, _signature);
}
-DBusMessage DBusProxyBase::createMethodCall(const char* methodName,
- const char* methodSignature) const {
- return DBusMessage::createMethodCall(
- getDBusBusName().c_str(),
- getDBusObjectPath().c_str(),
- getInterfaceName().c_str(),
- methodName,
- methodSignature);
+
+const DBusAddress &
+DBusProxyBase::getDBusAddress() const {
+ return dbusAddress_;
}
-const std::shared_ptr<DBusProxyConnection>& DBusProxyBase::getDBusConnection() const {
- return dbusConnection_;
+const std::shared_ptr<DBusProxyConnection> &
+DBusProxyBase::getDBusConnection() const {
+ return connection_;
}
DBusProxyConnection::DBusSignalHandlerToken DBusProxyBase::addSignalMemberHandler(
@@ -35,8 +41,8 @@ DBusProxyConnection::DBusSignalHandlerToken DBusProxyBase::addSignalMemberHandle
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
const bool justAddFilter) {
return addSignalMemberHandler(
- getDBusObjectPath(),
- getInterfaceName(),
+ getDBusAddress().getObjectPath(),
+ getDBusAddress().getInterface(),
signalName,
signalSignature,
dbusSignalHandler,
@@ -50,7 +56,7 @@ DBusProxyConnection::DBusSignalHandlerToken DBusProxyBase::addSignalMemberHandle
const std::string& signalSignature,
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
const bool justAddFilter) {
- return dbusConnection_->addSignalMemberHandler(
+ return connection_->addSignalMemberHandler(
objectPath,
interfaceName,
signalName,
@@ -60,7 +66,7 @@ DBusProxyConnection::DBusSignalHandlerToken DBusProxyBase::addSignalMemberHandle
}
bool DBusProxyBase::removeSignalMemberHandler(const DBusProxyConnection::DBusSignalHandlerToken& dbusSignalHandlerToken, const DBusProxyConnection::DBusSignalHandler* dbusSignalHandler) {
- return dbusConnection_->removeSignalMemberHandler(dbusSignalHandlerToken, dbusSignalHandler);
+ return connection_->removeSignalMemberHandler(dbusSignalHandlerToken, dbusSignalHandler);
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusProxyBase.h b/src/CommonAPI/DBus/DBusProxyBase.h
deleted file mode 100644
index d1a3a51..0000000
--- a/src/CommonAPI/DBus/DBusProxyBase.h
+++ /dev/null
@@ -1,75 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_PROXY_BASE_H_
-#define COMMONAPI_DBUS_DBUS_PROXY_BASE_H_
-
-#include "DBusProxyConnection.h"
-
-#include <CommonAPI/Proxy.h>
-#include <CommonAPI/types.h>
-
-#include <functional>
-#include <memory>
-#include <string>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusProxyBase: public virtual CommonAPI::Proxy {
- public:
- DBusProxyBase(const std::shared_ptr<DBusProxyConnection>& dbusProxyConnection);
-
- virtual std::string getAddress() const = 0;
- virtual const std::string& getDomain() const = 0;
- virtual const std::string& getServiceId() const = 0;
- virtual const std::string& getInstanceId() const = 0;
-
- virtual const std::string& getDBusBusName() const = 0;
- virtual const std::string& getDBusObjectPath() const = 0;
- virtual const std::string& getInterfaceName() const = 0;
- const std::shared_ptr<DBusProxyConnection>& getDBusConnection() const;
-
- DBusMessage createMethodCall(const char* methodName,
- const char* methodSignature = NULL) const;
-
- DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
- const std::string& signalName,
- const std::string& signalSignature,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const bool justAddFilter = false);
-
- DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& signalName,
- const std::string& signalSignature,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const bool justAddFilter = false);
-
- bool removeSignalMemberHandler(const DBusProxyConnection::DBusSignalHandlerToken& dbusSignalHandlerToken, const DBusProxyConnection::DBusSignalHandler* dbusSignalHandler = NULL);
-
- virtual void init() = 0;
-
- protected:
- const std::string commonApiDomain_;
-
- private:
- DBusProxyBase(const DBusProxyBase&) = delete;
-
- std::shared_ptr<DBusProxyConnection> dbusConnection_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_PROXY_BASE_H_
-
diff --git a/src/CommonAPI/DBus/DBusProxyConnection.h b/src/CommonAPI/DBus/DBusProxyConnection.h
deleted file mode 100644
index d7c88d8..0000000
--- a/src/CommonAPI/DBus/DBusProxyConnection.h
+++ /dev/null
@@ -1,135 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_
-#define COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_
-
-#include "DBusError.h"
-#include "DBusMessage.h"
-
-#include "DBusFunctionalHash.h"
-
-#include <CommonAPI/types.h>
-#include <CommonAPI/Attribute.h>
-#include <CommonAPI/Event.h>
-
-#include <cstdint>
-#include <functional>
-#include <future>
-#include <memory>
-#include <tuple>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-namespace CommonAPI {
-namespace DBus {
-
-
-typedef std::function<void(const DBusMessage&)> DBusMessageHandler;
-
-class DBusDaemonProxy;
-class DBusServiceRegistry;
-class DBusObjectManager;
-class DBusProxy;
-
-
-class DBusProxyConnection {
- public:
- class DBusMessageReplyAsyncHandler {
- public:
- virtual ~DBusMessageReplyAsyncHandler() { }
- virtual std::future<CallStatus> getFuture() = 0;
- virtual void onDBusMessageReply(const CallStatus&, const DBusMessage&) = 0;
- };
-
- class DBusSignalHandler {
- public:
- virtual ~DBusSignalHandler() { }
- virtual SubscriptionStatus onSignalDBusMessage(const DBusMessage&) = 0;
- };
-
- // objectPath, interfaceName, interfaceMemberName, interfaceMemberSignature
- typedef std::tuple<std::string, std::string, std::string, std::string> DBusSignalHandlerPath;
- typedef std::unordered_multimap<DBusSignalHandlerPath, DBusSignalHandler*> DBusSignalHandlerTable;
- typedef DBusSignalHandlerPath DBusSignalHandlerToken;
-
- typedef Event<AvailabilityStatus> ConnectionStatusEvent;
-
- virtual ~DBusProxyConnection() { }
-
- virtual bool isConnected() const = 0;
-
- virtual ConnectionStatusEvent& getConnectionStatusEvent() = 0;
-
- virtual bool sendDBusMessage(const DBusMessage& dbusMessage, uint32_t* allocatedSerial = NULL) const = 0;
-
- static const int kDefaultSendTimeoutMs = 100 * 1000;
-
- virtual std::future<CallStatus> sendDBusMessageWithReplyAsync(
- const DBusMessage& dbusMessage,
- std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
- int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;
-
- virtual DBusMessage sendDBusMessageWithReplyAndBlock(
- const DBusMessage& dbusMessage,
- DBusError& dbusError,
- int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;
-
- virtual DBusSignalHandlerToken addSignalMemberHandler(
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName,
- const std::string& interfaceMemberSignature,
- DBusSignalHandler* dbusSignalHandler,
- const bool justAddFilter = false) = 0;
-
- virtual DBusSignalHandlerToken subscribeForSelectiveBroadcast(bool& subscriptionAccepted,
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName,
- const std::string& interfaceMemberSignature,
- DBusSignalHandler* dbusSignalHandler,
- DBusProxy* callingProxy) = 0;
-
- virtual void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
- DBusProxyConnection::DBusSignalHandlerToken subscription,
- DBusProxy* callingProxy,
- const DBusSignalHandler* dbusSignalHandler) = 0;
-
- virtual bool removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken,
- const DBusSignalHandler* dbusSignalHandler = NULL) = 0;
-
- virtual bool addObjectManagerSignalMemberHandler(const std::string& dbusBusName,
- DBusSignalHandler* dbusSignalHandler) = 0;
- virtual bool removeObjectManagerSignalMemberHandler(const std::string& dbusBusName,
- DBusSignalHandler* dbusSignalHandler) = 0;
-
- virtual const std::shared_ptr<DBusServiceRegistry> getDBusServiceRegistry() = 0;
- virtual const std::shared_ptr<DBusObjectManager> getDBusObjectManager() = 0;
-
- virtual void registerObjectPath(const std::string& objectPath) = 0;
- virtual void unregisterObjectPath(const std::string& objectPath) = 0;
-
- virtual bool requestServiceNameAndBlock(const std::string& serviceName) const = 0;
- virtual bool releaseServiceName(const std::string& serviceName) const = 0;
-
- typedef std::function<bool(const DBusMessage&)> DBusObjectPathMessageHandler;
-
- virtual void setObjectPathMessageHandler(DBusObjectPathMessageHandler) = 0;
- virtual bool isObjectPathMessageHandlerSet() = 0;
-};
-
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif //COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_
diff --git a/src/CommonAPI/DBus/DBusProxyHelper.h b/src/CommonAPI/DBus/DBusProxyHelper.h
deleted file mode 100644
index 336810d..0000000
--- a/src/CommonAPI/DBus/DBusProxyHelper.h
+++ /dev/null
@@ -1,283 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_PROXY_HELPER_H_
-#define COMMONAPI_DBUS_DBUS_PROXY_HELPER_H_
-
-#include "DBusMessage.h"
-#include "DBusSerializableArguments.h"
-#include "DBusProxyAsyncCallbackHandler.h"
-#include "DBusProxyConnection.h"
-
-#include <functional>
-#include <future>
-#include <memory>
-#include <string>
-
-namespace CommonAPI {
-namespace DBus {
-
-
-class DBusProxy;
-
-
-template< class, class >
-struct DBusProxyHelper;
-
-template<
- template<class ...> class _In, class... _InArgs,
- template <class...> class _Out, class... _OutArgs>
- struct DBusProxyHelper<_In<_InArgs...>, _Out<_OutArgs...>> {
-
- template <typename _DBusProxy = DBusProxy>
- static void callMethod(const _DBusProxy& dbusProxy,
- const char* methodName,
- const char* methodSignature,
- const _InArgs&... inArgs,
- CommonAPI::CallStatus& callStatus) {
-
- if (dbusProxy.isAvailableBlocking()) {
-
- DBusMessage dbusMessage = dbusProxy.createMethodCall(methodName, methodSignature);
-
- if (sizeof...(_InArgs) > 0) {
- DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_InArgs...>::serialize(outputStream,inArgs...);
- if (!success) {
- callStatus = CallStatus::OUT_OF_MEMORY;
- return;
- }
- outputStream.flush();
- }
-
- const bool dbusMessageSent = dbusProxy.getDBusConnection()->sendDBusMessage(dbusMessage);
- callStatus = dbusMessageSent ? CallStatus::SUCCESS : CallStatus::OUT_OF_MEMORY;
- } else {
- callStatus = CallStatus::NOT_AVAILABLE;
- }
- }
-
- template <typename _DBusProxy = DBusProxy>
- static void callMethodWithReply(
- const _DBusProxy& dbusProxy,
- DBusMessage& dbusMethodCall,
- const _InArgs&... inArgs,
- CommonAPI::CallStatus& callStatus,
- _OutArgs&... outArgs) {
-
- if (sizeof...(_InArgs) > 0) {
- DBusOutputStream outputStream(dbusMethodCall);
- const bool success = DBusSerializableArguments<_InArgs...>::serialize(outputStream, inArgs...);
- if (!success) {
- callStatus = CallStatus::OUT_OF_MEMORY;
- return;
- }
- outputStream.flush();
- }
-
- DBusError dbusError;
- DBusMessage dbusMessageReply = dbusProxy.getDBusConnection()->sendDBusMessageWithReplyAndBlock(dbusMethodCall, dbusError);
- if (dbusError || !dbusMessageReply.isMethodReturnType()) {
- callStatus = CallStatus::REMOTE_ERROR;
- return;
- }
-
- if (sizeof...(_OutArgs) > 0) {
- DBusInputStream inputStream(dbusMessageReply);
- const bool success = DBusSerializableArguments<_OutArgs...>::deserialize(inputStream, outArgs...);
- if (!success) {
- callStatus = CallStatus::REMOTE_ERROR;
- return;
- }
- }
- callStatus = CallStatus::SUCCESS;
- }
-
- template <typename _DBusProxy = DBusProxy>
- static void callMethodWithReply(
- const _DBusProxy& dbusProxy,
- const char* busName,
- const char* objPath,
- const char* interfaceName,
- const char* methodName,
- const char* methodSignature,
- const _InArgs&... inArgs,
- CommonAPI::CallStatus& callStatus,
- _OutArgs&... outArgs) {
- if (dbusProxy.isAvailableBlocking()) {
- DBusMessage dbusMethodCall = DBusMessage::createMethodCall(
- busName,
- objPath,
- interfaceName,
- methodName,
- methodSignature);
- callMethodWithReply(dbusProxy, dbusMethodCall, inArgs..., callStatus, outArgs...);
- } else {
- callStatus = CallStatus::NOT_AVAILABLE;
- }
- }
-
- template <typename _DBusProxy = DBusProxy>
- static void callMethodWithReply(
- const _DBusProxy& dbusProxy,
- const char* dbusInterfaceName,
- const char* methodName,
- const char* methodSignature,
- const _InArgs&... inArgs,
- CommonAPI::CallStatus& callStatus,
- _OutArgs&... outArgs) {
- callMethodWithReply(
- dbusProxy,
- dbusProxy.getDBusBusName().c_str(),
- dbusProxy.getDBusObjectPath().c_str(),
- dbusInterfaceName,
- methodName,
- methodSignature,
- inArgs...,
- callStatus,
- outArgs...);
- }
-
- template <typename _DBusProxy = DBusProxy>
- static void callMethodWithReply(
- const _DBusProxy& dbusProxy,
- const char* methodName,
- const char* methodSignature,
- const _InArgs&... inArgs,
- CommonAPI::CallStatus& callStatus,
- _OutArgs&... outArgs) {
-
- if (dbusProxy.isAvailableBlocking()) {
-
- DBusMessage dbusMethodCall = dbusProxy.createMethodCall(methodName, methodSignature);
-
- callMethodWithReply(dbusProxy, dbusMethodCall, inArgs..., callStatus, outArgs...);
-
- } else {
- callStatus = CallStatus::NOT_AVAILABLE;
- }
- }
-
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
- static std::future<CallStatus> callMethodAsync(
- const _DBusProxy& dbusProxy,
- const char* methodName,
- const char* methodSignature,
- const _InArgs&... inArgs,
- _AsyncCallback asyncCallback) {
- if (dbusProxy.isAvailable()) {
- DBusMessage dbusMethodCall = dbusProxy.createMethodCall(methodName, methodSignature);
-
- return callMethodAsync(dbusProxy, dbusMethodCall, inArgs..., asyncCallback);
-
- } else {
-
- CallStatus callStatus = CallStatus::NOT_AVAILABLE;
-
- std::tuple<_OutArgs...> argTuple;
- callCallbackOnNotAvailable(asyncCallback, typename make_sequence<sizeof...(_OutArgs)>::type(), argTuple);
-
- std::promise<CallStatus> promise;
- promise.set_value(callStatus);
- return promise.get_future();
- }
-
- }
-
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
- static std::future<CallStatus> callMethodAsync(
- const _DBusProxy& dbusProxy,
- const char* dbusInterfaceName,
- const char* methodName,
- const char* methodSignature,
- const _InArgs&... inArgs,
- _AsyncCallback asyncCallback) {
-
- return callMethodAsync(
- dbusProxy,
- dbusProxy.getDBusBusName().c_str(),
- dbusProxy.getDBusObjectPath().c_str(),
- dbusInterfaceName,
- methodName,
- methodSignature,
- inArgs...,
- asyncCallback);
- }
-
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
- static std::future<CallStatus> callMethodAsync(
- const _DBusProxy& dbusProxy,
- const char* busName,
- const char* objPath,
- const char* interfaceName,
- const char* methodName,
- const char* methodSignature,
- const _InArgs&... inArgs,
- _AsyncCallback asyncCallback) {
- if (dbusProxy.isAvailable()) {
- DBusMessage dbusMethodCall = DBusMessage::createMethodCall(
- busName,
- objPath,
- interfaceName,
- methodName,
- methodSignature);
- return callMethodAsync(dbusProxy, dbusMethodCall, inArgs..., asyncCallback);
- } else {
-
- CallStatus callStatus = CallStatus::NOT_AVAILABLE;
-
- std::tuple<_OutArgs...> argTuple;
- callCallbackOnNotAvailable(asyncCallback, typename make_sequence<sizeof...(_OutArgs)>::type(),argTuple);
-
- std::promise<CallStatus> promise;
- promise.set_value(callStatus);
- return promise.get_future();
- }
- }
-
-
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
- static std::future<CallStatus> callMethodAsync(
- const _DBusProxy& dbusProxy,
- DBusMessage& dbusMessage,
- const _InArgs&... inArgs,
- _AsyncCallback asyncCallback) {
-
- if (sizeof...(_InArgs) > 0) {
- DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_InArgs...>::serialize(outputStream, inArgs...);
- if (!success) {
- std::promise<CallStatus> promise;
- promise.set_value(CallStatus::OUT_OF_MEMORY);
- return promise.get_future();
- }
- outputStream.flush();
- }
-
- return dbusProxy.getDBusConnection()->sendDBusMessageWithReplyAsync(
- dbusMessage,
- DBusProxyAsyncCallbackHandler<_OutArgs...>::create(std::move(asyncCallback)));
-
- }
-
- template <int... _ArgIndices>
- static void callCallbackOnNotAvailable(std::function<void(CallStatus, _OutArgs...)> callback,
- index_sequence<_ArgIndices...>, std::tuple<_OutArgs...> argTuple) {
-
- const CallStatus callstatus = CallStatus::NOT_AVAILABLE;
- callback(callstatus, std::move(std::get<_ArgIndices>(argTuple))...);
- }
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_PROXY_HELPER_H_
diff --git a/src/CommonAPI/DBus/DBusProxyManager.cpp b/src/CommonAPI/DBus/DBusProxyManager.cpp
index abbc491..5a69083 100644
--- a/src/CommonAPI/DBus/DBusProxyManager.cpp
+++ b/src/CommonAPI/DBus/DBusProxyManager.cpp
@@ -1,152 +1,177 @@
-/* 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 "DBusProxyManager.h"
-#include "DBusAddressTranslator.h"
+// 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 <CommonAPI/Runtime.hpp>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusProxyManager.hpp>
namespace CommonAPI {
namespace DBus {
+DBusProxyManager::DBusProxyManager(
+ DBusProxy &_proxy,
+ const std::string &_interfaceId)
+ : proxy_(_proxy),
+ instanceAvailabilityStatusEvent_(_proxy, _interfaceId),
+ interfaceId_(_interfaceId),
+ registry_(DBusServiceRegistry::get(_proxy.getDBusConnection()))
+{
+}
-DBusProxyManager::DBusProxyManager(DBusProxy& dbusProxy,
- const std::string& interfaceId,
- const std::shared_ptr<DBusFactory> factory) :
- dbusProxy_(dbusProxy),
- dbusInstanceAvailabilityStatusEvent_(dbusProxy, interfaceId),
- factory_(factory),
- registry_(dbusProxy.getDBusConnection()->getDBusServiceRegistry()),
- interfaceId_(interfaceId)
-
-{ }
-
-void DBusProxyManager::instancesAsyncCallback(const CommonAPI::CallStatus& status,
- const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dict,
- GetAvailableInstancesCallback& call) {
- std::vector<std::string> returnVec;
- if (status == CommonAPI::CallStatus::SUCCESS) {
- translateCommonApiAddresses(dict, returnVec);
- }
- call(status, returnVec);
+const std::string &
+DBusProxyManager::getDomain() const {
+ static std::string domain("local");
+ return domain;
}
-void DBusProxyManager::getAvailableInstances(CommonAPI::CallStatus& callStatus, std::vector<std::string>& availableInstances) {
- DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
+const std::string &
+DBusProxyManager::getInterface() const {
+ return interfaceId_;
+}
- DBusProxyHelper<DBusSerializableArguments<>,
- DBusSerializableArguments<DBusObjectManagerStub::DBusObjectPathAndInterfacesDict> >::callMethodWithReply(
- dbusProxy_,
- DBusObjectManagerStub::getInterfaceName(),
- "GetManagedObjects",
- "",
- callStatus,
- dbusObjectPathAndInterfacesDict);
+const ConnectionId_t &
+DBusProxyManager::getConnectionId() const {
+ return connectionId_;
+}
- if (callStatus == CallStatus::SUCCESS) {
- translateCommonApiAddresses(dbusObjectPathAndInterfacesDict, availableInstances);
+void
+DBusProxyManager::instancesAsyncCallback(
+ const CommonAPI::CallStatus &_status,
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
+ GetAvailableInstancesCallback &_call) {
+ std::vector<std::string> result;
+ if (_status == CommonAPI::CallStatus::SUCCESS) {
+ translateCommonApiAddresses(_dict, result);
}
+ _call(_status, result);
}
-std::future<CallStatus> DBusProxyManager::getAvailableInstancesAsync(GetAvailableInstancesCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<
- DBusObjectManagerStub::DBusObjectPathAndInterfacesDict> >::callMethodAsync(
- dbusProxy_,
- DBusObjectManagerStub::getInterfaceName(),
- "GetManagedObjects",
- "a{oa{sa{sv}}}",
- std::move(
- std::bind(
- &DBusProxyManager::instancesAsyncCallback,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- callback)));
+void
+DBusProxyManager::getAvailableInstances(
+ CommonAPI::CallStatus &_status,
+ std::vector<std::string> &_availableInstances) {
+ DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dict;
+
+ DBusProxyHelper<
+ DBusSerializableArguments<>,
+ DBusSerializableArguments<
+ DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
+ >
+ >::callMethodWithReply(proxy_,
+ DBusObjectManagerStub::getInterfaceName(),
+ "GetManagedObjects",
+ "",
+ &defaultCallInfo,
+ _status,
+ dict);
+
+ if (_status == CallStatus::SUCCESS) {
+ translateCommonApiAddresses(dict, _availableInstances);
+ }
+}
+std::future<CallStatus>
+DBusProxyManager::getAvailableInstancesAsync(
+ 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>());
}
-void DBusProxyManager::getInstanceAvailabilityStatus(const std::string& instanceAddress,
- CallStatus& callStatus,
- AvailabilityStatus& availabilityStatus) {
-
- std::stringstream ss;
- ss << "local:" << interfaceId_ << ":" << instanceAddress;
-
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
- DBusAddressTranslator::getInstance().searchForDBusAddress(
- ss.str(),
- interfaceName,
- connectionName,
- objectPath);
- availabilityStatus = AvailabilityStatus::NOT_AVAILABLE;
- if (registry_->isServiceInstanceAlive(interfaceName, connectionName, objectPath)) {
- availabilityStatus = AvailabilityStatus::AVAILABLE;
+void
+DBusProxyManager::getInstanceAvailabilityStatus(
+ const std::string &_address,
+ CallStatus &_callStatus,
+ AvailabilityStatus &_availabilityStatus) {
+
+ CommonAPI::Address itsAddress("local", interfaceId_, _address);
+ DBusAddress itsDBusAddress;
+ DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
+
+ _availabilityStatus = AvailabilityStatus::NOT_AVAILABLE;
+ if (registry_->isServiceInstanceAlive(
+ itsDBusAddress.getInterface(),
+ itsDBusAddress.getService(),
+ itsDBusAddress.getObjectPath())) {
+ _availabilityStatus = AvailabilityStatus::AVAILABLE;
}
- callStatus = CallStatus::SUCCESS;
+ _callStatus = CallStatus::SUCCESS;
}
-SubscriptionStatus DBusProxyManager::instanceAliveAsyncCallback(const AvailabilityStatus& alive, GetInstanceAvailabilityStatusCallback& call, std::shared_ptr<std::promise<CallStatus> >& callStatus) {
- call(CallStatus::SUCCESS, alive);
- callStatus->set_value(CallStatus::SUCCESS);
- return SubscriptionStatus::CANCEL;
+void
+DBusProxyManager::instanceAliveAsyncCallback(
+ 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& instanceAddress,
- GetInstanceAvailabilityStatusCallback callback) {
- std::stringstream ss;
- ss << "local:" << interfaceId_ << ":" << instanceAddress;
+std::future<CallStatus>
+DBusProxyManager::getInstanceAvailabilityStatusAsync(
+ const std::string &_instance,
+ GetInstanceAvailabilityStatusCallback _callback) {
+ CommonAPI::Address itsAddress("local", interfaceId_, _instance);
std::shared_ptr<std::promise<CallStatus> > promise = std::make_shared<std::promise<CallStatus>>();
registry_->subscribeAvailabilityListener(
- ss.str(),
+ itsAddress.getAddress(),
std::bind(&DBusProxyManager::instanceAliveAsyncCallback,
this,
std::placeholders::_1,
- callback,
+ _callback,
promise)
);
return promise->get_future();
}
-DBusProxyManager::InstanceAvailabilityStatusChangedEvent& DBusProxyManager::getInstanceAvailabilityStatusChangedEvent() {
- return dbusInstanceAvailabilityStatusEvent_;
+DBusProxyManager::InstanceAvailabilityStatusChangedEvent &
+DBusProxyManager::getInstanceAvailabilityStatusChangedEvent() {
+ return instanceAvailabilityStatusEvent_;
}
-void DBusProxyManager::translateCommonApiAddresses(const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dbusObjectPathAndInterfacesDict,
- std::vector<std::string>& instanceIds) {
- for (const auto& dbusObjectPathIter : dbusObjectPathAndInterfacesDict) {
- const std::string& dbusObjectPath = dbusObjectPathIter.first;
- const auto& dbusInterfacesDict = dbusObjectPathIter.second;
+void
+DBusProxyManager::translateCommonApiAddresses(
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
+ std::vector<std::string> &_instances) {
+
+ CommonAPI::Address itsAddress;
+ DBusAddress itsDBusAddress;
- for (const auto& dbusInterfaceIter : dbusInterfacesDict) {
- const std::string dbusInterfaceName = dbusInterfaceIter.first;
- std::string instanceId;
+ for (const auto &objectPathIter : _dict) {
+ itsDBusAddress.setObjectPath(objectPathIter.first);
- DBusAddressTranslator::getInstance().searchForCommonAddress(
- dbusInterfaceName,
- dbusProxy_.getDBusBusName(),
- dbusObjectPath,
- instanceId);
+ const auto &interfacesDict = objectPathIter.second;
+ for (const auto &interfaceIter : interfacesDict) {
+ itsDBusAddress.setInterface(interfaceIter.first);
- auto pos = instanceId.find_last_of(':');
- instanceId = instanceId.substr(pos + 1, instanceId.size());
+ DBusAddressTranslator::get()->translate(itsDBusAddress, itsAddress);
- instanceIds.push_back(instanceId);
+ _instances.push_back(itsAddress.getInstance());
}
}
}
-std::shared_ptr<Proxy> DBusProxyManager::createProxy(const std::string& instanceId) {
- return factory_->createProxy(interfaceId_.c_str(), instanceId, interfaceId_, "local");
-}
-
-
} // namespace DBus
}// namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusProxyManager.h b/src/CommonAPI/DBus/DBusProxyManager.h
deleted file mode 100644
index 73f612f..0000000
--- a/src/CommonAPI/DBus/DBusProxyManager.h
+++ /dev/null
@@ -1,74 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_PROXY_MANAGER_H_
-#define COMMONAPI_DBUS_DBUS_PROXY_MANAGER_H_
-
-#include <CommonAPI/ProxyManager.h>
-
-#include "DBusProxy.h"
-#include "DBusFactory.h"
-#include "DBusObjectManagerStub.h"
-#include "DBusInstanceAvailabilityStatusChangedEvent.h"
-
-#include <functional>
-#include <future>
-#include <string>
-#include <vector>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusProxyManager: public ProxyManager {
- public:
- DBusProxyManager(DBusProxy& dbusProxy,
- const std::string& interfaceName,
- const std::shared_ptr<DBusFactory> factory);
-
- virtual void getAvailableInstances(CommonAPI::CallStatus&, std::vector<std::string>& availableInstances);
- virtual std::future<CallStatus> getAvailableInstancesAsync(GetAvailableInstancesCallback callback);
-
- virtual void getInstanceAvailabilityStatus(const std::string& instanceAddress,
- CallStatus& callStatus,
- AvailabilityStatus& availabilityStatus);
-
- virtual std::future<CallStatus> getInstanceAvailabilityStatusAsync(const std::string&,
- GetInstanceAvailabilityStatusCallback callback);
-
- virtual InstanceAvailabilityStatusChangedEvent& getInstanceAvailabilityStatusChangedEvent();
- protected:
- virtual std::shared_ptr<Proxy> createProxy(const std::string& instanceId);
- private:
-
- void instancesAsyncCallback(const CommonAPI::CallStatus& status,
- const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dict,
- GetAvailableInstancesCallback& call);
-
- SubscriptionStatus instanceAliveAsyncCallback(const AvailabilityStatus& alive,
- GetInstanceAvailabilityStatusCallback& call,
- std::shared_ptr<std::promise<CallStatus> >& callStatus);
-
- void translateCommonApiAddresses(const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dbusObjectPathAndInterfacesDict,
- std::vector<std::string>& instanceIds);
-
- DBusProxy& dbusProxy_;
- DBusInstanceAvailabilityStatusChangedEvent dbusInstanceAvailabilityStatusEvent_;
- const std::shared_ptr<DBusFactory> factory_;
- const std::shared_ptr<DBusServiceRegistry> registry_;
-
- const std::string interfaceId_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_PROXY_MANAGER_H_
diff --git a/src/CommonAPI/DBus/DBusRuntime.cpp b/src/CommonAPI/DBus/DBusRuntime.cpp
deleted file mode 100644
index bddd91b..0000000
--- a/src/CommonAPI/DBus/DBusRuntime.cpp
+++ /dev/null
@@ -1,86 +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 <CommonAPI/Configuration.h>
-#include <CommonAPI/utils.h>
-
-#include "DBusRuntime.h"
-#include "DBusAddressTranslator.h"
-
-
-const char middlewareIdentifier[] = "DBus";
-
-namespace CommonAPI {
-namespace DBus {
-
-INITIALIZER(registerDBusMiddleware) {
- Runtime::registerRuntimeLoader(middlewareIdentifier, &DBusRuntime::getInstance);
-}
-
-const CommonAPI::MiddlewareInfo DBusRuntime::middlewareInfo_(middlewareIdentifier,
- &CommonAPI::DBus::DBusRuntime::getInstance,
- {COMMONAPI_DBUS_VERSION_MAJOR,
- COMMONAPI_DBUS_VERSION_MINOR}
-);
-
-
-
-
-std::shared_ptr<Runtime> DBusRuntime::getInstance() {
- static std::shared_ptr<Runtime> dbusRuntimeSingleton_;
- if (!dbusRuntimeSingleton_) {
- dbusRuntimeSingleton_ = std::make_shared<DBusRuntime>();
-#ifndef WIN32
- for (const auto& genericLibraryPath : Configuration::getInstance().getGenericLibraryPaths(middlewareIdentifier)) {
- if (!loadGenericLibrary(middlewareIdentifier, genericLibraryPath, false)) {
- return std::shared_ptr<Runtime>(NULL);
- }
- }
- findAndLoadGenericLibraries(middlewareIdentifier, Configuration::getInstance().getLibrarySearchPaths());
-#endif
- }
- return dbusRuntimeSingleton_;
-}
-
-
-std::shared_ptr<Factory> DBusRuntime::doCreateFactory(std::shared_ptr<MainLoopContext> mainLoopContext,
- const std::string& factoryName,
- const bool nullOnInvalidName) {
- auto factory = std::shared_ptr<DBusFactory>(NULL);
-
- if (factoryName == "") {
- factory = std::make_shared<DBusFactory>(this->shared_from_this(), &middlewareInfo_, mainLoopContext);
- } else {
- const DBusFactoryConfig* dbusFactoryConfig = DBusConfiguration::getInstance().getFactoryConfiguration(factoryName);
-
- if (dbusFactoryConfig == NULL) {
- if (nullOnInvalidName) {
- return std::shared_ptr<Factory>(NULL);
- } else {
- dbusFactoryConfig = new DBusFactoryConfig();
- }
- }
-
- factory = std::make_shared<DBusFactory>(
- this->shared_from_this(),
- &middlewareInfo_,
- mainLoopContext,
- *dbusFactoryConfig);
- }
-
- return factory;
-}
-
-std::shared_ptr<ServicePublisher> DBusRuntime::getServicePublisher() {
- return DBusServicePublisher::getInstance();
-}
-
-} // namespace DBus
-} // namespace CommonAPI
-
-extern "C" {
- CommonAPI::MiddlewareInfo middlewareInfo = CommonAPI::DBus::DBusRuntime::middlewareInfo_;
-}
diff --git a/src/CommonAPI/DBus/DBusRuntime.h b/src/CommonAPI/DBus/DBusRuntime.h
deleted file mode 100644
index ee7e689..0000000
--- a/src/CommonAPI/DBus/DBusRuntime.h
+++ /dev/null
@@ -1,39 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_RUNTIME_H_
-#define COMMONAPI_DBUS_DBUS_RUNTIME_H_
-
-#include "CommonAPI/Runtime.h"
-
-#include "DBusFactory.h"
-#include "DBusServicePublisher.h"
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusRuntime: public Runtime, public std::enable_shared_from_this<DBusRuntime> {
-public:
- static std::shared_ptr<Runtime> getInstance();
- std::shared_ptr<ServicePublisher> getServicePublisher();
- static const MiddlewareInfo middlewareInfo_;
-protected:
- std::shared_ptr<Factory> doCreateFactory(std::shared_ptr<MainLoopContext> mainLoopContext,
- const std::string& factoryName,
- const bool nullOnInvalidName);
-private:
- static std::unordered_map<std::string, DBusRuntime> registeredRuntimes;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_RUNTIME_H_
diff --git a/src/CommonAPI/DBus/DBusSelectiveEvent.h b/src/CommonAPI/DBus/DBusSelectiveEvent.h
deleted file mode 100644
index 313ad9c..0000000
--- a/src/CommonAPI/DBus/DBusSelectiveEvent.h
+++ /dev/null
@@ -1,101 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_SELECTIVE_EVENT_H_
-#define COMMONAPI_DBUS_DBUS_SELECTIVE_EVENT_H_
-
-#include "DBusEvent.h"
-
-namespace CommonAPI {
-namespace DBus {
-
-template<typename _EventType, typename _DBusProxy = DBusProxyBase>
-class DBusSelectiveEvent: public DBusEvent<_EventType, _DBusProxy> {
-public:
- typedef typename DBusEvent<_EventType, _DBusProxy>::CancellableListener CancellableListener;
- typedef DBusEvent<_EventType, _DBusProxy> DBusEventBase;
-
- DBusSelectiveEvent(DBusProxy& associatedDbusProxy,
- const char* eventName,
- const char* eventSignature) :
- DBusEventBase(associatedDbusProxy, eventName, eventSignature),
- associatedDbusProxy_(associatedDbusProxy) {
- }
-
- DBusSelectiveEvent(DBusProxy& associatedDbusProxy, const char* eventName,
- const char* eventSignature,
- const char* objPath,
- const char* interfaceName) :
-
- DBusEvent<_EventType, _DBusProxy>(
- associatedDbusProxy,
- eventName,
- eventSignature,
- objPath,
- interfaceName),
- associatedDbusProxy_(associatedDbusProxy) {
- }
-
- virtual ~DBusSelectiveEvent() { }
-
- typename _EventType::Subscription subscribe(typename _EventType::Listener listener, bool& success) {
-
- DBusEventBase::listenerListMutex_.lock();
- const bool firstListenerAdded = DBusEventBase::listenersList_.empty();
-
- typename _EventType::CancellableListenerWrapper wrappedListener(std::move(listener));
- DBusEventBase::listenersList_.emplace_front(std::move(wrappedListener));
- typename _EventType::Subscription listenerSubscription = DBusEventBase::listenersList_.begin();
-
- success = true;
- DBusProxyConnection::DBusSignalHandlerToken dbusSignalHandlerToken;
-
- if (firstListenerAdded) {
- dbusSignalHandlerToken = associatedDbusProxy_.subscribeForSelectiveBroadcastOnConnection(
- success,
- DBusEventBase::objectPath_,
- DBusEventBase::interfaceName_,
- DBusEventBase::eventName_,
- DBusEventBase::eventSignature_,
- this
- );
- }
-
- if (success) {
- // actually add subscription
- DBusEventBase::subscription_ = dbusSignalHandlerToken;
- this->onListenerAdded(*listenerSubscription);
- }
- else {
- DBusEventBase::listenersList_.erase(listenerSubscription);
- listenerSubscription = DBusEventBase::listenersList_.end();
- }
- DBusEventBase::listenerListMutex_.unlock();
-
- return listenerSubscription;
- }
-
-protected:
- virtual void onLastListenerRemoved(const CancellableListener&) {
- associatedDbusProxy_.unsubscribeFromSelectiveBroadcast(
- DBusEventBase::eventName_,
- DBusEventBase::subscription_,
- this);
- }
-
-private:
- DBusProxy& associatedDbusProxy_;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_SELECTIVE_EVENT_H_
diff --git a/src/CommonAPI/DBus/DBusSerializableArguments.h b/src/CommonAPI/DBus/DBusSerializableArguments.h
deleted file mode 100644
index e859602..0000000
--- a/src/CommonAPI/DBus/DBusSerializableArguments.h
+++ /dev/null
@@ -1,66 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_SERIALIZABLE_ARGUMENTS_H_
-#define COMMONAPI_DBUS_SERIALIZABLE_ARGUMENTS_H_
-
-#include "DBusInputStream.h"
-#include "DBusOutputStream.h"
-
-namespace CommonAPI {
-namespace DBus {
-
-template <typename... _Arguments>
-struct DBusSerializableArguments;
-
-template <>
-struct DBusSerializableArguments<> {
- static bool serialize(OutputStream& outputStream) {
- return true;
- }
-
- static bool deserialize(DBusInputStream& inputStream) {
- return true;
- }
-};
-
-template <typename _ArgumentType>
-struct DBusSerializableArguments<_ArgumentType> {
- static bool serialize(OutputStream& outputStream, const _ArgumentType& argument) {
- outputStream << argument;
- return !outputStream.hasError();
- }
-
- static bool deserialize(DBusInputStream& inputStream, _ArgumentType& argument) {
- inputStream >> argument;
- return !inputStream.hasError();
- }
-};
-
-template <typename _ArgumentType, typename ... _Rest>
-struct DBusSerializableArguments<_ArgumentType, _Rest...> {
- static bool serialize(OutputStream& outputStream, const _ArgumentType& argument, const _Rest&... rest) {
- outputStream << argument;
- const bool success = !outputStream.hasError();
- return success ? DBusSerializableArguments<_Rest...>::serialize(outputStream, rest...) : false;
- }
-
- static bool deserialize(DBusInputStream& inputStream, _ArgumentType& argument, _Rest&... rest) {
- inputStream >> argument;
- const bool success = !inputStream.hasError();
- return success ? DBusSerializableArguments<_Rest...>::deserialize(inputStream, rest...) : false;
- }
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_SERIALIZABLE_ARGUMENTS_H_
diff --git a/src/CommonAPI/DBus/DBusServicePublisher.cpp b/src/CommonAPI/DBus/DBusServicePublisher.cpp
deleted file mode 100644
index 6f6a4c7..0000000
--- a/src/CommonAPI/DBus/DBusServicePublisher.cpp
+++ /dev/null
@@ -1,155 +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 "DBusServicePublisher.h"
-#include "DBusFactory.h"
-
-#include <cassert>
-
-
-namespace CommonAPI {
-namespace DBus {
-
-
-std::shared_ptr<DBusServicePublisher> DBusServicePublisher::getInstance() {
- static std::shared_ptr<DBusServicePublisher> instance;
- if(!instance) {
- instance = std::make_shared<DBusServicePublisher>();
- }
- return instance;
-}
-
-bool DBusServicePublisher::registerService(const std::shared_ptr<DBusStubAdapter>& dbusStubAdapter) {
- auto serviceAddress = dbusStubAdapter->getAddress();
- const auto& dbusConnection = dbusStubAdapter->getDBusConnection();
- std::shared_ptr<DBusObjectManagerStub> rootDBusObjectManagerStub = dbusConnection->getDBusObjectManager()->getRootDBusObjectManagerStub();
- const bool isRegistrationAtManagerSuccessfull = registerManagedService(dbusStubAdapter);
-
- if (!isRegistrationAtManagerSuccessfull) {
- return false;
- }
-
- const bool isServiceExportSuccessful = rootDBusObjectManagerStub->exportManagedDBusStubAdapter(dbusStubAdapter);
- if (!isServiceExportSuccessful) {
- const bool isManagedDeregistrationSuccessfull = unregisterManagedService(serviceAddress);
- assert(isManagedDeregistrationSuccessfull);
- }
-
- return isServiceExportSuccessful;
-}
-
-std::shared_ptr<DBusStubAdapter> DBusServicePublisher::getRegisteredService(const std::string& serviceAddress) {
- auto registeredServiceIterator = registeredServices_.find(serviceAddress);
- if (registeredServiceIterator != registeredServices_.end()) {
- return registeredServiceIterator->second;
- }
- return nullptr;
-}
-
-bool DBusServicePublisher::registerService(const std::shared_ptr<StubBase>& stubBase,
- const char* interfaceId,
- const std::string& participantId,
- const std::string& serviceName,
- const std::string& domain,
- const std::shared_ptr<Factory>& factory) {
- auto dbusFactory = std::dynamic_pointer_cast<DBusFactory>(factory);
- if (!dbusFactory) {
- return false;
- }
-
- auto dbusStubAdapter = dbusFactory->createDBusStubAdapter(stubBase, interfaceId, participantId, serviceName, domain);
- if (!dbusStubAdapter) {
- return false;
- }
-
- const bool isRegistrationSuccessful = registerService(dbusStubAdapter);
- return isRegistrationSuccessful;
-}
-
-
-bool DBusServicePublisher::unregisterService(const std::string& serviceAddress) {
- auto registeredServiceIterator = registeredServices_.find(serviceAddress);
- const bool isServiceAddressRegistered = (registeredServiceIterator != registeredServices_.end());
-
- if (!isServiceAddressRegistered) {
- return false;
- }
-
- const auto& registeredDBusStubAdapter = registeredServiceIterator->second;
- const auto& dbusConnection = registeredDBusStubAdapter->getDBusConnection();
- std::shared_ptr<DBusObjectManagerStub> rootDBusObjectManagerStub = dbusConnection->getDBusObjectManager()->getRootDBusObjectManagerStub();
- const bool isRootService = rootDBusObjectManagerStub->isDBusStubAdapterExported(registeredDBusStubAdapter);
- registeredDBusStubAdapter->deactivateManagedInstances();
- if (isRootService) {
- const bool isUnexportSuccessfull = rootDBusObjectManagerStub->unexportManagedDBusStubAdapter(registeredDBusStubAdapter);
- assert(isUnexportSuccessfull);
-
- unregisterManagedService(registeredServiceIterator);
- }
-
- return isRootService;
-}
-
-
-bool DBusServicePublisher::registerManagedService(const std::shared_ptr<DBusStubAdapter>& managedDBusStubAdapter) {
- auto serviceAddress = managedDBusStubAdapter->getAddress();
- const auto& insertResult = registeredServices_.insert( {serviceAddress, managedDBusStubAdapter} );
- const auto& insertIter = insertResult.first;
- const bool& isInsertSuccessful = insertResult.second;
-
- if (!isInsertSuccessful) {
- return false;
- }
-
- const auto& dbusConnection = managedDBusStubAdapter->getDBusConnection();
- const auto dbusObjectManager = dbusConnection->getDBusObjectManager();
- const bool isDBusObjectRegistrationSuccessful = dbusObjectManager->registerDBusStubAdapter(managedDBusStubAdapter);
- if (!isDBusObjectRegistrationSuccessful) {
- registeredServices_.erase(insertIter);
- return false;
- }
-
- const auto& dbusServiceName = managedDBusStubAdapter->getDBusName();
- const bool isServiceNameAcquired = dbusConnection->requestServiceNameAndBlock(dbusServiceName);
- if (!isServiceNameAcquired) {
- const bool isDBusObjectDeregistrationSuccessful = dbusObjectManager->unregisterDBusStubAdapter(managedDBusStubAdapter);
- assert(isDBusObjectDeregistrationSuccessful);
-
- registeredServices_.erase(insertIter);
- }
-
- return isServiceNameAcquired;
-}
-
-
-bool DBusServicePublisher::unregisterManagedService(const std::string& serviceAddress) {
- auto registeredServiceIterator = registeredServices_.find(serviceAddress);
- const bool isServiceAddressRegistered = (registeredServiceIterator != registeredServices_.end());
-
- if (isServiceAddressRegistered) {
- unregisterManagedService(registeredServiceIterator);
- }
-
- return isServiceAddressRegistered;
-}
-
-void DBusServicePublisher::unregisterManagedService(DBusServicesMap::iterator& managedServiceIterator) {
- const auto& registeredDbusStubAdapter = managedServiceIterator->second;
- const auto& dbusConnection = registeredDbusStubAdapter->getDBusConnection();
- const auto dbusObjectManager = dbusConnection->getDBusObjectManager();
- const auto& dbusServiceName = registeredDbusStubAdapter->getDBusName();
-
- const bool isDBusStubAdapterUnregistered = dbusObjectManager->unregisterDBusStubAdapter(registeredDbusStubAdapter);
- assert(isDBusStubAdapterUnregistered);
-
- dbusConnection->releaseServiceName(dbusServiceName);
-
- registeredServices_.erase(managedServiceIterator);
-}
-
-} // namespace DBus
-} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusServicePublisher.h b/src/CommonAPI/DBus/DBusServicePublisher.h
deleted file mode 100644
index 7df44d7..0000000
--- a/src/CommonAPI/DBus/DBusServicePublisher.h
+++ /dev/null
@@ -1,61 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_SERVICE_PUBLISHER_H_
-#define COMMONAPI_DBUS_DBUS_SERVICE_PUBLISHER_H_
-
-
-#include <CommonAPI/ServicePublisher.h>
-#include "DBusStubAdapter.h"
-
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusFactory;
-class DBusObjectManagerStub;
-
-class DBusServicePublisher: public ServicePublisher {
- public:
- DBusServicePublisher() {}
-
- static std::shared_ptr<DBusServicePublisher> getInstance();
-
- bool registerService(const std::shared_ptr<DBusStubAdapter>& dbusStubAdapter);
- virtual bool unregisterService(const std::string& serviceAddress);
-
- bool registerManagedService(const std::shared_ptr<DBusStubAdapter>& managedDBusStubAdapter);
- bool unregisterManagedService(const std::string& serviceAddress);
-
- std::shared_ptr<DBusStubAdapter> getRegisteredService(const std::string&);
-
- protected:
- virtual bool registerService(const std::shared_ptr<StubBase>& stubBase,
- const char* interfaceId,
- const std::string& participantId,
- const std::string& serviceName,
- const std::string& domain,
- const std::shared_ptr<Factory>& factory);
-
- private:
- typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> DBusServicesMap;
-
- void unregisterManagedService(DBusServicesMap::iterator& managedServiceIterator);
-
- DBusServicesMap registeredServices_;
-
- friend class DBusFactory;
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif /* COMMONAPI_DBUS_DBUS_SERVICE_PUBLISHER_H_ */
diff --git a/src/CommonAPI/DBus/DBusServiceRegistry.cpp b/src/CommonAPI/DBus/DBusServiceRegistry.cpp
index 236dc5b..7d12878 100644
--- a/src/CommonAPI/DBus/DBusServiceRegistry.cpp
+++ b/src/CommonAPI/DBus/DBusServiceRegistry.cpp
@@ -1,20 +1,42 @@
-/* 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 "DBusFunctionalHash.h"
-#include "DBusServiceRegistry.h"
-#include "DBusDaemonProxy.h"
-#include "DBusProxyAsyncCallbackHandler.h"
-#include "DBusUtils.h"
+// 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 <iterator>
+#include <CommonAPI/Logger.hpp>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusDaemonProxy.hpp>
+#include <CommonAPI/DBus/DBusFunctionalHash.hpp>
+#include <CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp>
+#include <CommonAPI/DBus/DBusServiceRegistry.hpp>
+#include <CommonAPI/DBus/DBusTypes.hpp>
+#include <CommonAPI/DBus/DBusUtils.hpp>
+
namespace CommonAPI {
namespace DBus {
+DBusServiceRegistry::RegistryMap_t DBusServiceRegistry::registries_;
+std::mutex DBusServiceRegistry::registriesMutex_;
+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;
+}
+
DBusServiceRegistry::DBusServiceRegistry(std::shared_ptr<DBusProxyConnection> dbusProxyConnection) :
dbusDaemonProxy_(std::make_shared<CommonAPI::DBus::DBusDaemonProxy>(dbusProxyConnection)),
initialized_(false),
@@ -24,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)
@@ -53,12 +75,14 @@ DBusServiceRegistry::~DBusServiceRegistry() {
}
void DBusServiceRegistry::init() {
+ translator_ = DBusAddressTranslator::get();
+
dbusDaemonProxyStatusEventSubscription_ =
- dbusDaemonProxy_->getProxyStatusEvent().subscribeCancellableListener(
+ dbusDaemonProxy_->getProxyStatusEvent().subscribe(
std::bind(&DBusServiceRegistry::onDBusDaemonProxyStatusEvent, this, std::placeholders::_1));
dbusDaemonProxyNameOwnerChangedEventSubscription_ =
- dbusDaemonProxy_->getNameOwnerChangedEvent().subscribeCancellableListener(
+ dbusDaemonProxy_->getNameOwnerChangedEvent().subscribe(
std::bind(&DBusServiceRegistry::onDBusDaemonProxyNameOwnerChangedEvent,
this,
std::placeholders::_1,
@@ -70,46 +94,38 @@ void DBusServiceRegistry::init() {
initialized_ = true;
}
-DBusServiceRegistry::DBusServiceSubscription DBusServiceRegistry::subscribeAvailabilityListener(const std::string& commonApiAddress,
- DBusServiceListener serviceListener) {
- std::string dbusInterfaceName;
- std::string dbusServiceName;
- std::string dbusObjectPath;
-
- DBusAddressTranslator::getInstance().searchForDBusAddress(
- commonApiAddress,
- dbusInterfaceName,
- dbusServiceName,
- dbusObjectPath);
+DBusServiceRegistry::DBusServiceSubscription
+DBusServiceRegistry::subscribeAvailabilityListener(
+ const std::string &_address, DBusServiceListener serviceListener) {
+ DBusAddress dbusAddress;
+ translator_->translate(_address, dbusAddress);
if (notificationThread_ == std::this_thread::get_id()) {
- std::cerr << "ERROR: You must not build proxies in callbacks of ProxyStatusEvent."
- << " Refer to the documentation for suggestions how to avoid this.\n";
+ COMMONAPI_ERROR(
+ "You must not build proxies in callbacks of ProxyStatusEvent.",
+ " Please refer to the documentation for suggestions how to avoid this.");
assert(false);
}
std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
- auto& dbusServiceListenersRecord = dbusServiceListenersMap[dbusServiceName];
+ auto& dbusServiceListenersRecord = dbusServiceListenersMap[dbusAddress.getService()];
assert(dbusServiceListenersRecord.uniqueBusNameState != DBusRecordState::AVAILABLE);
- auto& dbusInterfaceNameListenersMap = dbusServiceListenersRecord.dbusObjectPathListenersMap[dbusObjectPath];
- auto& dbusInterfaceNameListenersRecord = dbusInterfaceNameListenersMap[dbusInterfaceName];
+ auto& dbusInterfaceNameListenersMap = dbusServiceListenersRecord.dbusObjectPathListenersMap[dbusAddress.getObjectPath()];
+ auto& dbusInterfaceNameListenersRecord = dbusInterfaceNameListenersMap[dbusAddress.getInterface()];
AvailabilityStatus availabilityStatus = AvailabilityStatus::UNKNOWN;
if (dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::UNKNOWN) {
dbusInterfaceNameListenersRecord.state = DBusRecordState::UNKNOWN;
if (dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::UNKNOWN) {
- resolveDBusServiceName(dbusServiceName, dbusServiceListenersRecord);
+ resolveDBusServiceName(dbusAddress.getService(), dbusServiceListenersRecord);
}
} else if (dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::NOT_AVAILABLE) {
availabilityStatus = AvailabilityStatus::NOT_AVAILABLE;
- } else if (dbusServiceListenersRecord.uniqueBusNameState != DBusRecordState::RESOLVING && dbusInterfaceNameListenersRecord.state == DBusRecordState::UNKNOWN) {
- dbusInterfaceNameListenersRecord.state = resolveDBusInterfaceNameState(
- dbusInterfaceName,
- dbusObjectPath,
- dbusServiceName,
- dbusServiceListenersRecord);
+ } else if (dbusServiceListenersRecord.uniqueBusNameState != DBusRecordState::RESOLVING &&
+ dbusInterfaceNameListenersRecord.state == DBusRecordState::UNKNOWN) {
+ dbusInterfaceNameListenersRecord.state = resolveDBusInterfaceNameState(dbusAddress, dbusServiceListenersRecord);
}
if(availabilityStatus == AvailabilityStatus::UNKNOWN) {
@@ -126,21 +142,11 @@ DBusServiceRegistry::DBusServiceSubscription DBusServiceRegistry::subscribeAvail
}
}
+ // LB TODO: check this as it looks STRANGE!!!
if (availabilityStatus != AvailabilityStatus::UNKNOWN) {
notificationThread_ = std::this_thread::get_id();
- SubscriptionStatus subscriptionStatus = serviceListener(availabilityStatus);
+ serviceListener(availabilityStatus);
notificationThread_ = std::thread::id();
-
- if (subscriptionStatus == SubscriptionStatus::CANCEL) {
- if (dbusInterfaceNameListenersRecord.listenerList.empty()) {
- dbusInterfaceNameListenersMap.erase(dbusInterfaceName);
- if (dbusInterfaceNameListenersMap.empty()) {
- dbusServiceListenersRecord.dbusObjectPathListenersMap.erase(dbusObjectPath);
- }
- }
-
- return DBusServiceSubscription();
- }
}
dbusInterfaceNameListenersRecord.listenerList.push_front(std::move(serviceListener));
@@ -148,20 +154,14 @@ DBusServiceRegistry::DBusServiceSubscription DBusServiceRegistry::subscribeAvail
return dbusInterfaceNameListenersRecord.listenerList.begin();
}
-void DBusServiceRegistry::unsubscribeAvailabilityListener(const std::string& commonApiAddress,
- DBusServiceSubscription& listenerSubscription) {
- std::string dbusInterfaceName;
- std::string dbusServiceName;
- std::string dbusObjectPath;
-
- DBusAddressTranslator::getInstance().searchForDBusAddress(
- commonApiAddress,
- dbusInterfaceName,
- dbusServiceName,
- dbusObjectPath);
+void
+DBusServiceRegistry::unsubscribeAvailabilityListener(
+ const std::string &_address, DBusServiceSubscription& listenerSubscription) {
+ DBusAddress dbusAddress;
+ translator_->translate(_address, dbusAddress);
std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
- auto dbusServiceListenersIterator = dbusServiceListenersMap.find(dbusServiceName);
+ auto dbusServiceListenersIterator = dbusServiceListenersMap.find(dbusAddress.getService());
const bool isDBusServiceListenersRecordFound = (dbusServiceListenersIterator != dbusServiceListenersMap.end());
if (!isDBusServiceListenersRecordFound) {
@@ -170,7 +170,7 @@ void DBusServiceRegistry::unsubscribeAvailabilityListener(const std::string& com
auto& dbusServiceListenersRecord = dbusServiceListenersIterator->second;
auto dbusObjectPathListenersIterator =
- dbusServiceListenersRecord.dbusObjectPathListenersMap.find(dbusObjectPath);
+ dbusServiceListenersRecord.dbusObjectPathListenersMap.find(dbusAddress.getObjectPath());
const bool isDBusObjectPathListenersRecordFound =
(dbusObjectPathListenersIterator != dbusServiceListenersRecord.dbusObjectPathListenersMap.end());
@@ -179,7 +179,7 @@ void DBusServiceRegistry::unsubscribeAvailabilityListener(const std::string& com
}
auto& dbusInterfaceNameListenersMap = dbusObjectPathListenersIterator->second;
- auto dbusInterfaceNameListenersIterator = dbusInterfaceNameListenersMap.find(dbusInterfaceName);
+ auto dbusInterfaceNameListenersIterator = dbusInterfaceNameListenersMap.find(dbusAddress.getInterface());
const bool isDBusInterfaceNameListenersRecordFound =
(dbusInterfaceNameListenersIterator != dbusInterfaceNameListenersMap.end());
@@ -314,16 +314,16 @@ 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);
- if(callStatus == CallStatus::SUCCESS) {
+ if (callStatus == CallStatus::SUCCESS) {
for(std::string serviceName : availableServiceNames) {
if(isDBusServiceName(serviceName)) {
dbusServiceNameMap_[serviceName];
@@ -386,7 +386,7 @@ std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const
std::mutex mutexResolveAllObjectPaths;
std::unique_lock<std::mutex> lockResolveAllObjectPaths(mutexResolveAllObjectPaths);
- // TODO: should use the remaining timeout not "used" during wait before
+ // TODO: Check if should use the remaining timeout not "used" during wait before
monitorResolveAllObjectPaths_.wait_for(lockResolveAllObjectPaths, timeout, [&] {
mutexServiceResolveCount.lock();
bool finished = objectPathsToResolve == 0;
@@ -395,8 +395,6 @@ std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const
return finished;
});
- DBusAddressTranslator& dbusAddressTranslator = DBusAddressTranslator::getInstance();
-
for (auto serviceNameIterator = dbusServiceNameMap_.begin();
serviceNameIterator != dbusServiceNameMap_.end();
serviceNameIterator++) {
@@ -413,7 +411,8 @@ std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const
if (dbusObjectPathCacheIterator->second.dbusInterfaceNamesCache.find(interfaceName)
!= dbusObjectPathCacheIterator->second.dbusInterfaceNamesCache.end()) {
std::string commonApiAddress;
- dbusAddressTranslator.searchForCommonAddress(interfaceName, serviceName, dbusObjectPathCacheIterator->first, commonApiAddress);
+ translator_->translate(
+ dbusObjectPathCacheIterator->first + "/" + interfaceName + "/" + serviceName, commonApiAddress);
availableServiceInstances.push_back(commonApiAddress);
}
}
@@ -426,53 +425,36 @@ std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const
return availableServiceInstances;
}
-//std::vector<std::string> DBusServiceRegistry::getManagedObjects(const std::string& connectionName, const std::string& objectpath) {
-// if (auto iter = dbusServiceNameMap_.find(connectionName) != dbusServiceNameMap_.end()) {
-// DBusUniqueNameRecord* rec = iter->second;
-// if (rec->uniqueName != DBusRecordState::RESOLVED) {
-// return std::vector<std::string>();
-// } else {
-// rec->dbusObjectPathsCache
-// }
-//
-// } else {
-// return std::vector<std::string>();
-// }
-//}
-
-void DBusServiceRegistry::getAvailableServiceInstancesAsync(Factory::GetAvailableServiceInstancesCallback callback,
- const std::string& interfaceName,
- const std::string& domainName) {
+void DBusServiceRegistry::getAvailableServiceInstancesAsync(CommonAPI::Factory::AvailableInstancesCbk_t _cbk,
+ const std::string &_interface,
+ const std::string &_domain) {
//Necessary as service discovery might need some time, but the async version of "getAvailableServiceInstances"
//shall return without delay.
std::thread(
- [this, callback, interfaceName, domainName](std::shared_ptr<DBusServiceRegistry> selfRef) {
- auto availableServiceInstances = getAvailableServiceInstances(interfaceName, domainName);
- callback(availableServiceInstances);
+ [this, _cbk, _interface, _domain](std::shared_ptr<DBusServiceRegistry> selfRef) {
+ auto instances = getAvailableServiceInstances(_interface, _domain);
+ _cbk(instances);
}, this->shared_from_this()
).detach();
}
-SubscriptionStatus DBusServiceRegistry::onSignalDBusMessage(const DBusMessage& dbusMessage) {
- const std::string& dbusServiceUniqueName = dbusMessage.getSenderName();
+void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
+ const std::string& dbusServiceUniqueName = _dbusMessage.getSender();
- assert(dbusMessage.isSignalType());
- assert(dbusMessage.hasInterfaceName("org.freedesktop.DBus.ObjectManager"));
- assert(dbusMessage.hasMemberName("InterfacesAdded") || dbusMessage.hasMemberName("InterfacesRemoved"));
+ assert(_dbusMessage.isSignalType());
+ assert(_dbusMessage.hasInterfaceName("org.freedesktop.DBus.ObjectManager"));
+ assert(_dbusMessage.hasMemberName("InterfacesAdded") || _dbusMessage.hasMemberName("InterfacesRemoved"));
- DBusInputStream dbusInputStream(dbusMessage);
+ DBusInputStream dbusInputStream(_dbusMessage);
std::string dbusObjectPath;
std::unordered_set<std::string> dbusInterfaceNames;
DBusRecordState dbusInterfaceNameState;
dbusInputStream >> dbusObjectPath;
- if (dbusMessage.hasMemberName("InterfacesAdded")) {
+ if (_dbusMessage.hasMemberName("InterfacesAdded")) {
dbusInterfaceNameState = DBusRecordState::AVAILABLE;
- typedef std::unordered_map<std::string, bool> DBusPropertiesChangedDict;
- typedef std::unordered_map<std::string, DBusPropertiesChangedDict> DBusInterfacesAndPropertiesDict;
- typedef std::unordered_map<std::string, DBusInterfacesAndPropertiesDict> DBusObjectPathAndInterfacesDict;
DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
dbusInputStream >> dbusObjectPathAndInterfacesDict;
@@ -485,6 +467,7 @@ SubscriptionStatus DBusServiceRegistry::onSignalDBusMessage(const DBusMessage& d
dbusInterfaceNameState = DBusRecordState::NOT_AVAILABLE;
dbusInputStream >> removedDBusInterfaceNames;
+
std::move(
removedDBusInterfaceNames.begin(),
removedDBusInterfaceNames.end(),
@@ -492,11 +475,11 @@ SubscriptionStatus DBusServiceRegistry::onSignalDBusMessage(const DBusMessage& d
}
if (dbusInputStream.hasError()) {
- return SubscriptionStatus::RETAIN;
+ return;
}
if (dbusInterfaceNames.empty()) {
- return SubscriptionStatus::RETAIN;
+ return;
}
std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
@@ -505,7 +488,9 @@ SubscriptionStatus DBusServiceRegistry::onSignalDBusMessage(const DBusMessage& d
const bool isDBusServiceUniqueNameFound = (dbusServiceUniqueNameIterator != dbusUniqueNamesMap_.end());
if (!isDBusServiceUniqueNameFound) {
- return SubscriptionStatus::CANCEL;
+ // LB TODO: unsubscribe here!
+ // Needs to be reworked in order to store the subscription identifier!
+ return;
}
auto& dbusUniqueNameRecord = dbusServiceUniqueNameIterator->second;
@@ -513,7 +498,7 @@ SubscriptionStatus DBusServiceRegistry::onSignalDBusMessage(const DBusMessage& d
DBusObjectPathCache& dbusObjectPathRecord = dbusUniqueNameRecord.dbusObjectPathsCache[dbusObjectPath];
if (dbusObjectPathRecord.state != DBusRecordState::RESOLVED) {
- return SubscriptionStatus::RETAIN;
+ return;
}
for (const auto& dbusInterfaceName : dbusInterfaceNames) {
@@ -525,8 +510,6 @@ SubscriptionStatus DBusServiceRegistry::onSignalDBusMessage(const DBusMessage& d
}
notifyDBusServiceListeners(dbusUniqueNameRecord, dbusObjectPath, dbusInterfaceNames, dbusInterfaceNameState);
-
- return SubscriptionStatus::RETAIN;
}
@@ -578,7 +561,7 @@ void DBusServiceRegistry::onGetNameOwnerCallback(const CallStatus& status,
dbusServiceListenersRecord.promiseOnResolve.set_value(DBusRecordState::NOT_AVAILABLE);
}
- onDBusServiceNotAvailable(dbusServiceListenersRecord);
+ onDBusServiceNotAvailable(dbusServiceListenersRecord, dbusServiceName);
}
mutexServiceResolveCount.lock();
@@ -587,10 +570,9 @@ void DBusServiceRegistry::onGetNameOwnerCallback(const CallStatus& status,
monitorResolveAllServices_.notify_all();
}
-DBusServiceRegistry::DBusRecordState DBusServiceRegistry::resolveDBusInterfaceNameState(const std::string& dbusInterfaceName,
- const std::string& dbusObjectPath,
- const std::string& dbusServiceName,
- DBusServiceListenersRecord& dbusServiceListenersRecord) {
+DBusServiceRegistry::DBusRecordState
+DBusServiceRegistry::resolveDBusInterfaceNameState(
+ const DBusAddress &_dbusAddress, DBusServiceListenersRecord &dbusServiceListenersRecord) {
assert(dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::RESOLVED);
assert(!dbusServiceListenersRecord.uniqueBusName.empty());
@@ -598,7 +580,7 @@ DBusServiceRegistry::DBusRecordState DBusServiceRegistry::resolveDBusInterfaceNa
assert(!dbusServiceUniqueNameRecord.ownedBusNames.empty());
auto& dbusObjectPathRecord = getDBusObjectPathCacheReference(
- dbusObjectPath,
+ _dbusAddress.getObjectPath(),
dbusServiceListenersRecord.uniqueBusName,
dbusServiceUniqueNameRecord);
@@ -606,7 +588,8 @@ DBusServiceRegistry::DBusRecordState DBusServiceRegistry::resolveDBusInterfaceNa
return dbusObjectPathRecord.state;
}
- auto dbusInterfaceNameIterator = dbusObjectPathRecord.dbusInterfaceNamesCache.find(dbusInterfaceName);
+ auto dbusInterfaceNameIterator
+ = dbusObjectPathRecord.dbusInterfaceNamesCache.find(_dbusAddress.getInterface());
const bool isDBusInterfaceNameFound =
(dbusInterfaceNameIterator != dbusObjectPathRecord.dbusInterfaceNamesCache.end());
@@ -614,9 +597,11 @@ DBusServiceRegistry::DBusRecordState DBusServiceRegistry::resolveDBusInterfaceNa
}
-DBusServiceRegistry::DBusObjectPathCache& DBusServiceRegistry::getDBusObjectPathCacheReference(const std::string& dbusObjectPath,
- const std::string& dbusServiceUniqueName,
- DBusUniqueNameRecord& dbusUniqueNameRecord) {
+DBusServiceRegistry::DBusObjectPathCache &
+DBusServiceRegistry::getDBusObjectPathCacheReference(
+ const std::string& dbusObjectPath,
+ const std::string& dbusServiceUniqueName,
+ DBusUniqueNameRecord& dbusUniqueNameRecord) {
const bool isFirstDBusObjectPathCache = dbusUniqueNameRecord.dbusObjectPathsCache.empty();
auto dbusObjectPathCacheIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
@@ -694,10 +679,9 @@ bool DBusServiceRegistry::introspectDBusObjectPath(const std::string& dbusServic
objectPathsToResolve++;
mutexObjectPathsResolveCount.unlock();
+ DBusAddress dbusAddress(dbusServiceUniqueName, dbusObjectPath, "org.freedesktop.DBus.Introspectable");
DBusMessage dbusMessageCall = DBusMessage::createMethodCall(
- dbusServiceUniqueName,
- dbusObjectPath,
- "org.freedesktop.DBus.Introspectable",
+ dbusAddress,
"Introspect");
auto instrospectAsyncCallback = std::bind(
&DBusServiceRegistry::onIntrospectCallback,
@@ -709,7 +693,10 @@ bool DBusServiceRegistry::introspectDBusObjectPath(const std::string& dbusServic
dbusConnection->sendDBusMessageWithReplyAsync(
dbusMessageCall,
- DBusProxyAsyncCallbackHandler<std::string>::create(instrospectAsyncCallback));
+ DBusProxyAsyncCallbackHandler<
+ std::string
+ >::create(instrospectAsyncCallback, std::tuple<std::string>()),
+ &serviceRegistryInfo);
isResolvingInProgress = true;
}
@@ -775,7 +762,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());
@@ -848,7 +835,7 @@ void DBusServiceRegistry::parseIntrospectionData(const std::string& xmlData,
}
-SubscriptionStatus DBusServiceRegistry::onDBusDaemonProxyStatusEvent(const AvailabilityStatus& availabilityStatus) {
+void DBusServiceRegistry::onDBusDaemonProxyStatusEvent(const AvailabilityStatus& availabilityStatus) {
assert(availabilityStatus != AvailabilityStatus::UNKNOWN);
std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
@@ -860,32 +847,28 @@ SubscriptionStatus DBusServiceRegistry::onDBusDaemonProxyStatusEvent(const Avail
if (availabilityStatus == AvailabilityStatus::AVAILABLE) {
resolveDBusServiceName(dbusServiceName, dbusServiceListenersRecord);
} else {
- onDBusServiceNotAvailable(dbusServiceListenersRecord);
+ onDBusServiceNotAvailable(dbusServiceListenersRecord, dbusServiceName);
}
}
-
- return SubscriptionStatus::RETAIN;
}
void DBusServiceRegistry::checkDBusServiceWasAvailable(const std::string& dbusServiceName,
const std::string& dbusServiceUniqueName) {
-
auto dbusUniqueNameIterator = dbusUniqueNamesMap_.find(dbusServiceUniqueName);
const bool isDBusUniqueNameFound = (dbusUniqueNameIterator != dbusUniqueNamesMap_.end());
if (isDBusUniqueNameFound) {
auto& dbusServiceListenersRecord = dbusServiceListenersMap[dbusServiceName];
- onDBusServiceNotAvailable(dbusServiceListenersRecord);
+ onDBusServiceNotAvailable(dbusServiceListenersRecord, dbusServiceName);
}
}
-SubscriptionStatus DBusServiceRegistry::onDBusDaemonProxyNameOwnerChangedEvent(const std::string& affectedName,
- const std::string& oldOwner,
- const std::string& newOwner) {
+void DBusServiceRegistry::onDBusDaemonProxyNameOwnerChangedEvent(const std::string& affectedName,
+ const std::string& oldOwner,
+ const std::string& newOwner) {
if (!isDBusServiceName(affectedName)) {
- return SubscriptionStatus::RETAIN;
+ return;
}
-
const bool isDBusServiceNameLost = newOwner.empty();
const std::string& dbusServiceUniqueName = (isDBusServiceNameLost ? oldOwner : newOwner);
@@ -897,7 +880,7 @@ SubscriptionStatus DBusServiceRegistry::onDBusDaemonProxyNameOwnerChangedEvent(c
onDBusServiceAvailable(affectedName, dbusServiceUniqueName);
}
- return SubscriptionStatus::RETAIN;
+ return;
}
@@ -946,13 +929,13 @@ void DBusServiceRegistry::onDBusServiceAvailable(const std::string& dbusServiceN
}
}
-void DBusServiceRegistry::onDBusServiceNotAvailable(DBusServiceListenersRecord& dbusServiceListenersRecord) {
+void DBusServiceRegistry::onDBusServiceNotAvailable(DBusServiceListenersRecord& dbusServiceListenersRecord, const std::string &_serviceName) {
const std::unordered_set<std::string> dbusInterfaceNamesCache;
const DBusUniqueNamesMapIterator dbusUniqueNameRecordIterator = dbusUniqueNamesMap_.find(dbusServiceListenersRecord.uniqueBusName);
if (dbusUniqueNameRecordIterator != dbusUniqueNamesMap_.end()) {
- removeUniqueName(dbusUniqueNameRecordIterator);
+ removeUniqueName(dbusUniqueNameRecordIterator, _serviceName);
}
dbusServiceListenersRecord.uniqueBusName.clear();
@@ -1059,7 +1042,6 @@ void DBusServiceRegistry::notifyDBusObjectPathChanged(DBusInterfaceNameListeners
void DBusServiceRegistry::notifyDBusInterfaceNameListeners(DBusInterfaceNameListenersRecord& dbusInterfaceNameListenersRecord,
const bool& isDBusInterfaceNameAvailable) {
-
const AvailabilityStatus availabilityStatus = (isDBusInterfaceNameAvailable ?
AvailabilityStatus::AVAILABLE : AvailabilityStatus::NOT_AVAILABLE);
const DBusRecordState notifyState = (isDBusInterfaceNameAvailable ?
@@ -1071,31 +1053,28 @@ void DBusServiceRegistry::notifyDBusInterfaceNameListeners(DBusInterfaceNameList
dbusInterfaceNameListenersRecord.state = notifyState;
for (auto dbusServiceListenerIterator = dbusInterfaceNameListenersRecord.listenerList.begin();
- dbusServiceListenerIterator != dbusInterfaceNameListenersRecord.listenerList.end();) {
- const auto& dbusServiceListener = *dbusServiceListenerIterator;
-
- if (dbusServiceListener(availabilityStatus) != SubscriptionStatus::RETAIN) {
- dbusServiceListenerIterator = dbusInterfaceNameListenersRecord.listenerList.erase(
- dbusServiceListenerIterator);
- } else {
- dbusServiceListenerIterator++;
- }
+ dbusServiceListenerIterator != dbusInterfaceNameListenersRecord.listenerList.end();
+ dbusServiceListenerIterator++) {
+ (*dbusServiceListenerIterator)(availabilityStatus);
}
}
-void DBusServiceRegistry::removeUniqueName(const DBusUniqueNamesMapIterator& dbusUniqueNamesIterator) {
+void DBusServiceRegistry::removeUniqueName(const DBusUniqueNamesMapIterator& dbusUniqueNamesIterator, const std::string &_serviceName) {
const bool isSubscriptionCancelled = dbusDaemonProxy_->getDBusConnection()->removeObjectManagerSignalMemberHandler(
dbusUniqueNamesIterator->first,
this);
assert(isSubscriptionCancelled);
- for (auto dbusServiceNamesIterator = dbusUniqueNamesIterator->second.ownedBusNames.begin();
- dbusServiceNamesIterator != dbusUniqueNamesIterator->second.ownedBusNames.end();
- dbusServiceNamesIterator++) {
- dbusServiceNameMap_.erase(*dbusServiceNamesIterator);
+ if ("" != _serviceName) {
+ auto findServiceName = dbusUniqueNamesIterator->second.ownedBusNames.find(_serviceName);
+ if (findServiceName != dbusUniqueNamesIterator->second.ownedBusNames.end())
+ dbusUniqueNamesIterator->second.ownedBusNames.erase(findServiceName);
+ } else {
+ dbusUniqueNamesIterator->second.ownedBusNames.clear();
}
- dbusUniqueNamesMap_.erase(dbusUniqueNamesIterator);
+ if (dbusUniqueNamesIterator->second.ownedBusNames.size() == 0)
+ dbusUniqueNamesMap_.erase(dbusUniqueNamesIterator);
}
DBusServiceRegistry::DBusUniqueNameRecord* DBusServiceRegistry::insertServiceNameMapping(const std::string& dbusUniqueName,
diff --git a/src/CommonAPI/DBus/DBusServiceRegistry.h b/src/CommonAPI/DBus/DBusServiceRegistry.h
deleted file mode 100644
index 4c90091..0000000
--- a/src/CommonAPI/DBus/DBusServiceRegistry.h
+++ /dev/null
@@ -1,319 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_
-#define COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_
-
-#include <CommonAPI/types.h>
-#include <CommonAPI/Attribute.h>
-#include <CommonAPI/Proxy.h>
-#include <CommonAPI/Factory.h>
-
-#include "DBusProxyConnection.h"
-#include "DBusAddressTranslator.h"
-#include "DBusDaemonProxy.h"
-
-#include "pugixml/pugixml.hpp"
-
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-#include <map>
-#include <unordered_set>
-#include <string>
-#include <vector>
-#include <memory>
-#include <list>
-#include <algorithm>
-#include <set>
-
-#include <condition_variable>
-#include <mutex>
-#include <future>
-
-namespace CommonAPI {
-namespace DBus {
-
-typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;
-typedef Event<std::string, std::string, std::string>::Subscription NameOwnerChangedEventSubscription;
-
-//connectionName, objectPath
-typedef std::pair<std::string, std::string> DBusInstanceId;
-
-class DBusProxyConnection;
-class DBusDaemonProxy;
-
-class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegistry>,
- public DBusProxyConnection::DBusSignalHandler {
- public:
- enum class DBusRecordState {
- UNKNOWN,
- AVAILABLE,
- RESOLVING,
- RESOLVED,
- NOT_AVAILABLE
- };
-
- // template class DBusServiceListener<> { typedef functor; typedef list; typedef subscription }
- typedef std::function<SubscriptionStatus(const AvailabilityStatus& availabilityStatus)> DBusServiceListener;
- typedef std::list<DBusServiceListener> DBusServiceListenerList;
- typedef DBusServiceListenerList::iterator DBusServiceSubscription;
-
-
- typedef std::function<SubscriptionStatus(const std::vector<std::string>& interfaces,
- const AvailabilityStatus& availabilityStatus)> DBusManagedInterfaceListener;
- typedef std::list<DBusManagedInterfaceListener> DBusManagedInterfaceListenerList;
- typedef DBusManagedInterfaceListenerList::iterator DBusManagedInterfaceSubscription;
-
-
- DBusServiceRegistry(std::shared_ptr<DBusProxyConnection> dbusProxyConnection);
-
- DBusServiceRegistry(const DBusServiceRegistry&) = delete;
- DBusServiceRegistry& operator=(const DBusServiceRegistry&) = delete;
-
- virtual ~DBusServiceRegistry();
-
- void init();
-
-
- DBusServiceSubscription subscribeAvailabilityListener(const std::string& commonApiAddress,
- DBusServiceListener serviceListener);
-
- void unsubscribeAvailabilityListener(const std::string& commonApiAddress,
- DBusServiceSubscription& listenerSubscription);
-
-
- bool isServiceInstanceAlive(const std::string& dbusInterfaceName,
- const std::string& dbusConnectionName,
- const std::string& dbusObjectPath);
-
-
- virtual std::vector<std::string> getAvailableServiceInstances(const std::string& interfaceName,
- const std::string& domainName = "local");
-
- virtual void getAvailableServiceInstancesAsync(Factory::GetAvailableServiceInstancesCallback callback,
- const std::string& interfaceName,
- const std::string& domainName = "local");
-
-
- virtual SubscriptionStatus onSignalDBusMessage(const DBusMessage&);
-
- private:
- struct DBusInterfaceNameListenersRecord {
- DBusInterfaceNameListenersRecord(): state(DBusRecordState::UNKNOWN) {
- }
-
- DBusInterfaceNameListenersRecord(DBusInterfaceNameListenersRecord&& other):
- state(other.state),
- listenerList(std::move(other.listenerList))
- {
- }
-
- DBusRecordState state;
- DBusServiceListenerList listenerList;
- };
-
- typedef std::unordered_map<std::string, DBusInterfaceNameListenersRecord> DBusInterfaceNameListenersMap;
-
- struct DBusServiceListenersRecord {
- DBusServiceListenersRecord(): 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))
- {}
-
- ~DBusServiceListenersRecord() {};
-
- DBusRecordState uniqueBusNameState;
- std::string uniqueBusName;
-
- std::promise<DBusRecordState> promiseOnResolve;
- std::shared_future<DBusRecordState> futureOnResolve;
- std::unique_lock<std::mutex>* mutexOnResolve;
-
- std::unordered_map<std::string, DBusInterfaceNameListenersMap> dbusObjectPathListenersMap;
- };
-
- std::unordered_map<std::string, DBusServiceListenersRecord> dbusServiceListenersMap;
-
-
- struct DBusObjectPathCache {
- DBusObjectPathCache(): referenceCount(0), state(DBusRecordState::UNKNOWN) {
- }
-
- DBusObjectPathCache(DBusObjectPathCache&& other):
- referenceCount(other.referenceCount),
- state(other.state),
- promiseOnResolve(std::move(other.promiseOnResolve)),
- dbusInterfaceNamesCache(std::move(other.dbusInterfaceNamesCache))
- {
- /*other.promiseOnResolve = NULL;
- other.dbusInterfaceNamesCache = NULL;*/
- }
-
- ~DBusObjectPathCache() {}
-
- size_t referenceCount;
- DBusRecordState state;
- std::promise<DBusRecordState> promiseOnResolve;
-
- std::unordered_set<std::string> dbusInterfaceNamesCache;
- };
-
- struct DBusUniqueNameRecord {
- DBusUniqueNameRecord(): objectPathsState(DBusRecordState::UNKNOWN) {
- }
-
- DBusUniqueNameRecord(DBusUniqueNameRecord&& other) :
- uniqueName(std::move(other.uniqueName)),
- objectPathsState(other.objectPathsState),
- ownedBusNames(std::move(other.ownedBusNames)),
- dbusObjectPathsCache(std::move(other.dbusObjectPathsCache))
- {}
-
- std::string uniqueName;
- DBusRecordState objectPathsState;
- std::unordered_set<std::string> ownedBusNames;
- std::unordered_map<std::string, DBusObjectPathCache> dbusObjectPathsCache;
- };
-
- std::unordered_map<std::string, DBusUniqueNameRecord> dbusUniqueNamesMap_;
- typedef std::unordered_map<std::string, DBusUniqueNameRecord>::iterator DBusUniqueNamesMapIterator;
-
- // mapping service names (well-known names) to service instances
- std::unordered_map<std::string, DBusUniqueNameRecord*> dbusServiceNameMap_;
-
-
- // protects the dbus service maps
- std::mutex dbusServicesMutex_;
-
-
- void resolveDBusServiceName(const std::string& dbusServiceName,
- DBusServiceListenersRecord& dbusServiceListenersRecord);
-
- void onGetNameOwnerCallback(const CallStatus& status, std::string dbusServiceUniqueName, const std::string& dbusServiceName);
-
-
- DBusRecordState resolveDBusInterfaceNameState(const std::string& dbusInterfaceName,
- const std::string& dbusObjectPath,
- const std::string& dbusServiceName,
- DBusServiceListenersRecord& dbusServiceListenersRecord);
-
-
- DBusObjectPathCache& getDBusObjectPathCacheReference(const std::string& dbusObjectPath,
- const std::string& dbusServiceUniqueName,
- DBusUniqueNameRecord& dbusUniqueNameRecord);
-
- void releaseDBusObjectPathCacheReference(const std::string& dbusObjectPath,
- const DBusServiceListenersRecord& dbusServiceListenersRecord);
-
-
- bool introspectDBusObjectPath(const std::string& dbusServiceUniqueName, const std::string& dbusObjectPath);
-
- void onIntrospectCallback(const CallStatus& status,
- std::string xmlData,
- const std::string& dbusServiceName,
- const std::string& dbusObjectPath);
-
- void parseIntrospectionData(const std::string& xmlData,
- const std::string& rootObjectPath,
- const std::string& dbusServiceUniqueName);
-
- void parseIntrospectionNode(const pugi::xml_node& node,
- const std::string& rootObjectPath,
- const std::string& fullObjectPath,
- const std::string& dbusServiceUniqueName);
-
- void processIntrospectionObjectPath(const pugi::xml_node& node,
- const std::string& rootObjectPath,
- const std::string& dbusServiceUniqueName);
-
- void processIntrospectionInterface(const pugi::xml_node& node,
- const std::string& rootObjectPath,
- const std::string& fullObjectPath,
- const std::string& dbusServiceUniqueName);
-
- SubscriptionStatus onDBusDaemonProxyStatusEvent(const AvailabilityStatus& availabilityStatus);
-
- SubscriptionStatus onDBusDaemonProxyNameOwnerChangedEvent(const std::string& name,
- const std::string& oldOwner,
- const std::string& newOwner);
-
- std::shared_ptr<DBusDaemonProxy> dbusDaemonProxy_;
- bool initialized_;
-
- ProxyStatusEvent::Subscription dbusDaemonProxyStatusEventSubscription_;
- NameOwnerChangedEvent::Subscription dbusDaemonProxyNameOwnerChangedEventSubscription_;
-
-
- void checkDBusServiceWasAvailable(const std::string& dbusServiceName, const std::string& dbusServiceUniqueName);
-
- void onDBusServiceAvailable(const std::string& dbusServiceName, const std::string& dbusServiceUniqueName);
-
- void onDBusServiceNotAvailable(DBusServiceListenersRecord& dbusServiceListenersRecord);
-
-
- void notifyDBusServiceListeners(const DBusUniqueNameRecord& dbusUniqueNameRecord,
- const std::string& dbusObjectPath,
- const std::unordered_set<std::string>& dbusInterfaceNames,
- const DBusRecordState& dbusInterfaceNamesState);
-
- void notifyDBusObjectPathResolved(DBusInterfaceNameListenersMap& dbusInterfaceNameListenersMap,
- const std::unordered_set<std::string>& dbusInterfaceNames);
-
- void notifyDBusObjectPathChanged(DBusInterfaceNameListenersMap& dbusInterfaceNameListenersMap,
- const std::unordered_set<std::string>& dbusInterfaceNames,
- const DBusRecordState& dbusInterfaceNamesState);
-
- void notifyDBusInterfaceNameListeners(DBusInterfaceNameListenersRecord& dbusInterfaceNameListenersRecord,
- const bool& isDBusInterfaceNameAvailable);
-
-
- void removeUniqueName(const DBusUniqueNamesMapIterator& dbusUniqueName);
- DBusUniqueNameRecord* insertServiceNameMapping(const std::string& dbusUniqueName, const std::string& dbusServiceName);
- bool findCachedDbusService(const std::string& dbusServiceName, DBusUniqueNameRecord** uniqueNameRecord);
- bool findCachedObjectPath(const std::string& dbusObjectPathName, const DBusUniqueNameRecord* uniqueNameRecord, DBusObjectPathCache* objectPathCache);
-
- std::condition_variable monitorResolveAllServices_;
- std::mutex mutexServiceResolveCount;
- int servicesToResolve;
-
- std::condition_variable monitorResolveAllObjectPaths_;
- std::mutex mutexObjectPathsResolveCount;
- int objectPathsToResolve;
-
-
- void fetchAllServiceNames();
-
- inline const bool isDBusServiceName(const std::string& serviceName) {
- return (serviceName.length() > 0 && serviceName[0] != ':');
- };
-
-
- inline const bool isOrgFreedesktopDBusInterface(const std::string& dbusInterfaceName) {
- return dbusInterfaceName.find("org.freedesktop.DBus.") == 0;
- }
-
- std::thread::id notificationThread_;
-};
-
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_
diff --git a/src/CommonAPI/DBus/DBusStubAdapter.cpp b/src/CommonAPI/DBus/DBusStubAdapter.cpp
index a27bf40..03fa6c3 100644
--- a/src/CommonAPI/DBus/DBusStubAdapter.cpp
+++ b/src/CommonAPI/DBus/DBusStubAdapter.cpp
@@ -1,97 +1,48 @@
-/* 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 "DBusStubAdapter.h"
-#include "DBusUtils.h"
+// 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 <CommonAPI/utils.h>
-
-#include <cassert>
-#include <functional>
-#include <sstream>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
namespace CommonAPI {
namespace DBus {
-const std::string DBusStubAdapter::domain_ = "local";
-
-DBusStubAdapter::DBusStubAdapter(const std::shared_ptr<DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection,
- const bool isManagingInterface) :
- commonApiDomain_(split(commonApiAddress, ':')[0]),
- commonApiServiceId_(split(commonApiAddress, ':')[1]),
- commonApiParticipantId_(split(commonApiAddress, ':')[2]),
- dbusBusName_(dbusBusName),
- dbusObjectPath_(dbusObjectPath),
- dbusInterfaceName_(dbusInterfaceName),
- dbusConnection_(dbusConnection),
- factory_(factory),
- isManagingInterface_(isManagingInterface) {
-
- assert(!dbusBusName_.empty());
- assert(!dbusInterfaceName_.empty());
- assert(!dbusObjectPath_.empty());
- assert(dbusObjectPath_[0] == '/');
- assert(!dbusInterfaceName_.empty());
- assert(dbusConnection_);
+DBusStubAdapter::DBusStubAdapter(const DBusAddress &_dbusAddress,
+ const std::shared_ptr<DBusProxyConnection> &_connection,
+ const bool _isManaging)
+ : dbusAddress_(_dbusAddress),
+ connection_(_connection),
+ isManaging_(_isManaging) {
}
DBusStubAdapter::~DBusStubAdapter() {
deinit();
}
-void DBusStubAdapter::init(std::shared_ptr<DBusStubAdapter> instance) {
+void DBusStubAdapter::init(std::shared_ptr<DBusStubAdapter> _instance) {
+ DBusAddressTranslator::get()->translate(dbusAddress_, address_);
}
void DBusStubAdapter::deinit() {
}
-const std::string DBusStubAdapter::getAddress() const {
- return commonApiDomain_ + ":" + commonApiServiceId_ + ":" + commonApiParticipantId_;
-}
-
-const std::string& DBusStubAdapter::getDomain() const {
- return commonApiDomain_;
+const DBusAddress &DBusStubAdapter::getDBusAddress() const {
+ return dbusAddress_;
}
-const std::string& DBusStubAdapter::getServiceId() const {
- return commonApiServiceId_;
+const std::shared_ptr<DBusProxyConnection> &DBusStubAdapter::getDBusConnection() const {
+ return connection_;
}
-const std::string& DBusStubAdapter::getInstanceId() const {
- return commonApiParticipantId_;
+const bool DBusStubAdapter::isManaging() const {
+ return isManaging_;
}
const bool DBusStubAdapter::hasFreedesktopProperties() {
return false;
}
-const bool DBusStubAdapter::isManagingInterface() {
- return isManagingInterface_;
-}
-
-const std::string& DBusStubAdapter::getDBusName() const {
- return dbusBusName_;
-}
-
-const std::string& DBusStubAdapter::getObjectPath() const {
- return dbusObjectPath_;
-}
-
-const std::string& DBusStubAdapter::getInterfaceName() const {
- return dbusInterfaceName_;
-}
-
-const std::shared_ptr<DBusProxyConnection>& DBusStubAdapter::getDBusConnection() const {
- return dbusConnection_;
-}
-
-} // namespace dbus
+} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusStubAdapter.h b/src/CommonAPI/DBus/DBusStubAdapter.h
deleted file mode 100644
index 3b6bfb6..0000000
--- a/src/CommonAPI/DBus/DBusStubAdapter.h
+++ /dev/null
@@ -1,86 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_
-
-#include "DBusProxyConnection.h"
-#include "DBusInterfaceHandler.h"
-#include "DBusMessage.h"
-
-#include <CommonAPI/Stub.h>
-
-#include <string>
-#include <memory>
-
-namespace CommonAPI {
-namespace DBus {
-
-class DBusObjectManagerStub;
-class DBusFactory;
-
-class DBusStubAdapter: virtual public CommonAPI::StubAdapter, public DBusInterfaceHandler {
- public:
- DBusStubAdapter(const std::shared_ptr<DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection,
- const bool isManagingInterface);
-
- virtual ~DBusStubAdapter();
-
- virtual void init(std::shared_ptr<DBusStubAdapter> instance);
- virtual void deinit();
-
- virtual const std::string getAddress() const;
- virtual const std::string& getDomain() const;
- virtual const std::string& getServiceId() const;
- virtual const std::string& getInstanceId() const;
-
- const std::string& getDBusName() const;
- const std::string& getObjectPath() const;
- const std::string& getInterfaceName() const;
-
- const std::shared_ptr<DBusProxyConnection>& getDBusConnection() const;
-
- const bool isManagingInterface();
-
- virtual const char* getMethodsDBusIntrospectionXmlData() const = 0;
- virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) = 0;
-
- virtual void deactivateManagedInstances() = 0;
- virtual const bool hasFreedesktopProperties();
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const DBusMessage& dbusMessage) = 0;
- protected:
-
- const std::string commonApiDomain_;
- const std::string commonApiServiceId_;
- const std::string commonApiParticipantId_;
-
- const std::string dbusBusName_;
- const std::string dbusObjectPath_;
- const std::string dbusInterfaceName_;
- const std::shared_ptr<DBusProxyConnection> dbusConnection_;
-
- static const std::string domain_;
-
- const std::shared_ptr<DBusFactory> factory_;
-
- const bool isManagingInterface_;
-};
-
-
-} // namespace dbus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_
diff --git a/src/CommonAPI/DBus/DBusStubAdapterHelper.h b/src/CommonAPI/DBus/DBusStubAdapterHelper.h
deleted file mode 100644
index dbac232..0000000
--- a/src/CommonAPI/DBus/DBusStubAdapterHelper.h
+++ /dev/null
@@ -1,838 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef COMMONAPI_DBUS_DBUS_STUB_ADAPTER_HELPER_H_
-#define COMMONAPI_DBUS_DBUS_STUB_ADAPTER_HELPER_H_
-
-#include <CommonAPI/SerializableVariant.h>
-
-#include "DBusStubAdapter.h"
-#include "DBusInputStream.h"
-#include "DBusOutputStream.h"
-#include "DBusHelper.h"
-#include "DBusSerializableArguments.h"
-#include "DBusClientId.h"
-#include "DBusLegacyVariant.h"
-
-#include <memory>
-#include <initializer_list>
-#include <tuple>
-#include <unordered_map>
-
-namespace CommonAPI {
-namespace DBus {
-
-class StubDispatcherBase {
-public:
- virtual ~StubDispatcherBase() { }
-};
-
-template <typename _StubClass>
-class DBusGetFreedesktopAttributeStubDispatcherBase;
-
-struct DBusAttributeDispatcherStruct {
- StubDispatcherBase* getter;
- StubDispatcherBase* setter;
-
- DBusAttributeDispatcherStruct(StubDispatcherBase* g, StubDispatcherBase* s) {
- getter = g;
- setter = s;
- }
-};
-
-typedef std::unordered_map<std::string, DBusAttributeDispatcherStruct> StubAttributeTable;
-
-template <typename _StubClass>
-class DBusStubAdapterHelper: public virtual DBusStubAdapter {
- public:
- typedef typename _StubClass::StubAdapterType StubAdapterType;
- typedef typename _StubClass::RemoteEventHandlerType RemoteEventHandlerType;
-
- class StubDispatcher: public StubDispatcherBase {
- public:
- virtual bool dispatchDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
- DBusStubAdapterHelper<_StubClass>& dbusStubAdapterHelper) = 0;
- };
- // interfaceMemberName, interfaceMemberSignature
- typedef std::pair<const char*, const char*> DBusInterfaceMemberPath;
- typedef std::unordered_map<DBusInterfaceMemberPath, StubDispatcherBase*> StubDispatcherTable;
-
- DBusStubAdapterHelper(const std::shared_ptr<DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<_StubClass>& stub,
- const bool isManagingInterface):
- DBusStubAdapter(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, dbusConnection, isManagingInterface),
- stub_(stub),
- remoteEventHandler_(NULL) {
- }
-
- virtual ~DBusStubAdapterHelper() {
- DBusStubAdapter::deinit();
- stub_.reset();
- }
-
- virtual void init(std::shared_ptr<DBusStubAdapter> instance) {
- DBusStubAdapter::init(instance);
- std::shared_ptr<StubAdapterType> stubAdapter = std::dynamic_pointer_cast<StubAdapterType>(instance);
- remoteEventHandler_ = stub_.lock()->initStubAdapter(stubAdapter);
- }
-
- virtual void deinit() {
- DBusStubAdapter::deinit();
- stub_.reset();
- }
-
- inline RemoteEventHandlerType* getRemoteEventHandler() {
- return remoteEventHandler_;
- }
-
- protected:
-
- virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) {
- const char* interfaceMemberName = dbusMessage.getMemberName();
- const char* interfaceMemberSignature = dbusMessage.getSignatureString();
-
- assert(interfaceMemberName);
- assert(interfaceMemberSignature);
-
- DBusInterfaceMemberPath dbusInterfaceMemberPath(interfaceMemberName, interfaceMemberSignature);
- auto findIterator = getStubDispatcherTable().find(dbusInterfaceMemberPath);
- const bool foundInterfaceMemberHandler = (findIterator != getStubDispatcherTable().end());
- bool dbusMessageHandled = false;
-
- //To prevent the destruction of the stub whilst still handling a message
- auto stubSafety = stub_.lock();
- if (stubSafety && foundInterfaceMemberHandler) {
- StubDispatcher* stubDispatcher = static_cast<StubDispatcher*>(findIterator->second);
- dbusMessageHandled = stubDispatcher->dispatchDBusMessage(dbusMessage, stubSafety, *this);
- }
-
- return dbusMessageHandled;
- }
-
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const DBusMessage& dbusMessage) {
- DBusInputStream dbusInputStream(dbusMessage);
-
- if(dbusMessage.hasMemberName("Get")) {
- return handleFreedesktopGet(dbusMessage, dbusInputStream);
- } else if(dbusMessage.hasMemberName("Set")) {
- return handleFreedesktopSet(dbusMessage, dbusInputStream);
- } else if(dbusMessage.hasMemberName("GetAll")) {
- return handleFreedesktopGetAll(dbusMessage, dbusInputStream);
- }
-
- return false;
- }
-
- virtual const StubDispatcherTable& getStubDispatcherTable() = 0;
- virtual const StubAttributeTable& getStubAttributeTable() = 0;
-
- std::weak_ptr<_StubClass> stub_;
- RemoteEventHandlerType* remoteEventHandler_;
- private:
- bool handleFreedesktopGet(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
- std::string interfaceName;
- std::string attributeName;
- dbusInputStream >> interfaceName;
- dbusInputStream >> attributeName;
-
- if (dbusInputStream.hasError()) {
- return false;
- }
-
- auto attributeDispatcherIterator = getStubAttributeTable().find(attributeName);
- // check, if we want to access with a valid attribute name
- if (attributeDispatcherIterator == getStubAttributeTable().end()) {
- return false;
- }
-
- //To prevent the destruction of the stub whilst still handling a message
- auto stubSafety = stub_.lock();
- if (stubSafety) {
- StubDispatcher* getterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.getter);
- assert(getterDispatcher != NULL); // all attributes have at least a getter
- return (getterDispatcher->dispatchDBusMessage(dbusMessage, stubSafety, *this));
- }
-
- return false;
- }
-
- bool handleFreedesktopSet(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
- std::string interfaceName;
- std::string attributeName;
- dbusInputStream >> interfaceName;
- dbusInputStream >> attributeName;
-
- if(dbusInputStream.hasError()) {
- return false;
- }
-
- auto attributeDispatcherIterator = getStubAttributeTable().find(attributeName);
- // check, if we want to access with a valid attribute name
- if(attributeDispatcherIterator == getStubAttributeTable().end()) {
- return false;
- }
-
- //To prevent the destruction of the stub whilst still handling a message
- auto stubSafety = stub_.lock();
- if (stubSafety) {
- StubDispatcher* setterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.setter);
-
- if(setterDispatcher == NULL) { // readonly attributes do not have a setter
- return false;
- }
-
- return(setterDispatcher->dispatchDBusMessage(dbusMessage, stubSafety, *this));
- }
-
- return false;
- }
-
- bool handleFreedesktopGetAll(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
- std::string interfaceName;
- dbusInputStream >> interfaceName;
-
- if(dbusInputStream.hasError()) {
- return false;
- }
-
- DBusMessage dbusMessageReply = dbusMessage.createMethodReturn("a{sv}");
- DBusOutputStream dbusOutputStream(dbusMessageReply);
- dbusOutputStream.beginWriteVectorOfSerializableStructs(getStubAttributeTable().size());
-
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
-
- auto stubSafety = stub_.lock();
-
- for(auto attributeDispatcherIterator = getStubAttributeTable().begin(); attributeDispatcherIterator != getStubAttributeTable().end(); attributeDispatcherIterator++) {
- //To prevent the destruction of the stub whilst still handling a message
- if (stubSafety) {
- DBusGetFreedesktopAttributeStubDispatcherBase<_StubClass>* const getterDispatcher = dynamic_cast<DBusGetFreedesktopAttributeStubDispatcherBase<_StubClass>*>(attributeDispatcherIterator->second.getter);
-
- if(getterDispatcher == NULL) { // readonly attributes do not have a setter
- return false;
- }
-
- dbusOutputStream << attributeDispatcherIterator->first;
- getterDispatcher->dispatchDBusMessageAndAppendReply(dbusMessage, stubSafety, dbusOutputStream, clientId);
- }
- }
-
- dbusOutputStream.endWriteVector();
- dbusOutputStream.flush();
- return getDBusConnection()->sendDBusMessage(dbusMessageReply);
- }
-};
-
-template< class >
-struct DBusStubSignalHelper;
-
-template<template<class ...> class _In, class... _InArgs>
-struct DBusStubSignalHelper<_In<_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) {
- DBusMessage dbusMessage = DBusMessage::createSignal(
- objectPath,
- interfaceName,
- signalName,
- signalSignature);
-
- if (sizeof...(_InArgs) > 0) {
- DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_InArgs...>::serialize(outputStream, inArgs...);
- if (!success) {
- return false;
- }
- outputStream.flush();
- }
-
- const bool dbusMessageSent = dbusConnection->sendDBusMessage(dbusMessage);
- return dbusMessageSent;
- }
-
- template <typename _DBusStub = DBusStubAdapter>
- static bool sendSignal(const _DBusStub& dbusStub,
- const char* signalName,
- const char* signalSignature,
- const _InArgs&... inArgs) {
- return(sendSignal(dbusStub.getObjectPath().c_str(),
- dbusStub.getInterfaceName().c_str(),
- signalName,
- signalSignature,
- dbusStub.getDBusConnection(),
- inArgs...));
- }
-
-
- template <typename _DBusStub = DBusStubAdapter>
- static bool sendSignal( const char* target,
- const _DBusStub& dbusStub,
- const char* signalName,
- const char* signalSignature,
- const _InArgs&... inArgs) {
- DBusMessage dbusMessage = DBusMessage::createSignal(
- dbusStub.getObjectPath().c_str(),
- dbusStub.getInterfaceName(),
- signalName,
- signalSignature);
-
- dbusMessage.setDestination(target);
-
- if (sizeof...(_InArgs) > 0) {
- DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_InArgs...>::serialize(outputStream, inArgs...);
- if (!success) {
- return false;
- }
- outputStream.flush();
- }
-
- const bool dbusMessageSent = dbusStub.getDBusConnection()->sendDBusMessage(dbusMessage);
- return dbusMessageSent;
- }
-};
-
-template< class >
-struct DBusStubFreedesktopPropertiesSignalHelper;
-
-template<template<class ...> class _In, class _InArg>
-struct DBusStubFreedesktopPropertiesSignalHelper<_In<_InArg>> {
- template <typename _ValueType>
- struct DBusPropertiesEntry: public CommonAPI::SerializableStruct {
- std::string propertyName_;
- DBusLegacyVariantWrapper<CommonAPI::Variant<_ValueType>> propertyValue_;
-
- DBusPropertiesEntry() = default;
- DBusPropertiesEntry(const std::string& propertyName,
- const DBusLegacyVariantWrapper<CommonAPI::Variant<_ValueType>>& propertyValue):
- propertyName_(propertyName),
- propertyValue_(propertyValue) {
- };
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream) {
- inputStream >> propertyName_;
- inputStream >> propertyValue_;
- }
-
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- outputStream << propertyName_;
- outputStream << propertyValue_;
- }
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- typeOutputStream.writeStringType();
- typeOutputStream.writeVariantType();
- }
-
- };
-
- template <typename _DBusStub = DBusStubAdapter>
- static bool sendPropertiesChangedSignal(const _DBusStub& dbusStub, const std::string& propertyName, const _InArg& inArg) {
- const std::vector<std::string> invalidatedProperties;
- const std::vector<DBusPropertiesEntry<_InArg>> changedProperties = {wrapValue(propertyName, inArg)};
-
- return DBusStubSignalHelper<_In<const std::string, std::vector<DBusPropertiesEntry<_InArg>>, std::vector<std::string>>>::
- sendSignal(dbusStub.getObjectPath().c_str(),
- "org.freedesktop.DBus.Properties",
- "PropertiesChanged",
- "sa{sv}as",
- dbusStub.getDBusConnection(),
- dbusStub.getInterfaceName(),
- changedProperties,
- invalidatedProperties);
- }
-private:
- template <typename _ValueType>
- static DBusPropertiesEntry<_ValueType> wrapValue(const std::string& propertyName, _ValueType value) {
- CommonAPI::Variant<_ValueType> returnVariant(value);
-
- DBusLegacyVariantWrapper<CommonAPI::Variant<_ValueType>> wrappedReturnVariant;
- wrappedReturnVariant.contained_ = returnVariant;
-
- DBusPropertiesEntry<_ValueType> returnEntry(propertyName, wrappedReturnVariant);
-
- return returnEntry;
- }
-};
-
-template< class, class >
-class DBusMethodStubDispatcher;
-
-template <
- typename _StubClass,
- template <class...> class _In, class... _InArgs>
-class DBusMethodStubDispatcher<_StubClass, _In<_InArgs...> >: public DBusStubAdapterHelper<_StubClass>::StubDispatcher {
- public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef void (_StubClass::*_StubFunctor)(std::shared_ptr<CommonAPI::ClientId>, _InArgs...);
-
- DBusMethodStubDispatcher(_StubFunctor stubFunctor):
- stubFunctor_(stubFunctor) {
- }
-
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- return handleDBusMessage(dbusMessage, stub, dbusStubAdapterHelper, typename make_sequence<sizeof...(_InArgs)>::type());
- }
-
- private:
- template <int... _InArgIndices>
- inline bool handleDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
- DBusStubAdapterHelperType& dbusStubAdapterHelper,
- index_sequence<_InArgIndices...>) const {
- std::tuple<_InArgs...> argTuple;
-
- if (sizeof...(_InArgs) > 0) {
- DBusInputStream dbusInputStream(dbusMessage);
- 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.getSenderName()));
-
- (stub.get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(argTuple))...);
-
- return true;
- }
-
- _StubFunctor stubFunctor_;
-};
-
-
-template< class, class, class >
-class DBusMethodWithReplyStubDispatcher;
-
-template <
- typename _StubClass,
- template <class...> class _In, class... _InArgs,
- template <class...> class _Out, class... _OutArgs>
-class DBusMethodWithReplyStubDispatcher<_StubClass, _In<_InArgs...>, _Out<_OutArgs...> >:
- public DBusStubAdapterHelper<_StubClass>::StubDispatcher {
- public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef void (_StubClass::*_StubFunctor)(std::shared_ptr<CommonAPI::ClientId>, _InArgs..., _OutArgs&...);
-
- DBusMethodWithReplyStubDispatcher(_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;
- return handleDBusMessage(
- dbusMessage,
- stub,
- dbusStubAdapterHelper,
- typename make_sequence_range<sizeof...(_InArgs), 0>::type(),
- typename make_sequence_range<sizeof...(_OutArgs), sizeof...(_InArgs)>::type(),argTuple);
- }
- private:
- template <int... _InArgIndices, int... _OutArgIndices>
- inline bool handleDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
- DBusStubAdapterHelperType& dbusStubAdapterHelper,
- index_sequence<_InArgIndices...>,
- index_sequence<_OutArgIndices...>,
- std::tuple<_InArgs..., _OutArgs...> argTuple) const {
-
- if (sizeof...(_InArgs) > 0) {
- DBusInputStream dbusInputStream(dbusMessage);
- 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.getSenderName()));
-
- (stub.get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(argTuple))..., std::get<_OutArgIndices>(argTuple)...);
-
- DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(dbusReplySignature_);
-
- if (sizeof...(_OutArgs) > 0) {
- DBusOutputStream dbusOutputStream(dbusMessageReply);
- const bool success = DBusSerializableArguments<_OutArgs...>::serialize(dbusOutputStream, std::get<_OutArgIndices>(argTuple)...);
- if (!success)
- return false;
-
- dbusOutputStream.flush();
- }
-
- return dbusStubAdapterHelper.getDBusConnection()->sendDBusMessage(dbusMessageReply);
- }
-
- _StubFunctor stubFunctor_;
- const char* dbusReplySignature_;
-};
-
-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 {
- 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;
-
- 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;
- return handleDBusMessage(
- dbusMessage,
- stub,
- dbusStubAdapterHelper,
- typename make_sequence_range<sizeof...(_InArgs), 0>::type(),
- typename make_sequence_range<sizeof...(_OutArgs), sizeof...(_InArgs)>::type(),argTuple);
- }
-
- private:
- template <int... _InArgIndices, int... _OutArgIndices>
- inline bool handleDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
- DBusStubAdapterHelperType& dbusStubAdapterHelper,
- index_sequence<_InArgIndices...>,
- index_sequence<_OutArgIndices...>,
- std::tuple<_InArgs..., _OutArgs...> argTuple) const {
-
- if (sizeof...(_InArgs) > 0) {
- DBusInputStream dbusInputStream(dbusMessage);
- 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.getSenderName()));
-
- (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) {
- DBusOutputStream dbusOutputStream(dbusMessageReply);
- const bool success = DBusSerializableArguments<_OutArgs...>::serialize(dbusOutputStream, std::get<_OutArgIndices>(argTuple)...);
- if (!success)
- return false;
-
- dbusOutputStream.flush();
- }
-
- return dbusStubAdapterHelper.getDBusConnection()->sendDBusMessage(dbusMessageReply);
- }
-
- _StubFunctor stubFunctor_;
- const char* dbusReplySignature_;
-};
-
-
-template <typename _StubClass, typename _AttributeType>
-class DBusGetAttributeStubDispatcher: public virtual DBusStubAdapterHelper<_StubClass>::StubDispatcher {
- public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef const _AttributeType& (_StubClass::*GetStubFunctor)(std::shared_ptr<CommonAPI::ClientId>);
-
- DBusGetAttributeStubDispatcher(GetStubFunctor getStubFunctor, const char* dbusSignature):
- getStubFunctor_(getStubFunctor),
- dbusSignature_(dbusSignature) {
- }
-
- virtual ~DBusGetAttributeStubDispatcher() {};
-
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- return sendAttributeValueReply(dbusMessage, stub, dbusStubAdapterHelper);
- }
- protected:
- virtual bool sendAttributeValueReply(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(dbusSignature_);
- DBusOutputStream dbusOutputStream(dbusMessageReply);
-
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
-
- dbusOutputStream << (stub.get()->*getStubFunctor_)(clientId);
- dbusOutputStream.flush();
-
- return dbusStubAdapterHelper.getDBusConnection()->sendDBusMessage(dbusMessageReply);
- }
-
- GetStubFunctor getStubFunctor_;
- const char* dbusSignature_;
-};
-
-template <typename _StubClass>
-class DBusGetFreedesktopAttributeStubDispatcherBase {
-public:
- virtual ~DBusGetFreedesktopAttributeStubDispatcherBase() {}
- virtual void dispatchDBusMessageAndAppendReply(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusOutputStream& dbusOutputStream, const std::shared_ptr<DBusClientId>& clientId) = 0;
-};
-
-template <typename _StubClass, typename _AttributeType>
-class DBusGetFreedesktopAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>, public virtual DBusGetFreedesktopAttributeStubDispatcherBase<_StubClass> {
-public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::GetStubFunctor GetStubFunctor;
- DBusGetFreedesktopAttributeStubDispatcher(GetStubFunctor getStubFunctor) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor, "v") {
- }
-
- virtual ~DBusGetFreedesktopAttributeStubDispatcher() {};
-
- void dispatchDBusMessageAndAppendReply(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusOutputStream& dbusOutputStream, const std::shared_ptr<DBusClientId>& clientId) {
- CommonAPI::Variant<_AttributeType> returnVariant((stub.get()->*(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::getStubFunctor_))(clientId));
-
- DBusLegacyVariantWrapper<CommonAPI::Variant<_AttributeType>> wrappedReturnVariant;
- wrappedReturnVariant.contained_ = returnVariant;
-
- dbusOutputStream << wrappedReturnVariant;
- }
-protected:
- virtual bool sendAttributeValueReply(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::dbusSignature_);
- DBusOutputStream dbusOutputStream(dbusMessageReply);
-
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
-
- CommonAPI::Variant<_AttributeType> returnVariant((stub.get()->*(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::getStubFunctor_))(clientId));
-
- DBusLegacyVariantWrapper<CommonAPI::Variant<_AttributeType>> wrappedReturnVariant;
- wrappedReturnVariant.contained_ = returnVariant;
- dbusOutputStream << wrappedReturnVariant;
- dbusOutputStream.flush();
-
- return dbusStubAdapterHelper.getDBusConnection()->sendDBusMessage(dbusMessageReply);
- }
-};
-
-
-template <typename _StubClass, typename _AttributeType>
-class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatcher<_StubClass, _AttributeType> {
- public:
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
- typedef typename DBusStubAdapterHelperType::RemoteEventHandlerType RemoteEventHandlerType;
-
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::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) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor, dbusSignature),
- onRemoteSetFunctor_(onRemoteSetFunctor),
- onRemoteChangedFunctor_(onRemoteChangedFunctor) {
- }
-
- virtual ~DBusSetAttributeStubDispatcher() {};
-
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- bool attributeValueChanged;
-
- if (!setAttributeValue(dbusMessage, stub, dbusStubAdapterHelper, attributeValueChanged))
- return false;
-
- if (attributeValueChanged)
- notifyOnRemoteChanged(dbusStubAdapterHelper);
-
- return true;
- }
-
- protected:
- virtual _AttributeType retreiveAttributeValue(const DBusMessage& dbusMessage, bool& errorOccured) {
- errorOccured = false;
-
- DBusInputStream dbusInputStream(dbusMessage);
- _AttributeType attributeValue;
- dbusInputStream >> attributeValue;
-
- if (dbusInputStream.hasError()) {
- errorOccured = true;
- }
-
- return attributeValue;
- }
-
- inline bool setAttributeValue(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
- DBusStubAdapterHelperType& dbusStubAdapterHelper,
- bool& attributeValueChanged) {
- bool errorOccured;
- _AttributeType attributeValue = retreiveAttributeValue(dbusMessage, errorOccured);
-
- if(errorOccured) {
- return false;
- }
-
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
-
- attributeValueChanged = (dbusStubAdapterHelper.getRemoteEventHandler()->*onRemoteSetFunctor_)(clientId, std::move(attributeValue));
-
- return this->sendAttributeValueReply(dbusMessage, stub, dbusStubAdapterHelper);
- }
-
- inline void notifyOnRemoteChanged(DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- (dbusStubAdapterHelper.getRemoteEventHandler()->*onRemoteChangedFunctor_)();
- }
-
- inline const _AttributeType& getAttributeValue(std::shared_ptr<CommonAPI::ClientId> clientId, const std::shared_ptr<_StubClass>& stub) {
- return (stub.get()->*(this->getStubFunctor_))(clientId);
- }
-
- const OnRemoteSetFunctor onRemoteSetFunctor_;
- const OnRemoteChangedFunctor onRemoteChangedFunctor_;
-};
-
-template <typename _StubClass, typename _AttributeType>
-class DBusSetFreedesktopAttributeStubDispatcher: public virtual DBusGetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>, public virtual DBusSetAttributeStubDispatcher<_StubClass, _AttributeType> {
-public:
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::GetStubFunctor GetStubFunctor;
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
- typedef typename DBusStubAdapterHelperType::RemoteEventHandlerType RemoteEventHandlerType;
- typedef bool (RemoteEventHandlerType::*OnRemoteSetFunctor)(std::shared_ptr<CommonAPI::ClientId>, _AttributeType);
- typedef void (RemoteEventHandlerType::*OnRemoteChangedFunctor)();
-
- DBusSetFreedesktopAttributeStubDispatcher(GetStubFunctor getStubFunctor,
- OnRemoteSetFunctor onRemoteSetFunctor,
- OnRemoteChangedFunctor onRemoteChangedFunctor) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>(
- getStubFunctor,
- "v"),
- DBusGetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>(
- getStubFunctor),
- DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>(
- getStubFunctor,
- onRemoteSetFunctor,
- onRemoteChangedFunctor,
- "v") {
- }
-
- virtual ~DBusSetFreedesktopAttributeStubDispatcher() {};
-protected:
- virtual _AttributeType retreiveAttributeValue(const DBusMessage& dbusMessage, bool& errorOccured) {
- errorOccured = false;
- std::string interfaceName;
- std::string attributeName;
-
- DBusInputStream dbusInputStream(dbusMessage);
- DBusLegacyVariantWrapper<CommonAPI::Variant<_AttributeType>> variantValue;
- dbusInputStream >> interfaceName; // skip over interface and attribute name
- dbusInputStream >> attributeName;
- dbusInputStream >> variantValue;
- _AttributeType attributeValue = variantValue.contained_.template get<_AttributeType>() ;
-
- if (dbusInputStream.hasError()) {
- errorOccured = true;
- }
-
- return attributeValue;
- }
-};
-
-template <typename _StubClass, typename _AttributeType>
-class DBusSetObservableAttributeStubDispatcher: public virtual DBusSetAttributeStubDispatcher<_StubClass, _AttributeType> {
- public:
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
- typedef typename DBusStubAdapterHelperType::StubAdapterType StubAdapterType;
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>::GetStubFunctor GetStubFunctor;
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>::OnRemoteSetFunctor OnRemoteSetFunctor;
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>::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) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor, dbusSignature),
- DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor,
- onRemoteSetFunctor,
- onRemoteChangedFunctor,
- dbusSignature),
- fireChangedFunctor_(fireChangedFunctor) {
- }
-
- virtual ~DBusSetObservableAttributeStubDispatcher() {};
-
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- bool attributeValueChanged;
- if (!this->setAttributeValue(dbusMessage, stub, dbusStubAdapterHelper, attributeValueChanged))
- return false;
-
- if (attributeValueChanged) {
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
- fireAttributeValueChanged(clientId, dbusStubAdapterHelper, stub);
- this->notifyOnRemoteChanged(dbusStubAdapterHelper);
- }
- 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));
- }
-
- const FireChangedFunctor fireChangedFunctor_;
-};
-
-template <typename _StubClass, typename _AttributeType>
-class DBusSetFreedesktopObservableAttributeStubDispatcher: public virtual DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>, public virtual DBusSetObservableAttributeStubDispatcher<_StubClass, _AttributeType> {
-public:
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
- typedef typename DBusStubAdapterHelperType::StubAdapterType StubAdapterType;
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>::GetStubFunctor GetStubFunctor;
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>::OnRemoteSetFunctor OnRemoteSetFunctor;
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>::OnRemoteChangedFunctor OnRemoteChangedFunctor;
- typedef void (StubAdapterType::*FireChangedFunctor)(const _AttributeType&);
-
- DBusSetFreedesktopObservableAttributeStubDispatcher(GetStubFunctor getStubFunctor,
- OnRemoteSetFunctor onRemoteSetFunctor,
- OnRemoteChangedFunctor onRemoteChangedFunctor,
- FireChangedFunctor fireChangedFunctor) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor, "v"),
- DBusGetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor),
- DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor,
- onRemoteSetFunctor,
- onRemoteChangedFunctor,
- "v"),
- DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor,
- onRemoteSetFunctor,
- onRemoteChangedFunctor),
- DBusSetObservableAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor,
- onRemoteSetFunctor,
- onRemoteChangedFunctor,
- fireChangedFunctor,
- "v") {
- }
-};
-
-} // namespace DBus
-} // namespace CommonAPI
-
-#endif // COMMONAPI_DBUS_DBUS_STUB_ADAPTER_HELPER_H_
diff --git a/src/CommonAPI/DBus/DBusUtils.h b/src/CommonAPI/DBus/DBusUtils.h
deleted file mode 100644
index 3b74ef5..0000000
--- a/src/CommonAPI/DBus/DBusUtils.h
+++ /dev/null
@@ -1,39 +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/. */
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef DBUSUTILS_H_
-#define DBUSUTILS_H_
-
-#include <future>
-
-namespace CommonAPI {
-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<>
-inline bool checkReady<bool>(bool& returnedValue) {
- return returnedValue;
-}
-
-template<>
-inline bool checkReady<std::future_status>(std::future_status& returnedValue) {
- return returnedValue == std::future_status::ready;
-}
-
-} //namespace DBus
-} //namespace CommonAPI
-
-#endif /* DBUSUTILS_H_ */
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
new file mode 100644
index 0000000..3f92169
--- /dev/null
+++ b/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch
@@ -0,0 +1,201 @@
+From 1dcacc908826f59b580bd1d1a7541fb919d4bd97 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=BCrgen=20Gehring?= <juergen.gehring@bmw.de>
+Date: Thu, 23 Apr 2015 02:15:06 -0700
+Subject: [PATCH] Add dbus_connection_send_with_reply_set_notify function for
+ proper thread handling
+
+---
+ dbus/dbus-connection.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++
+ dbus/dbus-connection.h | 10 ++++
+ 2 files changed, 165 insertions(+)
+
+diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
+index e1068e3..233f179 100644
+--- a/dbus/dbus-connection.c
++++ b/dbus/dbus-connection.c
+@@ -3482,6 +3482,161 @@ dbus_connection_send_with_reply (DBusConnection *connection,
+ }
+
+ /**
++ * Queues a message to send, as with dbus_connection_send(),
++ * but also returns a #DBusPendingCall used to receive a reply to the
++ * message. If no reply is received in the given timeout_milliseconds,
++ * this function expires the pending reply and generates a synthetic
++ * error reply (generated in-process, not by the remote application)
++ * indicating that a timeout occurred.
++ *
++ * A #DBusPendingCall will see a reply message before any filters or
++ * registered object path handlers. See dbus_connection_dispatch() for
++ * details on when handlers are run.
++ *
++ * A #DBusPendingCall will always see exactly one reply message,
++ * unless it's cancelled with dbus_pending_call_cancel().
++ *
++ * If #NULL is passed for the pending_return, the #DBusPendingCall
++ * will still be generated internally, and used to track
++ * the message reply timeout. This means a timeout error will
++ * occur if no reply arrives, unlike with dbus_connection_send().
++ *
++ * If -1 is passed for the timeout, a sane default timeout is used. -1
++ * is typically the best value for the timeout for this reason, unless
++ * you want a very short or very long timeout. If #DBUS_TIMEOUT_INFINITE is
++ * passed for the timeout, no timeout will be set and the call will block
++ * forever.
++ *
++ * @warning if the connection is disconnected or you try to send Unix
++ * file descriptors on a connection that does not support them, the
++ * #DBusPendingCall will be set to #NULL, so be careful with this.
++ *
++ * @param connection the connection
++ * @param message the message to send
++ * @param pending_return return location for a #DBusPendingCall
++ * object, or #NULL if connection is disconnected or when you try to
++ * send Unix file descriptors on a connection that does not support
++ * them.
++ * @param timeout_milliseconds timeout in milliseconds, -1 (or
++ * #DBUS_TIMEOUT_USE_DEFAULT) for default or #DBUS_TIMEOUT_INFINITE for no
++ * timeout
++ * @returns #FALSE if no memory, #TRUE otherwise.
++ *
++ */
++dbus_bool_t
++dbus_connection_send_with_reply_set_notify (DBusConnection *connection,
++ DBusMessage *message,
++ DBusPendingCall **pending_return,
++ DBusPendingCallNotifyFunction function0,
++ void *user_data0,
++ DBusFreeFunction free_user_data0,
++ int timeout_milliseconds)
++{
++ DBusPendingCall *pending;
++ dbus_int32_t serial = -1;
++ DBusDispatchStatus status;
++
++ _dbus_return_val_if_fail (connection != NULL, FALSE);
++ _dbus_return_val_if_fail (message != NULL, FALSE);
++ _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1, FALSE);
++
++ if (pending_return)
++ *pending_return = NULL;
++
++ CONNECTION_LOCK (connection);
++
++#ifdef HAVE_UNIX_FD_PASSING
++
++ if (!_dbus_transport_can_pass_unix_fd(connection->transport) &&
++ message->n_unix_fds > 0)
++ {
++ /* Refuse to send fds on a connection that cannot handle
++ them. Unfortunately we cannot return a proper error here, so
++ the best we can do is return TRUE but leave *pending_return
++ as NULL. */
++ CONNECTION_UNLOCK (connection);
++ return TRUE;
++ }
++
++#endif
++
++ if (!_dbus_connection_get_is_connected_unlocked (connection))
++ {
++ CONNECTION_UNLOCK (connection);
++
++ return TRUE;
++ }
++
++ pending = _dbus_pending_call_new_unlocked (connection,
++ timeout_milliseconds,
++ reply_handler_timeout);
++
++ 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;
++ }
++
++ /* Assign a serial to the message */
++ serial = dbus_message_get_serial (message);
++ if (serial == 0)
++ {
++ serial = _dbus_connection_get_next_client_serial (connection);
++ dbus_message_set_serial (message, serial);
++ }
++
++ if (!_dbus_pending_call_set_timeout_error_unlocked (pending, message, serial))
++ goto error;
++
++ /* Insert the serial in the pending replies hash;
++ * hash takes a refcount on DBusPendingCall.
++ * Also, add the timeout.
++ */
++ if (!_dbus_connection_attach_pending_call_unlocked (connection,
++ pending))
++ goto error;
++
++ if (!_dbus_connection_send_unlocked_no_update (connection, message, NULL))
++ {
++ _dbus_connection_detach_pending_call_and_unlock (connection,
++ pending);
++ goto error_unlocked;
++ }
++
++ if (pending_return)
++ *pending_return = pending; /* hand off refcount */
++ else
++ {
++ _dbus_connection_detach_pending_call_unlocked (connection, pending);
++ /* we still have a ref to the pending call in this case, we unref
++ * after unlocking, below
++ */
++ }
++
++ status = _dbus_connection_get_dispatch_status_unlocked (connection);
++
++ /* this calls out to user code */
++ _dbus_connection_update_dispatch_status_and_unlock (connection, status);
++
++ if (pending_return == NULL)
++ dbus_pending_call_unref (pending);
++
++ return TRUE;
++
++ error:
++ CONNECTION_UNLOCK (connection);
++ error_unlocked:
++ dbus_pending_call_unref (pending);
++ return FALSE;
++}
++
++/**
+ * Sends a message and blocks a certain time period while waiting for
+ * a reply. This function does not reenter the main loop,
+ * i.e. messages other than the reply are queued up but not
+diff --git a/dbus/dbus-connection.h b/dbus/dbus-connection.h
+index fe4d04e..e8cedf1 100644
+--- a/dbus/dbus-connection.h
++++ b/dbus/dbus-connection.h
+@@ -229,6 +229,16 @@ dbus_bool_t dbus_connection_send_with_reply (DBusConnection
+ DBusMessage *message,
+ DBusPendingCall **pending_return,
+ int timeout_milliseconds);
++
++DBUS_EXPORT
++dbus_bool_t dbus_connection_send_with_reply_set_notify (DBusConnection *connection,
++ DBusMessage *message,
++ DBusPendingCall **pending_return,
++ DBusPendingCallNotifyFunction function0,
++ void * user_data0,
++ DBusFreeFunction free_user_data0,
++ int timeout_milliseconds);
++
+ DBUS_EXPORT
+ DBusMessage * dbus_connection_send_with_reply_and_block (DBusConnection *connection,
+ DBusMessage *message,
+--
+1.9.1
+
diff --git a/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch b/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
new file mode 100644
index 0000000..78b073c
--- /dev/null
+++ b/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
@@ -0,0 +1,217 @@
+From 7b0925938400b970bf699a9188fe03b7271eeead Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=BCrgen=20Gehring?= <juergen.gehring@bmw.de>
+Date: Thu, 23 Apr 2015 01:18:11 -0700
+Subject: [PATCH] Add functions to support querying and manipulating the
+ message body and signature. This is useful for code generators, which can
+ generate custom marshaling functions based on a given IDL. Those functions
+ tend to be optimized and faster than the generic iterator based marshaling.
+
+---
+ dbus/dbus-message.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ dbus/dbus-message.h | 14 ++++++++
+ dbus/dbus-string.c | 16 +++++++++
+ dbus/dbus-string.h | 5 +++
+ 4 files changed, 134 insertions(+)
+
+diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
+index 43cb1be..d34663a 100644
+--- a/dbus/dbus-message.c
++++ b/dbus/dbus-message.c
+@@ -3445,6 +3445,47 @@ dbus_message_get_sender (DBusMessage *message)
+ }
+
+ /**
++ * Sets the signature of the message, i.e. the arguments in the
++ * message payload. The signature includes only "in" arguments for
++ * #DBUS_MESSAGE_TYPE_METHOD_CALL and only "out" arguments for
++ * #DBUS_MESSAGE_TYPE_METHOD_RETURN, so is slightly different from
++ * what you might expect (it does not include the signature of the
++ * entire C++-style method).
++ *
++ * The signature is a string made up of type codes such as
++ * #DBUS_TYPE_INT32. The string is terminated with nul (nul is also
++ * the value of #DBUS_TYPE_INVALID). The macros such as
++ * #DBUS_TYPE_INT32 evaluate to integers; to assemble a signature you
++ * may find it useful to use the string forms, such as
++ * #DBUS_TYPE_INT32_AS_STRING.
++ *
++ * An "unset" or #NULL signature is considered the same as an empty
++ * signature. In fact dbus_message_get_signature() will never return
++ * #NULL.
++ *
++ * @param message the message
++ * @param signature the type signature or #NULL to unset
++ * @returns #FALSE if no memory
++ */
++dbus_bool_t
++dbus_message_set_signature (DBusMessage *message,
++ const char *signature)
++{
++ _dbus_return_val_if_fail (message != NULL, FALSE);
++ _dbus_return_val_if_fail (!message->locked, FALSE);
++ _dbus_return_val_if_fail (signature == NULL ||
++ _dbus_check_is_valid_signature (signature), FALSE);
++ /* can't delete the signature if you have a message body */
++ _dbus_return_val_if_fail (_dbus_string_get_length (&message->body) == 0 ||
++ signature != NULL, FALSE);
++
++ return set_or_delete_string_field (message,
++ DBUS_HEADER_FIELD_SIGNATURE,
++ DBUS_TYPE_SIGNATURE,
++ signature);
++}
++
++/**
+ * Gets the type signature of the message, i.e. the arguments in the
+ * message payload. The signature includes only "in" arguments for
+ * #DBUS_MESSAGE_TYPE_METHOD_CALL and only "out" arguments for
+@@ -4632,6 +4673,64 @@ dbus_message_type_to_string (int type)
+ }
+
+ /**
++ * Returns pointer to the buffer used to store the message body.
++ *
++ * @param message the message
++ * @return pointer to the message body memory
++ */
++char*
++dbus_message_get_body (DBusMessage *message) {
++ _dbus_return_val_if_fail (message != NULL, NULL);
++
++ return _dbus_string_get_data(&(message->body));
++}
++
++/**
++ * Adjust the length of the message body buffer. The memory will be reallocated
++ * if the new length is bigger than the already allocated size.
++ *
++ * @see dbus_message_get_body_allocated
++ * @param message the message
++ * @param length the new length of the body
++ * @return #TRUE if successful
++ */
++dbus_bool_t
++dbus_message_set_body_length (DBusMessage *message,
++ int length) {
++ _dbus_return_val_if_fail (message != NULL, FALSE);
++ _dbus_return_val_if_fail (length >= 0, FALSE);
++
++ return _dbus_string_set_length(&(message->body), length);
++}
++
++/**
++ * Gets the length of the message body buffer.
++ *
++ * @param message the message
++ * @param length the new length of the body
++ * @return the length of the body buffer
++ */
++int
++dbus_message_get_body_length (DBusMessage *message) {
++ _dbus_return_val_if_fail (message != NULL, 0);
++
++ return _dbus_string_get_length(&(message->body));
++}
++
++/**
++ * Gets the allocated memory size used to hold the message body.
++ *
++ * @param message the message
++ * @return size of the allocated message body memory
++ */
++int
++dbus_message_get_body_allocated (DBusMessage *message) {
++ _dbus_return_val_if_fail (message != NULL, 0);
++
++ return _dbus_string_get_allocated(&(message->body));
++}
++
++/**
+ * Turn a DBusMessage into the marshalled form as described in the D-Bus
+ * specification.
+ *
+diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h
+index 4fd44da..76377b8 100644
+--- a/dbus/dbus-message.h
++++ b/dbus/dbus-message.h
+@@ -138,6 +138,9 @@ dbus_bool_t dbus_message_set_sender (DBusMessage *message,
+ DBUS_EXPORT
+ const char* dbus_message_get_sender (DBusMessage *message);
+ DBUS_EXPORT
++dbus_bool_t dbus_message_set_signature (DBusMessage *message,
++ const char *signature);
++DBUS_EXPORT
+ const char* dbus_message_get_signature (DBusMessage *message);
+ DBUS_EXPORT
+ void dbus_message_set_no_reply (DBusMessage *message,
+@@ -262,6 +265,17 @@ dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter,
+ DBUS_EXPORT
+ void dbus_message_iter_abandon_container (DBusMessageIter *iter,
+ DBusMessageIter *sub);
++DBUS_EXPORT
++char* dbus_message_get_body (DBusMessage *message);
++
++DBUS_EXPORT
++dbus_bool_t dbus_message_set_body_length (DBusMessage *message,
++ int length);
++DBUS_EXPORT
++int dbus_message_get_body_length (DBusMessage *message);
++
++DBUS_EXPORT
++int dbus_message_get_body_allocated (DBusMessage *message);
+
+ DBUS_EXPORT
+ void dbus_message_lock (DBusMessage *message);
+diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c
+index 0f63612..a084eca 100644
+--- a/dbus/dbus-string.c
++++ b/dbus/dbus-string.c
+@@ -730,6 +730,22 @@ _dbus_string_get_length (const DBusString *str)
+ }
+ #endif /* !_dbus_string_get_length */
+
++/* Only have the function if we don't have the macro */
++#ifndef _dbus_string_get_allocated
++/**
++ * Gets the allocated length of a string (not including nul termination).
++ *
++ * @returns the allocated length.
++ */
++int
++_dbus_string_get_allocated(const DBusString *str)
++{
++ DBUS_CONST_STRING_PREAMBLE (str);
++
++ return real->allocated;
++}
++#endif /* !_dbus_string_get_allocated */
++
+ /**
+ * Makes a string longer by the given number of bytes. Checks whether
+ * adding additional_length to the current length would overflow an
+diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h
+index 86fb8c3..bfa2a39 100644
+--- a/dbus/dbus-string.h
++++ b/dbus/dbus-string.h
+@@ -61,6 +61,7 @@ struct DBusString
+ */
+ #define _dbus_string_get_data(s) ((char*)(((DBusString*)(s))->dummy1))
+ #define _dbus_string_get_length(s) (((DBusString*)(s))->dummy2)
++#define _dbus_string_get_allocated(s) (((DBusString*)(s))->dummy3 - _DBUS_STRING_ALLOCATION_PADDING)
+ #define _dbus_string_set_byte(s, i, b) ((((unsigned char*)(((DBusString*)(s))->dummy1))[(i)]) = (unsigned char) (b))
+ #define _dbus_string_get_byte(s, i) (((const unsigned char*)(((DBusString*)(s))->dummy1))[(i)])
+ #define _dbus_string_get_const_data(s) ((const char*)(((DBusString*)(s))->dummy1))
+@@ -131,6 +132,10 @@ void _dbus_string_copy_to_buffer_with_nul (const DBusString *str,
+ int _dbus_string_get_length (const DBusString *str);
+ #endif /* !_dbus_string_get_length */
+
++#ifndef _dbus_string_get_allocated
++int _dbus_string_get_allocated (const DBusString *str);
++#endif /* !_dbus_string_get_allocated */
++
+ dbus_bool_t _dbus_string_lengthen (DBusString *str,
+ int additional_length);
+ void _dbus_string_shorten (DBusString *str,
+--
+1.9.1
+
diff --git a/src/murmurhash/MurmurHash3.cpp b/src/murmurhash/MurmurHash3.cpp
index 3ee5885..2e06040 100644
--- a/src/murmurhash/MurmurHash3.cpp
+++ b/src/murmurhash/MurmurHash3.cpp
@@ -7,7 +7,7 @@
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
-#include "MurmurHash3.h"
+#include <murmurhash/MurmurHash3.h>
//-----------------------------------------------------------------------------
// Platform-specific functions and macros
diff --git a/src/murmurhash/MurmurHash3.h b/src/murmurhash/MurmurHash3.h
deleted file mode 100644
index 54e9d3f..0000000
--- a/src/murmurhash/MurmurHash3.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//-----------------------------------------------------------------------------
-// MurmurHash3 was written by Austin Appleby, and is placed in the public
-// domain. The author hereby disclaims copyright to this source code.
-
-#ifndef _MURMURHASH3_H_
-#define _MURMURHASH3_H_
-
-//-----------------------------------------------------------------------------
-// Platform-specific functions and macros
-
-// Microsoft Visual Studio
-
-#if defined(_MSC_VER)
-
-typedef unsigned char uint8_t;
-typedef unsigned long uint32_t;
-typedef unsigned __int64 uint64_t;
-
-// Other compilers
-
-#else // defined(_MSC_VER)
-
-#include <stdint.h>
-
-#endif // !defined(_MSC_VER)
-
-//-----------------------------------------------------------------------------
-
-void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out );
-
-void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out );
-
-void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );
-
-//-----------------------------------------------------------------------------
-
-#endif // _MURMURHASH3_H_
diff --git a/src/pugixml/pugiconfig.hpp b/src/pugixml/pugiconfig.hpp
deleted file mode 100644
index 5a63fd4..0000000
--- a/src/pugixml/pugiconfig.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * pugixml parser - version 1.2
- * --------------------------------------------------------
- * Copyright (C) 2006-2012, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
- * Report bugs and download new versions at http://pugixml.org/
- *
- * This library is distributed under the MIT License. See notice at the end
- * of this file.
- *
- * This work is based on the pugxml parser, which is:
- * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
- */
-
-#ifndef HEADER_PUGICONFIG_HPP
-#define HEADER_PUGICONFIG_HPP
-
-// Uncomment this to enable wchar_t mode
-// #define PUGIXML_WCHAR_MODE
-
-// Uncomment this to disable XPath
-// #define PUGIXML_NO_XPATH
-
-// Uncomment this to disable STL
-// #define PUGIXML_NO_STL
-
-// Uncomment this to disable exceptions
-// #define PUGIXML_NO_EXCEPTIONS
-
-// Set this to control attributes for public classes/functions, i.e.:
-// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
-// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
-// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
-// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
-
-// Uncomment this to switch to header-only version
-// #define PUGIXML_HEADER_ONLY
-// #include "pugixml.cpp"
-
-// Tune these constants to adjust memory-related behavior
-// #define PUGIXML_MEMORY_PAGE_SIZE 32768
-// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
-// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
-
-#endif
-
-/**
- * Copyright (c) 2006-2012 Arseny Kapoulkine
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
diff --git a/src/pugixml/pugixml.cpp b/src/pugixml/pugixml.cpp
index 4035ab1..4e45ba3 100644
--- a/src/pugixml/pugixml.cpp
+++ b/src/pugixml/pugixml.cpp
@@ -14,7 +14,7 @@
#ifndef SOURCE_PUGIXML_CPP
#define SOURCE_PUGIXML_CPP
-#include "pugixml.hpp"
+#include <pugixml/pugixml.hpp>
#include <stdlib.h>
#include <stdio.h>
diff --git a/src/pugixml/pugixml.hpp b/src/pugixml/pugixml.hpp
deleted file mode 100644
index 77b4dcf..0000000
--- a/src/pugixml/pugixml.hpp
+++ /dev/null
@@ -1,1265 +0,0 @@
-/**
- * pugixml parser - version 1.2
- * --------------------------------------------------------
- * Copyright (C) 2006-2012, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
- * Report bugs and download new versions at http://pugixml.org/
- *
- * This library is distributed under the MIT License. See notice at the end
- * of this file.
- *
- * This work is based on the pugxml parser, which is:
- * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
- */
-
-#ifndef PUGIXML_VERSION
-// Define version macro; evaluates to major * 100 + minor so that it's safe to use in less-than comparisons
-# define PUGIXML_VERSION 120
-#endif
-
-// Include user configuration file (this can define various configuration macros)
-#include "pugiconfig.hpp"
-
-#ifndef HEADER_PUGIXML_HPP
-#define HEADER_PUGIXML_HPP
-
-// Include stddef.h for size_t and ptrdiff_t
-#include <stddef.h>
-
-// Include exception header for XPath
-#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
-# include <exception>
-#endif
-
-// Include STL headers
-#ifndef PUGIXML_NO_STL
-# include <iterator>
-# include <iosfwd>
-# include <string>
-#endif
-
-// Macro for deprecated features
-#ifndef PUGIXML_DEPRECATED
-# if defined(__GNUC__)
-# define PUGIXML_DEPRECATED __attribute__((deprecated))
-# elif defined(_MSC_VER) && _MSC_VER >= 1300
-# define PUGIXML_DEPRECATED __declspec(deprecated)
-# else
-# define PUGIXML_DEPRECATED
-# endif
-#endif
-
-// If no API is defined, assume default
-#ifndef PUGIXML_API
-# define PUGIXML_API
-#endif
-
-// If no API for classes is defined, assume default
-#ifndef PUGIXML_CLASS
-# define PUGIXML_CLASS PUGIXML_API
-#endif
-
-// If no API for functions is defined, assume default
-#ifndef PUGIXML_FUNCTION
-# define PUGIXML_FUNCTION PUGIXML_API
-#endif
-
-// Character interface macros
-#ifdef PUGIXML_WCHAR_MODE
-# define PUGIXML_TEXT(t) L ## t
-# define PUGIXML_CHAR wchar_t
-#else
-# define PUGIXML_TEXT(t) t
-# define PUGIXML_CHAR char
-#endif
-
-namespace pugi
-{
- // Character type used for all internal storage and operations; depends on PUGIXML_WCHAR_MODE
- typedef PUGIXML_CHAR char_t;
-
-#ifndef PUGIXML_NO_STL
- // String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
- typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
-#endif
-}
-
-// The PugiXML namespace
-namespace pugi
-{
- // Tree node types
- enum xml_node_type
- {
- node_null, // Empty (null) node handle
- node_document, // A document tree's absolute root
- node_element, // Element tag, i.e. '<node/>'
- node_pcdata, // Plain character data, i.e. 'text'
- node_cdata, // Character data, i.e. '<![CDATA[text]]>'
- node_comment, // Comment tag, i.e. '<!-- text -->'
- node_pi, // Processing instruction, i.e. '<?name?>'
- node_declaration, // Document declaration, i.e. '<?xml version="1.0"?>'
- node_doctype // Document type declaration, i.e. '<!DOCTYPE doc>'
- };
-
- // Parsing options
-
- // Minimal parsing mode (equivalent to turning all other flags off).
- // Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
- const unsigned int parse_minimal = 0x0000;
-
- // This flag determines if processing instructions (node_pi) are added to the DOM tree. This flag is off by default.
- const unsigned int parse_pi = 0x0001;
-
- // This flag determines if comments (node_comment) are added to the DOM tree. This flag is off by default.
- const unsigned int parse_comments = 0x0002;
-
- // This flag determines if CDATA sections (node_cdata) are added to the DOM tree. This flag is on by default.
- const unsigned int parse_cdata = 0x0004;
-
- // This flag determines if plain character data (node_pcdata) that consist only of whitespace are added to the DOM tree.
- // This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
- const unsigned int parse_ws_pcdata = 0x0008;
-
- // This flag determines if character and entity references are expanded during parsing. This flag is on by default.
- const unsigned int parse_escapes = 0x0010;
-
- // This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
- const unsigned int parse_eol = 0x0020;
-
- // This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
- const unsigned int parse_wconv_attribute = 0x0040;
-
- // This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
- const unsigned int parse_wnorm_attribute = 0x0080;
-
- // This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
- const unsigned int parse_declaration = 0x0100;
-
- // This flag determines if document type declaration (node_doctype) is added to the DOM tree. This flag is off by default.
- const unsigned int parse_doctype = 0x0200;
-
- // This flag determines if plain character data (node_pcdata) that is the only child of the parent node and that consists only
- // of whitespace is added to the DOM tree.
- // This flag is off by default; turning it on may result in slower parsing and more memory consumption.
- const unsigned int parse_ws_pcdata_single = 0x0400;
-
- // The default parsing mode.
- // Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
- // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
- const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
-
- // The full parsing mode.
- // Nodes of all types are added to the DOM tree, character/reference entities are expanded,
- // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
- const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
-
- // These flags determine the encoding of input data for XML document
- enum xml_encoding
- {
- encoding_auto, // Auto-detect input encoding using BOM or < / <? detection; use UTF8 if BOM is not found
- encoding_utf8, // UTF8 encoding
- encoding_utf16_le, // Little-endian UTF16
- encoding_utf16_be, // Big-endian UTF16
- encoding_utf16, // UTF16 with native endianness
- encoding_utf32_le, // Little-endian UTF32
- encoding_utf32_be, // Big-endian UTF32
- encoding_utf32, // UTF32 with native endianness
- encoding_wchar, // The same encoding wchar_t has (either UTF16 or UTF32)
- encoding_latin1
- };
-
- // Formatting flags
-
- // Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is on by default.
- const unsigned int format_indent = 0x01;
-
- // Write encoding-specific BOM to the output stream. This flag is off by default.
- const unsigned int format_write_bom = 0x02;
-
- // Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
- const unsigned int format_raw = 0x04;
-
- // Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
- const unsigned int format_no_declaration = 0x08;
-
- // Don't escape attribute values and PCDATA contents. This flag is off by default.
- const unsigned int format_no_escapes = 0x10;
-
- // Open file using text mode in xml_document::save_file. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
- const unsigned int format_save_file_text = 0x20;
-
- // The default set of formatting flags.
- // Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
- const unsigned int format_default = format_indent;
-
- // Forward declarations
- struct xml_attribute_struct;
- struct xml_node_struct;
-
- class xml_node_iterator;
- class xml_attribute_iterator;
- class xml_named_node_iterator;
-
- class xml_tree_walker;
-
- class xml_node;
-
- class xml_text;
-
- #ifndef PUGIXML_NO_XPATH
- class xpath_node;
- class xpath_node_set;
- class xpath_query;
- class xpath_variable_set;
- #endif
-
- // Range-based for loop support
- template <typename It> class xml_object_range
- {
- public:
- typedef It const_iterator;
-
- xml_object_range(It b, It e): _begin(b), _end(e)
- {
- }
-
- It begin() const { return _begin; }
- It end() const { return _end; }
-
- private:
- It _begin, _end;
- };
-
- // Writer interface for node printing (see xml_node::print)
- class PUGIXML_CLASS xml_writer
- {
- public:
- virtual ~xml_writer() {}
-
- // Write memory chunk into stream/file/whatever
- virtual void write(const void* data, size_t size) = 0;
- };
-
- // xml_writer implementation for FILE*
- class PUGIXML_CLASS xml_writer_file: public xml_writer
- {
- public:
- // Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
- xml_writer_file(void* file);
-
- virtual void write(const void* data, size_t size);
-
- private:
- void* file;
- };
-
- #ifndef PUGIXML_NO_STL
- // xml_writer implementation for streams
- class PUGIXML_CLASS xml_writer_stream: public xml_writer
- {
- public:
- // Construct writer from an output stream object
- xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
- xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
-
- virtual void write(const void* data, size_t size);
-
- private:
- std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
- std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
- };
- #endif
-
- // A light-weight handle for manipulating attributes in DOM tree
- class PUGIXML_CLASS xml_attribute
- {
- friend class xml_attribute_iterator;
- friend class xml_node;
-
- private:
- xml_attribute_struct* _attr;
-
- typedef void (*unspecified_bool_type)(xml_attribute***);
-
- public:
- // Default constructor. Constructs an empty attribute.
- xml_attribute();
-
- // Constructs attribute from internal pointer
- explicit xml_attribute(xml_attribute_struct* attr);
-
- // Safe bool conversion operator
- operator unspecified_bool_type() const;
-
- // Borland C++ workaround
- bool operator!() const;
-
- // Comparison operators (compares wrapped attribute pointers)
- bool operator==(const xml_attribute& r) const;
- bool operator!=(const xml_attribute& r) const;
- bool operator<(const xml_attribute& r) const;
- bool operator>(const xml_attribute& r) const;
- bool operator<=(const xml_attribute& r) const;
- bool operator>=(const xml_attribute& r) const;
-
- // Check if attribute is empty
- bool empty() const;
-
- // Get attribute name/value, or "" if attribute is empty
- const char_t* name() const;
- const char_t* value() const;
-
- // Get attribute value, or the default value if attribute is empty
- const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
-
- // Get attribute value as a number, or the default value if conversion did not succeed or attribute is empty
- int as_int(int def = 0) const;
- unsigned int as_uint(unsigned int def = 0) const;
- double as_double(double def = 0) const;
- float as_float(float def = 0) const;
-
- // Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
- bool as_bool(bool def = false) const;
-
- // Set attribute name/value (returns false if attribute is empty or there is not enough memory)
- bool set_name(const char_t* rhs);
- bool set_value(const char_t* rhs);
-
- // Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
- bool set_value(int rhs);
- bool set_value(unsigned int rhs);
- bool set_value(double rhs);
- bool set_value(bool rhs);
-
- // Set attribute value (equivalent to set_value without error checking)
- xml_attribute& operator=(const char_t* rhs);
- xml_attribute& operator=(int rhs);
- xml_attribute& operator=(unsigned int rhs);
- xml_attribute& operator=(double rhs);
- xml_attribute& operator=(bool rhs);
-
- // Get next/previous attribute in the attribute list of the parent node
- xml_attribute next_attribute() const;
- xml_attribute previous_attribute() const;
-
- // Get hash value (unique for handles to the same object)
- size_t hash_value() const;
-
- // Get internal pointer
- xml_attribute_struct* internal_object() const;
- };
-
-#ifdef __BORLANDC__
- // Borland C++ workaround
- bool PUGIXML_FUNCTION operator&&(const xml_attribute& lhs, bool rhs);
- bool PUGIXML_FUNCTION operator||(const xml_attribute& lhs, bool rhs);
-#endif
-
- // A light-weight handle for manipulating nodes in DOM tree
- class PUGIXML_CLASS xml_node
- {
- friend class xml_attribute_iterator;
- friend class xml_node_iterator;
- friend class xml_named_node_iterator;
-
- protected:
- xml_node_struct* _root;
-
- typedef void (*unspecified_bool_type)(xml_node***);
-
- public:
- // Default constructor. Constructs an empty node.
- xml_node();
-
- // Constructs node from internal pointer
- explicit xml_node(xml_node_struct* p);
-
- // Safe bool conversion operator
- operator unspecified_bool_type() const;
-
- // Borland C++ workaround
- bool operator!() const;
-
- // Comparison operators (compares wrapped node pointers)
- bool operator==(const xml_node& r) const;
- bool operator!=(const xml_node& r) const;
- bool operator<(const xml_node& r) const;
- bool operator>(const xml_node& r) const;
- bool operator<=(const xml_node& r) const;
- bool operator>=(const xml_node& r) const;
-
- // Check if node is empty.
- bool empty() const;
-
- // Get node type
- xml_node_type type() const;
-
- // Get node name/value, or "" if node is empty or it has no name/value
- const char_t* name() const;
- const char_t* value() const;
-
- // Get attribute list
- xml_attribute first_attribute() const;
- xml_attribute last_attribute() const;
-
- // Get children list
- xml_node first_child() const;
- xml_node last_child() const;
-
- // Get next/previous sibling in the children list of the parent node
- xml_node next_sibling() const;
- xml_node previous_sibling() const;
-
- // Get parent node
- xml_node parent() const;
-
- // Get root of DOM tree this node belongs to
- xml_node root() const;
-
- // Get text object for the current node
- xml_text text() const;
-
- // Get child, attribute or next/previous sibling with the specified name
- xml_node child(const char_t* name) const;
- xml_attribute attribute(const char_t* name) const;
- xml_node next_sibling(const char_t* name) const;
- xml_node previous_sibling(const char_t* name) const;
-
- // Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
- const char_t* child_value() const;
-
- // Get child value of child with specified name. Equivalent to child(name).child_value().
- const char_t* child_value(const char_t* name) const;
-
- // Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
- bool set_name(const char_t* rhs);
- bool set_value(const char_t* rhs);
-
- // Add attribute with specified name. Returns added attribute, or empty attribute on errors.
- xml_attribute append_attribute(const char_t* name);
- xml_attribute prepend_attribute(const char_t* name);
- xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
- xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
-
- // Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
- xml_attribute append_copy(const xml_attribute& proto);
- xml_attribute prepend_copy(const xml_attribute& proto);
- xml_attribute insert_copy_after(const xml_attribute& proto, const xml_attribute& attr);
- xml_attribute insert_copy_before(const xml_attribute& proto, const xml_attribute& attr);
-
- // Add child node with specified type. Returns added node, or empty node on errors.
- xml_node append_child(xml_node_type type = node_element);
- xml_node prepend_child(xml_node_type type = node_element);
- xml_node insert_child_after(xml_node_type type, const xml_node& node);
- xml_node insert_child_before(xml_node_type type, const xml_node& node);
-
- // Add child element with specified name. Returns added node, or empty node on errors.
- xml_node append_child(const char_t* name);
- xml_node prepend_child(const char_t* name);
- xml_node insert_child_after(const char_t* name, const xml_node& node);
- xml_node insert_child_before(const char_t* name, const xml_node& node);
-
- // Add a copy of the specified node as a child. Returns added node, or empty node on errors.
- xml_node append_copy(const xml_node& proto);
- xml_node prepend_copy(const xml_node& proto);
- xml_node insert_copy_after(const xml_node& proto, const xml_node& node);
- xml_node insert_copy_before(const xml_node& proto, const xml_node& node);
-
- // Remove specified attribute
- bool remove_attribute(const xml_attribute& a);
- bool remove_attribute(const char_t* name);
-
- // Remove specified child
- bool remove_child(const xml_node& n);
- bool remove_child(const char_t* name);
-
- // Find attribute using predicate. Returns first attribute for which predicate returned true.
- template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
- {
- if (!_root) return xml_attribute();
-
- for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
- if (pred(attrib))
- return attrib;
-
- return xml_attribute();
- }
-
- // Find child node using predicate. Returns first child for which predicate returned true.
- template <typename Predicate> xml_node find_child(Predicate pred) const
- {
- if (!_root) return xml_node();
-
- for (xml_node node = first_child(); node; node = node.next_sibling())
- if (pred(node))
- return node;
-
- return xml_node();
- }
-
- // Find node from subtree using predicate. Returns first node from subtree (depth-first), for which predicate returned true.
- template <typename Predicate> xml_node find_node(Predicate pred) const
- {
- if (!_root) return xml_node();
-
- xml_node cur = first_child();
-
- while (cur._root && cur._root != _root)
- {
- if (pred(cur)) return cur;
-
- if (cur.first_child()) cur = cur.first_child();
- else if (cur.next_sibling()) cur = cur.next_sibling();
- else
- {
- while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
-
- if (cur._root != _root) cur = cur.next_sibling();
- }
- }
-
- return xml_node();
- }
-
- // Find child node by attribute name/value
- xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
- xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
-
- #ifndef PUGIXML_NO_STL
- // Get the absolute node path from root as a text string.
- string_t path(char_t delimiter = '/') const;
- #endif
-
- // Search for a node by path consisting of node names and . or .. elements.
- xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
-
- // Recursively traverse subtree with xml_tree_walker
- bool traverse(xml_tree_walker& walker);
-
- #ifndef PUGIXML_NO_XPATH
- // Select single node by evaluating XPath query. Returns first node from the resulting node set.
- xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = 0) const;
- xpath_node select_single_node(const xpath_query& query) const;
-
- // Select node set by evaluating XPath query
- xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
- xpath_node_set select_nodes(const xpath_query& query) const;
- #endif
-
- // Print subtree using a writer object
- void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
-
- #ifndef PUGIXML_NO_STL
- // Print subtree to stream
- void print(std::basic_ostream<char, std::char_traits<char> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
- void print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
- #endif
-
- // Child nodes iterators
- typedef xml_node_iterator iterator;
-
- iterator begin() const;
- iterator end() const;
-
- // Attribute iterators
- typedef xml_attribute_iterator attribute_iterator;
-
- attribute_iterator attributes_begin() const;
- attribute_iterator attributes_end() const;
-
- // Range-based for support
- xml_object_range<xml_node_iterator> children() const;
- xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
- xml_object_range<xml_attribute_iterator> attributes() const;
-
- // Get node offset in parsed file/string (in char_t units) for debugging purposes
- ptrdiff_t offset_debug() const;
-
- // Get hash value (unique for handles to the same object)
- size_t hash_value() const;
-
- // Get internal pointer
- xml_node_struct* internal_object() const;
- };
-
-#ifdef __BORLANDC__
- // Borland C++ workaround
- bool PUGIXML_FUNCTION operator&&(const xml_node& lhs, bool rhs);
- bool PUGIXML_FUNCTION operator||(const xml_node& lhs, bool rhs);
-#endif
-
- // A helper for working with text inside PCDATA nodes
- class PUGIXML_CLASS xml_text
- {
- friend class xml_node;
-
- xml_node_struct* _root;
-
- typedef void (*unspecified_bool_type)(xml_text***);
-
- explicit xml_text(xml_node_struct* root);
-
- xml_node_struct* _data_new();
- xml_node_struct* _data() const;
-
- public:
- // Default constructor. Constructs an empty object.
- xml_text();
-
- // Safe bool conversion operator
- operator unspecified_bool_type() const;
-
- // Borland C++ workaround
- bool operator!() const;
-
- // Check if text object is empty
- bool empty() const;
-
- // Get text, or "" if object is empty
- const char_t* get() const;
-
- // Get text, or the default value if object is empty
- const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
-
- // Get text as a number, or the default value if conversion did not succeed or object is empty
- int as_int(int def = 0) const;
- unsigned int as_uint(unsigned int def = 0) const;
- double as_double(double def = 0) const;
- float as_float(float def = 0) const;
-
- // Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
- bool as_bool(bool def = false) const;
-
- // Set text (returns false if object is empty or there is not enough memory)
- bool set(const char_t* rhs);
-
- // Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
- bool set(int rhs);
- bool set(unsigned int rhs);
- bool set(double rhs);
- bool set(bool rhs);
-
- // Set text (equivalent to set without error checking)
- xml_text& operator=(const char_t* rhs);
- xml_text& operator=(int rhs);
- xml_text& operator=(unsigned int rhs);
- xml_text& operator=(double rhs);
- xml_text& operator=(bool rhs);
-
- // Get the data node (node_pcdata or node_cdata) for this object
- xml_node data() const;
- };
-
-#ifdef __BORLANDC__
- // Borland C++ workaround
- bool PUGIXML_FUNCTION operator&&(const xml_text& lhs, bool rhs);
- bool PUGIXML_FUNCTION operator||(const xml_text& lhs, bool rhs);
-#endif
-
- // Child node iterator (a bidirectional iterator over a collection of xml_node)
- class PUGIXML_CLASS xml_node_iterator
- {
- friend class xml_node;
-
- private:
- mutable xml_node _wrap;
- xml_node _parent;
-
- xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent);
-
- public:
- // Iterator traits
- typedef ptrdiff_t difference_type;
- typedef xml_node value_type;
- typedef xml_node* pointer;
- typedef xml_node& reference;
-
- #ifndef PUGIXML_NO_STL
- typedef std::bidirectional_iterator_tag iterator_category;
- #endif
-
- // Default constructor
- xml_node_iterator();
-
- // Construct an iterator which points to the specified node
- xml_node_iterator(const xml_node& node);
-
- // Iterator operators
- bool operator==(const xml_node_iterator& rhs) const;
- bool operator!=(const xml_node_iterator& rhs) const;
-
- xml_node& operator*() const;
- xml_node* operator->() const;
-
- const xml_node_iterator& operator++();
- xml_node_iterator operator++(int);
-
- const xml_node_iterator& operator--();
- xml_node_iterator operator--(int);
- };
-
- // Attribute iterator (a bidirectional iterator over a collection of xml_attribute)
- class PUGIXML_CLASS xml_attribute_iterator
- {
- friend class xml_node;
-
- private:
- mutable xml_attribute _wrap;
- xml_node _parent;
-
- xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
-
- public:
- // Iterator traits
- typedef ptrdiff_t difference_type;
- typedef xml_attribute value_type;
- typedef xml_attribute* pointer;
- typedef xml_attribute& reference;
-
- #ifndef PUGIXML_NO_STL
- typedef std::bidirectional_iterator_tag iterator_category;
- #endif
-
- // Default constructor
- xml_attribute_iterator();
-
- // Construct an iterator which points to the specified attribute
- xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
-
- // Iterator operators
- bool operator==(const xml_attribute_iterator& rhs) const;
- bool operator!=(const xml_attribute_iterator& rhs) const;
-
- xml_attribute& operator*() const;
- xml_attribute* operator->() const;
-
- const xml_attribute_iterator& operator++();
- xml_attribute_iterator operator++(int);
-
- const xml_attribute_iterator& operator--();
- xml_attribute_iterator operator--(int);
- };
-
- // Named node range helper
- class xml_named_node_iterator
- {
- public:
- // Iterator traits
- typedef ptrdiff_t difference_type;
- typedef xml_node value_type;
- typedef xml_node* pointer;
- typedef xml_node& reference;
-
- #ifndef PUGIXML_NO_STL
- typedef std::forward_iterator_tag iterator_category;
- #endif
-
- // Default constructor
- xml_named_node_iterator();
-
- // Construct an iterator which points to the specified node
- xml_named_node_iterator(const xml_node& node, const char_t* name);
-
- // Iterator operators
- bool operator==(const xml_named_node_iterator& rhs) const;
- bool operator!=(const xml_named_node_iterator& rhs) const;
-
- xml_node& operator*() const;
- xml_node* operator->() const;
-
- const xml_named_node_iterator& operator++();
- xml_named_node_iterator operator++(int);
-
- private:
- mutable xml_node _node;
- const char_t* _name;
- };
-
- // Abstract tree walker class (see xml_node::traverse)
- class PUGIXML_CLASS xml_tree_walker
- {
- friend class xml_node;
-
- private:
- int _depth;
-
- protected:
- // Get current traversal depth
- int depth() const;
-
- public:
- xml_tree_walker();
- virtual ~xml_tree_walker();
-
- // Callback that is called when traversal begins
- virtual bool begin(xml_node& node);
-
- // Callback that is called for each node traversed
- virtual bool for_each(xml_node& node) = 0;
-
- // Callback that is called when traversal ends
- virtual bool end(xml_node& node);
- };
-
- // Parsing status, returned as part of xml_parse_result object
- enum xml_parse_status
- {
- status_ok = 0, // No error
-
- status_file_not_found, // File was not found during load_file()
- status_io_error, // Error reading from file/stream
- status_out_of_memory, // Could not allocate memory
- status_internal_error, // Internal error occurred
-
- status_unrecognized_tag, // Parser could not determine tag type
-
- status_bad_pi, // Parsing error occurred while parsing document declaration/processing instruction
- status_bad_comment, // Parsing error occurred while parsing comment
- status_bad_cdata, // Parsing error occurred while parsing CDATA section
- status_bad_doctype, // Parsing error occurred while parsing document type declaration
- status_bad_pcdata, // Parsing error occurred while parsing PCDATA section
- status_bad_start_element, // Parsing error occurred while parsing start element tag
- status_bad_attribute, // Parsing error occurred while parsing element attribute
- status_bad_end_element, // Parsing error occurred while parsing end element tag
- status_end_element_mismatch // There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag)
- };
-
- // Parsing result
- struct PUGIXML_CLASS xml_parse_result
- {
- // Parsing status (see xml_parse_status)
- xml_parse_status status;
-
- // Last parsed offset (in char_t units from start of input data)
- ptrdiff_t offset;
-
- // Source document encoding
- xml_encoding encoding;
-
- // Default constructor, initializes object to failed state
- xml_parse_result();
-
- // Cast to bool operator
- operator bool() const;
-
- // Get error description
- const char* description() const;
- };
-
- // Document class (DOM tree root)
- class PUGIXML_CLASS xml_document: public xml_node
- {
- private:
- char_t* _buffer;
-
- char _memory[192];
-
- // Non-copyable semantics
- xml_document(const xml_document&);
- const xml_document& operator=(const xml_document&);
-
- void create();
- void destroy();
-
- xml_parse_result load_buffer_impl(void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own);
-
- public:
- // Default constructor, makes empty document
- xml_document();
-
- // Destructor, invalidates all node/attribute handles to this document
- ~xml_document();
-
- // Removes all nodes, leaving the empty document
- void reset();
-
- // Removes all nodes, then copies the entire contents of the specified document
- void reset(const xml_document& proto);
-
- #ifndef PUGIXML_NO_STL
- // Load document from stream.
- xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
- xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
- #endif
-
- // Load document from zero-terminated string. No encoding conversions are applied.
- xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
-
- // Load document from file
- xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
- xml_parse_result load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
-
- // Load document from buffer. Copies/converts the buffer, so it may be deleted or changed after the function returns.
- xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
-
- // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
- // You should ensure that buffer data will persist throughout the document's lifetime, and free the buffer memory manually once document is destroyed.
- xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
-
- // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
- // You should allocate the buffer with pugixml allocation function; document will free the buffer when it is no longer needed (you can't use it anymore).
- xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
-
- // Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
- void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
-
- #ifndef PUGIXML_NO_STL
- // Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
- void save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
- void save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
- #endif
-
- // Save XML to file
- bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
- bool save_file(const wchar_t* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
-
- // Get document element
- xml_node document_element() const;
- };
-
-#ifndef PUGIXML_NO_XPATH
- // XPath query return type
- enum xpath_value_type
- {
- xpath_type_none, // Unknown type (query failed to compile)
- xpath_type_node_set, // Node set (xpath_node_set)
- xpath_type_number, // Number
- xpath_type_string, // String
- xpath_type_boolean // Boolean
- };
-
- // XPath parsing result
- struct PUGIXML_CLASS xpath_parse_result
- {
- // Error message (0 if no error)
- const char* error;
-
- // Last parsed offset (in char_t units from string start)
- ptrdiff_t offset;
-
- // Default constructor, initializes object to failed state
- xpath_parse_result();
-
- // Cast to bool operator
- operator bool() const;
-
- // Get error description
- const char* description() const;
- };
-
- // A single XPath variable
- class PUGIXML_CLASS xpath_variable
- {
- friend class xpath_variable_set;
-
- protected:
- xpath_value_type _type;
- xpath_variable* _next;
-
- xpath_variable();
-
- // Non-copyable semantics
- xpath_variable(const xpath_variable&);
- xpath_variable& operator=(const xpath_variable&);
-
- public:
- // Get variable name
- const char_t* name() const;
-
- // Get variable type
- xpath_value_type type() const;
-
- // Get variable value; no type conversion is performed, default value (false, NaN, empty string, empty node set) is returned on type mismatch error
- bool get_boolean() const;
- double get_number() const;
- const char_t* get_string() const;
- const xpath_node_set& get_node_set() const;
-
- // Set variable value; no type conversion is performed, false is returned on type mismatch error
- bool set(bool value);
- bool set(double value);
- bool set(const char_t* value);
- bool set(const xpath_node_set& value);
- };
-
- // A set of XPath variables
- class PUGIXML_CLASS xpath_variable_set
- {
- private:
- xpath_variable* _data[64];
-
- // Non-copyable semantics
- xpath_variable_set(const xpath_variable_set&);
- xpath_variable_set& operator=(const xpath_variable_set&);
-
- xpath_variable* find(const char_t* name) const;
-
- public:
- // Default constructor/destructor
- xpath_variable_set();
- ~xpath_variable_set();
-
- // Add a new variable or get the existing one, if the types match
- xpath_variable* add(const char_t* name, xpath_value_type type);
-
- // Set value of an existing variable; no type conversion is performed, false is returned if there is no such variable or if types mismatch
- bool set(const char_t* name, bool value);
- bool set(const char_t* name, double value);
- bool set(const char_t* name, const char_t* value);
- bool set(const char_t* name, const xpath_node_set& value);
-
- // Get existing variable by name
- xpath_variable* get(const char_t* name);
- const xpath_variable* get(const char_t* name) const;
- };
-
- // A compiled XPath query object
- class PUGIXML_CLASS xpath_query
- {
- private:
- void* _impl;
- xpath_parse_result _result;
-
- typedef void (*unspecified_bool_type)(xpath_query***);
-
- // Non-copyable semantics
- xpath_query(const xpath_query&);
- xpath_query& operator=(const xpath_query&);
-
- public:
- // Construct a compiled object from XPath expression.
- // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
- explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
-
- // Destructor
- ~xpath_query();
-
- // Get query expression return type
- xpath_value_type return_type() const;
-
- // Evaluate expression as boolean value in the specified context; performs type conversion if necessary.
- // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
- bool evaluate_boolean(const xpath_node& n) const;
-
- // Evaluate expression as double value in the specified context; performs type conversion if necessary.
- // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
- double evaluate_number(const xpath_node& n) const;
-
- #ifndef PUGIXML_NO_STL
- // Evaluate expression as string value in the specified context; performs type conversion if necessary.
- // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
- string_t evaluate_string(const xpath_node& n) const;
- #endif
-
- // Evaluate expression as string value in the specified context; performs type conversion if necessary.
- // At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
- // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
- // If PUGIXML_NO_EXCEPTIONS is defined, returns empty set instead.
- size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
-
- // Evaluate expression as node set in the specified context.
- // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
- // If PUGIXML_NO_EXCEPTIONS is defined, returns empty node set instead.
- xpath_node_set evaluate_node_set(const xpath_node& n) const;
-
- // Get parsing result (used to get compilation errors in PUGIXML_NO_EXCEPTIONS mode)
- const xpath_parse_result& result() const;
-
- // Safe bool conversion operator
- operator unspecified_bool_type() const;
-
- // Borland C++ workaround
- bool operator!() const;
- };
-
- #ifndef PUGIXML_NO_EXCEPTIONS
- // XPath exception class
- class PUGIXML_CLASS xpath_exception: public std::exception
- {
- private:
- xpath_parse_result _result;
-
- public:
- // Construct exception from parse result
- explicit xpath_exception(const xpath_parse_result& result);
-
- // Get error message
- virtual const char* what() const throw();
-
- // Get parse result
- const xpath_parse_result& result() const;
- };
- #endif
-
- // XPath node class (either xml_node or xml_attribute)
- class PUGIXML_CLASS xpath_node
- {
- private:
- xml_node _node;
- xml_attribute _attribute;
-
- typedef void (*unspecified_bool_type)(xpath_node***);
-
- public:
- // Default constructor; constructs empty XPath node
- xpath_node();
-
- // Construct XPath node from XML node/attribute
- xpath_node(const xml_node& node);
- xpath_node(const xml_attribute& attribute, const xml_node& parent);
-
- // Get node/attribute, if any
- xml_node node() const;
- xml_attribute attribute() const;
-
- // Get parent of contained node/attribute
- xml_node parent() const;
-
- // Safe bool conversion operator
- operator unspecified_bool_type() const;
-
- // Borland C++ workaround
- bool operator!() const;
-
- // Comparison operators
- bool operator==(const xpath_node& n) const;
- bool operator!=(const xpath_node& n) const;
- };
-
-#ifdef __BORLANDC__
- // Borland C++ workaround
- bool PUGIXML_FUNCTION operator&&(const xpath_node& lhs, bool rhs);
- bool PUGIXML_FUNCTION operator||(const xpath_node& lhs, bool rhs);
-#endif
-
- // A fixed-size collection of XPath nodes
- class PUGIXML_CLASS xpath_node_set
- {
- public:
- // Collection type
- enum type_t
- {
- type_unsorted, // Not ordered
- type_sorted, // Sorted by document order (ascending)
- type_sorted_reverse // Sorted by document order (descending)
- };
-
- // Constant iterator type
- typedef const xpath_node* const_iterator;
-
- // Default constructor. Constructs empty set.
- xpath_node_set();
-
- // Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
- xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
-
- // Destructor
- ~xpath_node_set();
-
- // Copy constructor/assignment operator
- xpath_node_set(const xpath_node_set& ns);
- xpath_node_set& operator=(const xpath_node_set& ns);
-
- // Get collection type
- type_t type() const;
-
- // Get collection size
- size_t size() const;
-
- // Indexing operator
- const xpath_node& operator[](size_t index) const;
-
- // Collection iterators
- const_iterator begin() const;
- const_iterator end() const;
-
- // Sort the collection in ascending/descending order by document order
- void sort(bool reverse = false);
-
- // Get first node in the collection by document order
- xpath_node first() const;
-
- // Check if collection is empty
- bool empty() const;
-
- private:
- type_t _type;
-
- xpath_node _storage;
-
- xpath_node* _begin;
- xpath_node* _end;
-
- void _assign(const_iterator begin, const_iterator end);
- };
-#endif
-
-#ifndef PUGIXML_NO_STL
- // Convert wide string to UTF8
- std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
- std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
-
- // Convert UTF8 to wide string
- std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
- std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
-#endif
-
- // Memory allocation function interface; returns pointer to allocated memory or NULL on failure
- typedef void* (*allocation_function)(size_t size);
-
- // Memory deallocation function interface
- typedef void (*deallocation_function)(void* ptr);
-
- // Override default memory management functions. All subsequent allocations/deallocations will be performed via supplied functions.
- void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate);
-
- // Get current memory management functions
- allocation_function PUGIXML_FUNCTION get_memory_allocation_function();
- deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function();
-}
-
-#if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
-namespace std
-{
- // Workarounds for (non-standard) iterator category detection for older versions (MSVC7/IC8 and earlier)
- std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_node_iterator&);
- std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_attribute_iterator&);
- std::forward_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_named_node_iterator&);
-}
-#endif
-
-#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
-namespace std
-{
- // Workarounds for (non-standard) iterator category detection
- std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_node_iterator&);
- std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_attribute_iterator&);
- std::forward_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_named_node_iterator&);
-}
-#endif
-
-#endif
-
-/**
- * Copyright (c) 2006-2012 Arseny Kapoulkine
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
new file mode 100644
index 0000000..52122c1
--- /dev/null
+++ b/src/test/CMakeLists.txt
@@ -0,0 +1,469 @@
+# 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/.
+
+cmake_minimum_required (VERSION 2.8.1)
+
+pkg_check_modules(GLIB glib-2.0)
+
+include_directories(.
+ ./src-gen
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${DBus_INCLUDE_DIRS}
+ ${gtest_SOURCE_DIR}/include
+ ${GLIB_INCLUDE_DIRS}
+)
+
+set(VERSION "v1_0")
+
+set(TestInterfaceSources src-gen/commonapi/tests/DerivedTypeCollection.cpp
+ src-gen/${VERSION}/commonapi/tests/TestInterfaceStubDefault.cpp)
+
+set(TestInterfaceDBusSources ${TestInterfaceSources}
+ src-gen/${VERSION}/commonapi/tests/TestInterfaceDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
+ src-gen/${VERSION}/fake/legacy/service/LegacyInterfaceDBusProxy.cpp)
+
+
+set(FreedesktopPropertiesDBusSources ${TestInterfaceSources}
+ src-gen/${VERSION}/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
+ src-gen/${VERSION}/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
+ src-gen/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
+ src-gen/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp)
+
+set(ManagedSources src-gen/${VERSION}/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/RootInterfaceStubDefault.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/SecondRootStubDefault.cpp)
+
+set(ManagedDBusSources ${ManagedSources}
+ src-gen/${VERSION}/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/SecondRootDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp)
+
+set(ExtendedInterfaceSources src-gen/${VERSION}/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
+ src-gen/${VERSION}/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
+ src-gen/${VERSION}/commonapi/tests/ExtendedInterfaceStubDefault.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})
+
+##############################################################################
+# DBusManagedTest
+##############################################################################
+
+##### FIXME: serviceFactory not part of CommonAPI 3.0
+##### add_executable(DBusManagedTest DBusManagedTest.cpp
+##### ${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})
+target_link_libraries(DBusMainLoopIntegrationTest ${TEST_LINK_LIBRARIES} ${GLIB_LDFLAGS})
+
+##############################################################################
+# DBusServiceRegistryTest
+##############################################################################
+
+##### FIXME: getCurrentBinaryFileFQN, SubscriptionStatus not part of CommonAPI 3.0
+##### add_executable(DBusServiceRegistryTest DBusServiceRegistryTest.cpp
+##### ${TestInterfaceDBusSources})
+#####
+##### target_link_libraries(DBusServiceRegistryTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusAddressTranslatorTest
+##############################################################################
+
+
+add_executable(DBusAddressTranslatorTest DBusAddressTranslatorTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusAddressTranslatorTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusConnectionTest
+##############################################################################
+
+
+add_executable(DBusConnectionTest DBusConnectionTest.cpp)
+
+target_link_libraries(DBusConnectionTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusTypeStreamTest
+##############################################################################
+
+##### FIXME: CommonAPI::Typewriter not part of CommonAPI 3.0
+##### add_executable(DBusTypeStreamTest DBusTypeStreamTest.cpp)
+#####
+##### target_link_libraries(DBusTypeStreamTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusVariantOutputStreamTest
+##############################################################################
+
+add_executable(DBusVariantOutputStreamTest DBusVariantOutputStreamTest.cpp)
+
+target_link_libraries(DBusVariantOutputStreamTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusCommunicationTest
+##############################################################################
+
+add_executable(DBusCommunicationTest DBusCommunicationTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusCommunicationTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusDaemonProxyTest
+##############################################################################
+
+
+add_executable(DBusDaemonProxyTest DBusDaemonProxyTest.cpp)
+
+target_link_libraries(DBusDaemonProxyTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusInputStreamTest
+##############################################################################
+
+add_executable(DBusInputStreamTest DBusInputStreamTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusInputStreamTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusOutputStreamTest
+##############################################################################
+
+
+add_executable(DBusOutputStreamTest DBusOutputStreamTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusOutputStreamTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusFactoryTest
+##############################################################################
+
+add_executable(DBusFactoryTest DBusFactoryTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusFactoryTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusMultipleConnectionTest
+##############################################################################
+
+add_executable(DBusMultipleConnectionTest DBusMultipleConnectionTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusMultipleConnectionTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusProxyTest
+##############################################################################
+
+##### FIXME: generated ExtendedInterfaceProxy.hpp contains serveral errors
+##### add_executable(DBusProxyTest DBusProxyTest.cpp
+##### ${TestInterfaceDBusSources}
+##### ${ExtendedInterfaceSources})
+#####
+##### target_link_libraries(DBusProxyTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusFreedesktopPropertiesTest
+##############################################################################
+
+##### FIXME: generated TestFreedesktopDerivedInterfaceProxy.hpp contains serveral errors
+##### add_executable(DBusFreedesktopPropertiesTest DBusFreedesktopPropertiesTest.cpp
+##### ${FreedesktopPropertiesDBusSources})
+#####
+##### target_link_libraries(DBusFreedesktopPropertiesTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusServicePublisherTest
+##############################################################################
+
+add_executable(DBusServicePublisherTest DBusServicePublisherTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusServicePublisherTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusVariantTest
+##############################################################################
+
+add_executable(DBusVariantTest DBusVariantTest.cpp)
+
+target_link_libraries(DBusVariantTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusRuntimeTest
+##############################################################################
+
+add_executable(DBusRuntimeTest DBusRuntimeTest.cpp)
+
+target_link_libraries(DBusRuntimeTest ${TEST_LINK_LIBRARIES})
+
+#####
+##### 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
+##############################################################################
+
+add_executable(DBusClientIdTest DBusClientIdTest.cpp)
+
+target_link_libraries(DBusClientIdTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusBroadcastTest
+##############################################################################
+
+add_executable(DBusBroadcastTest ${TestInterfaceDBusSources}
+ DBusBroadcastTest.cpp)
+
+target_link_libraries(DBusBroadcastTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusPolymorphicTest
+##############################################################################
+
+
+add_executable(DBusPolymorphicTest ${TestInterfaceDBusSources}
+ DBusPolymorphicTest.cpp)
+
+target_link_libraries(DBusPolymorphicTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# DBusLoadTest
+##############################################################################
+
+add_executable(DBusLoadTest DBusLoadTest.cpp
+ ${TestInterfaceDBusSources})
+
+target_link_libraries(DBusLoadTest ${TEST_LINK_LIBRARIES})
+
+##############################################################################
+# Add for every test a dependency to gtest
+##############################################################################
+
+##### add_dependencies(DBusManagedTest gtest)
+##### add_dependencies(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)
+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(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)
+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 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)
+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 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)
+add_dependencies(build_tests DBusLoadTest)
+
+##############################################################################
+# Add tests
+##############################################################################
+
+##### 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)
+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 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)
+add_test(NAME DBusLoadTest COMMAND DBusLoadTest)
+
+#DBusManagedTest_SOURCES = \
+# src/test/DBusManagedTest.cpp \
+# ${ManagedDBusSources}
+#DBusManagedTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS} ${GLIB_CFLAGS}
+#DBusManagedTest_CXXFLAGS = ${GTEST_CXXFLAGS} ${GLIB_CFLAGS}
+#DBusManagedTest_LDADD = ${LDADD_FOR_GTEST} ${GLIB_LIBS}
+
+#AM_CPPFLAGS = \
+# -include $(top_builddir)/build-aux/config.h \
+# -I$(top_srcdir)/src \
+# -I$(top_srcdir)/src/test \
+# ${COMMONAPI_CFLAGS} \
+# ${DBUS_CFLAGS} \
+# -DCOMMONAPI_INTERNAL_COMPILATION \
+# -DCOMMONAPI_DBUS_VERSION_MAJOR=${LIBCOMMONAPI_DBUS_CURRENT} \
+# -DCOMMONAPI_DBUS_VERSION_MINOR=${LIBCOMMONAPI_DBUS_REVISION}
+
+#COMMONAPI_CFLAGS = -I/usr/local/include/CommonAPI-2.1
+#COMMONAPI_LIBS = -L/usr/local/lib -lCommonAPI
+#DBUS_CFLAGS = -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include
+#DBUS_LIBS = -L/usr/local/lib -ldbus-1 -lpthread -lrt
+
+#GTEST_CPPFLAGS: -I/home/genius/googletest/gtest-1.7.0/include -I/home/genius/googletest/gtest-1.7.0/include
+
+#GLIB_CFLAGS='-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include '
+
+
+
+#GTEST_CXXFLAGS: -pthread
+
+#LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS = ${GTEST_LIBS} ${LDADD}
+#LDADD_FOR_GTEST = libCommonAPI-DBus.la ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
+#GTEST_LIBS: /home/genius/googletest/gtest-1.7.0/lib/libgtest.la -pthread
+
+
+#GLIB_LIBS='-lglib-2.0 '
+
diff --git a/src/test/DBusAddressTranslatorTest.cpp b/src/test/DBusAddressTranslatorTest.cpp
index d953ec2..78d1b00 100644
--- a/src/test/DBusAddressTranslatorTest.cpp
+++ b/src/test/DBusAddressTranslatorTest.cpp
@@ -1,47 +1,37 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <gtest/gtest.h>
#include <fstream>
#include <thread>
-#include <CommonAPI/CommonAPI.h>
-
+#include <CommonAPI/CommonAPI.hpp>
+#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
+#endif
-#include <CommonAPI/types.h>
-#include <CommonAPI/DBus/DBusAddressTranslator.h>
-#include <CommonAPI/DBus/DBusUtils.h>
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
+#define VERSION v1_0
-#include "commonapi/tests/PredefinedTypeCollection.h"
-#include "commonapi/tests/DerivedTypeCollection.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
-#include "commonapi/tests/TestInterfaceDBusStubAdapter.h"
+#include <CommonAPI/Types.hpp>
+#include <CommonAPI/Utils.hpp>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusUtils.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <fake/legacy/service/LegacyInterfaceProxy.h>
+#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/fake/legacy/service/LegacyInterfaceProxy.hpp>
-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"
-};
+static const std::string domain = "local";
static const std::string fileString =
""
@@ -58,53 +48,49 @@ static const std::string fileString =
"[local:no.nothing.service:no.nothing.instance]\n"
"\n"
"[local:service:instance]\n"
-"dbus_connection=connection.name\n"
-"dbus_object=/path/to/object\n"
-"dbus_interface=service.name\n"
+"service=connection.name\n"
+"path=/path/to/object\n"
+"interface=service.name\n"
"\n"
"[local:no.interface.service:no.interface.instance]\n"
-"dbus_connection=no.interface.connection\n"
-"dbus_object=/no/interface/path\n"
+"service=no.interface.connection\n"
+"path=/no/interface/path\n"
"\n"
"[local:no.connection.service:no.connection.instance]\n"
-"dbus_object=/no/connection/path\n"
-"dbus_interface=no.connection.interface\n"
+"path=/no/connection/path\n"
+"interface=no.connection.interface\n"
"\n"
"[local:no.object.service:no.object.instance]\n"
-"dbus_connection=no.object.connection\n"
-"dbus_interface=no.object.interface\n"
+"service=no.object.connection\n"
+"interface=no.object.interface\n"
"\n"
"[local:only.interface.service:only.interface.instance]\n"
-"dbus_interface=only.interface.interface\n"
+"interface=only.interface.interface\n"
"\n"
"[local:only.connection.service:only.connection.instance]\n"
-"dbus_connection=only.connection.connection\n"
+"service=only.connection.connection\n"
"\n"
"[local:only.object.service:only.object.instance]\n"
-"dbus_object=/only/object/path\n"
+"path=/only/object/path\n"
"\n"
"[local:fake.legacy.service.LegacyInterface:fake.legacy.service]\n"
-"dbus_connection=fake.legacy.service.connection\n"
-"dbus_object=/some/legacy/path/6259504\n"
-"dbus_interface=fake.legacy.service.LegacyInterface\n"
-"dbus_predefined=true\n"
+"service=fake.legacy.service.connection\n"
+"path=/some/legacy/path/6259504\n"
+"interface=fake.legacy.service.LegacyInterface\n"
// all tests run within the same binary under windows, meaning the config file will only be read once. That's why we already have to add the factory configuration used by DBusFactoryTest and the predifined instances for DBusServiceRegistryTest here.
#ifdef WIN32
"[local:Interface1:predefined.Instance1]\n"
-"dbus_connection=DBusServiceRegistryTest.Predefined.Service\n"
-"dbus_object=/tests/predefined/Object1\n"
-"dbus_interface=tests.Interface1\n"
-"dbus_predefined=true\n"
+"service=DBusServiceRegistryTest.Predefined.Service\n"
+"path=/tests/predefined/Object1\n"
+"interface=tests.Interface1\n"
"[local:Interface1:predefined.Instance2]\n"
-"dbus_connection=DBusServiceRegistryTest.Predefined.Service\n"
-"dbus_object=/tests/predefined/Object2\n"
-"dbus_interface=tests.Interface1\n"
-"dbus_predefined=true\n"
+"service=DBusServiceRegistryTest.Predefined.Service\n"
+"path=/tests/predefined/Object2\n"
+"interface=tests.Interface1\n"
"[local:Interface2:predefined.Instance]\n"
-"dbus_connection=DBusServiceRegistryTest.Predefined.Service\n"
-"dbus_object=/tests/predefined/Object1\n"
-"dbus_interface=tests.Interface2\n"
-"dbus_predefined=true\n"
+"service=DBusServiceRegistryTest.Predefined.Service\n"
+"path=/tests/predefined/Object1\n"
+"interface=tests.Interface2\n"
"[factory$session]\n"
"dbus_bustype=session\n"
"[factory$system]\n"
@@ -112,88 +98,317 @@ static const std::string fileString =
#endif
;
-typedef std::vector<CommonAPI::DBus::DBusServiceAddress>::value_type vt;
-static const std::vector<CommonAPI::DBus::DBusServiceAddress> dbusAddresses = {
- vt("no.nothing.instance", "/no/nothing/instance", "no.nothing.service"),
- vt("connection.name", "/path/to/object", "service.name"),
- vt("no.interface.connection", "/no/interface/path", "no.interface.service"),
- vt("no.connection.instance", "/no/connection/path", "no.connection.interface"),
- vt("no.object.connection", "/no/object/instance", "no.object.interface"),
- vt("only.interface.instance", "/only/interface/instance", "only.interface.interface"),
- vt("only.connection.connection", "/only/connection/instance", "only.connection.service"),
- vt("only.object.instance", "/only/object/path", "only.object.service"),
- vt("fake.legacy.service.connection", "/some/legacy/path/6259504", "fake.legacy.service.LegacyInterface")
+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"
+};
+
+typedef std::vector<CommonAPI::DBus::DBusAddress>::value_type vt;
+static const std::vector<CommonAPI::DBus::DBusAddress> dbusAddresses = {
+ vt("no.nothing.service_no.nothing.instance", "/no/nothing/instance", "no.nothing.service"),
+ vt("service.name_connection.name", "/path/to/object", "service.name"),
+ vt("no.interface.service_no.interface.instance", "/no/interface/instance", "no.interface.service"),
+ vt("no.connection.service_no.connection.instance", "/no/connection/instance", "no.connection.service"),
+ vt("no.object.service_no.object.instance", "/no/object/instance", "no.object.service"),
+ vt("only.interface.service_only.interface.instance", "/only/interface/instance", "only.interface.service"),
+ vt("only.connection.service_only.connection.instance", "/only/connection/instance", "only.connection.service"),
+ vt("only.object.service_only.object.instance", "/only/object/instance", "only.object.service"),
+ vt("fake.legacy.service.LegacyInterface_fake.legacy.service", "/fake/legacy/service", "fake.legacy.service.LegacyInterface")
};
class AddressTranslatorTest: public ::testing::Test {
+
protected:
void SetUp() {
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
- configFileName_ += CommonAPI::DBus::DBUS_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << fileString;
- configFile.close();
}
virtual void TearDown() {
usleep(30000);
- std::remove(configFileName_.c_str());
}
std::string configFileName_;
};
TEST_F(AddressTranslatorTest, InstanceCanBeRetrieved) {
- CommonAPI::DBus::DBusAddressTranslator::getInstance();
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> dbusAddressTranslator = CommonAPI::DBus::DBusAddressTranslator::get();
+ ASSERT_TRUE((bool) dbusAddressTranslator);
}
TEST_F(AddressTranslatorTest, ParsesDBusAddresses) {
- CommonAPI::DBus::DBusAddressTranslator& translator = CommonAPI::DBus::DBusAddressTranslator::getInstance();
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
for(unsigned int i = 0; i < commonApiAddresses.size(); i++) {
std::string interfaceName, connectionName, objectPath;
- translator.searchForDBusAddress(commonApiAddresses[i], interfaceName, connectionName, objectPath);
- ASSERT_EQ(std::get<0>(dbusAddresses[i]), connectionName);
- ASSERT_EQ(std::get<1>(dbusAddresses[i]), objectPath);
- ASSERT_EQ(std::get<2>(dbusAddresses[i]), interfaceName);
+ CommonAPI::DBus::DBusAddress dbusAddress;
+ translator->translate(commonApiAddresses[i], dbusAddress);
+ std::cout << dbusAddress.getService() << " " << dbusAddress.getObjectPath() << " " << dbusAddress.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddresses[i].getService(), dbusAddress.getService());
+ ASSERT_EQ(dbusAddresses[i].getObjectPath(), dbusAddress.getObjectPath());
+ ASSERT_EQ(dbusAddresses[i].getInterface(), dbusAddress.getInterface());
}
}
TEST_F(AddressTranslatorTest, ParsesCommonAPIAddresses) {
- CommonAPI::DBus::DBusAddressTranslator& translator = CommonAPI::DBus::DBusAddressTranslator::getInstance();
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
for(unsigned int i = 0; i < commonApiAddresses.size(); i++) {
- std::string commonApiAddress;
- translator.searchForCommonAddress(
- std::get<2>(dbusAddresses[i]),
- std::get<0>(dbusAddresses[i]),
- std::get<1>(dbusAddresses[i]),
- commonApiAddress);
- ASSERT_EQ(commonApiAddresses[i], commonApiAddress);
+ 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, ServicesUsingPredefinedAddressesCanCommunicate) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- ASSERT_TRUE((bool)runtime);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
- ASSERT_TRUE(dbusRuntime != NULL);
+TEST_F(AddressTranslatorTest, InsertAddressPossible) {
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+
+ std::string commonApiAddressRef = "local:my.service:my.instance";
+
+ CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.new.service_my.new.instance", "/my/new/instance", "my.new.service");
+ CommonAPI::DBus::DBusAddress dbusAddressSecondInsertRef("my.new.second.service_my.new.second.instance", "/my/new/second/instance", "my.new.second.service");
+ std::string commonApiSecondInsertAddressRef = "local:my.new.second.service:my.new.second.instance";
+
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
+
+ // insert new address
+ translator->insert(commonApiAddressRef,
+ dbusAddressInsertRef.getService(),
+ dbusAddressInsertRef.getObjectPath(),
+ dbusAddressInsertRef.getInterface());
+
+ //check inserted address
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
+
+ // try overwriting address
+ translator->insert(commonApiAddressRef,
+ dbusAddressSecondInsertRef.getService(),
+ dbusAddressSecondInsertRef.getObjectPath(),
+ dbusAddressSecondInsertRef.getInterface());
+
+ //check overwritten not possible
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressSecondInsertRef.getService(), dbusAddressSecondInsertRef.getObjectPath(), dbusAddressSecondInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressSecondInsertRef.getService() << " " << dbusAddressSecondInsertRef.getObjectPath() << " " << dbusAddressSecondInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiSecondInsertAddressRef, commonApiAddressResult.getAddress());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
+}
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- std::shared_ptr<CommonAPI::Factory> stubFactory = runtime->createFactory();
- ASSERT_TRUE((bool)stubFactory);
+TEST_F(AddressTranslatorTest, InsertAddressNotPossibleConflictTranslate) {
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+
+ CommonAPI::DBus::DBusAddress dbusAddressRef("my.service.translate_my.instance.translate", "/my/instance/translate", "my.service.translate");
+ std::string commonApiAddressRef = "local:my.service.translate:my.instance.translate";
+
+ CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.new.service.translate_my.new.instance.translate", "/my/new/instance/translate", "my.new.service.translate");
+ std::string commonApiAddressInsertRef = "local:my.new.service.translate:my.new.instance.translate";
+
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
+
+ // insertion via translate
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressRef.getInterface(), dbusAddressResult.getInterface());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressRef.getService(), dbusAddressRef.getObjectPath(), dbusAddressRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressRef.getService() << " " << dbusAddressRef.getObjectPath() << " " << dbusAddressRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
+
+ // try to overwrite address
+ translator->insert(commonApiAddressRef,
+ dbusAddressInsertRef.getService(),
+ dbusAddressInsertRef.getObjectPath(),
+ dbusAddressInsertRef.getInterface());
+
+ //check that inserting was not possible
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressRef.getInterface(), dbusAddressResult.getInterface());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressInsertRef, commonApiAddressResult.getAddress());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressRef.getService(), dbusAddressRef.getObjectPath(), dbusAddressRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressRef.getService() << " " << dbusAddressRef.getObjectPath() << " " << dbusAddressRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
+}
+
+TEST_F(AddressTranslatorTest, InsertAddressNotPossibleConflictConfigFile) {
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+
+ CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.new.service.config_my.new.instance.config", "/my/new/instance/config", "my.new.service.config");
+ std::string commonApiAddressInsertRef = "local:my.new.service.config:my.new.instance.config";
+
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
+
+ // try to overwrite address
+ translator->insert(commonApiAddresses[1],
+ dbusAddressInsertRef.getService(),
+ dbusAddressInsertRef.getObjectPath(),
+ dbusAddressInsertRef.getInterface());
+
+ //check that inserting was not possible
+ translator->translate(commonApiAddresses[1], dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddresses[1].getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddresses[1].getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddresses[1].getInterface(), dbusAddressResult.getInterface());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressInsertRef, commonApiAddressResult.getAddress());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddresses[1].getService(), dbusAddresses[1].getObjectPath(), dbusAddresses[1].getInterface()), commonApiAddressResult);
+ std::cout << dbusAddresses[1].getService() << " " << dbusAddresses[1].getObjectPath() << " " << dbusAddresses[1].getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddresses[1], commonApiAddressResult.getAddress());
+}
+
+TEST_F(AddressTranslatorTest, UniqueAddressHandlingTranslateWorks) {
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+
+ std::string commonApiAddressRef = "local:my.unique.translate.interface:my.unique.translate.instance";
+ CommonAPI::DBus::DBusAddress dbusAddressInsertRef(":1.6", "/my/unique/translate/instance", "my.unique.translate.interface");
+
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
+
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
+}
+
+TEST_F(AddressTranslatorTest, UniqueAddressHandlingInsertWorks) {
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+
+ std::string commonApiAddressRef = "local:my.unique.insert.other.interface:my.unique.insert.other.instance";
+ CommonAPI::DBus::DBusAddress dbusAddressInsertRef(":1.6", "/my/unique/insert/instance", "my.unique.insert.interface");
+
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
+
+ translator->insert(commonApiAddressRef,
+ dbusAddressInsertRef.getService(),
+ dbusAddressInsertRef.getObjectPath(),
+ dbusAddressInsertRef.getInterface());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
+
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
+}
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(commonApiAddresses[0]);
+TEST_F(AddressTranslatorTest, CheckWellKnownNameTranslateWorks) {
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+
+ std::string commonApiAddressRef = "local:my.well.translate.interface:my.well.translate.instance";
+ CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.well.known.name", "/my/well/translate/instance", "my.well.translate.interface");
+
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
+
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
+}
+
+TEST_F(AddressTranslatorTest, CheckWellKnownNameInsertWorks) {
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+
+ std::string commonApiAddressRef = "local:my.well.insert.other.interface:my.well.insert.other.instance";
+ CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.well.known.name", "/my/well/insert/instance", "my.well.insert.interface");
+
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
+
+ translator->insert(commonApiAddressRef,
+ dbusAddressInsertRef.getService(),
+ dbusAddressInsertRef.getObjectPath(),
+ dbusAddressInsertRef.getInterface());
+
+ translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
+ std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
+ std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
+ ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
+
+ translator->translate(commonApiAddressRef, dbusAddressResult);
+ std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
+ ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
+ ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
+ ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
+}
+
+TEST_F(AddressTranslatorTest, ServicesUsingPredefinedAddressesCanCommunicate) {
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime);
+
+ CommonAPI::Address commonApiAddress(commonApiAddresses[0]);
+ auto defaultTestProxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(commonApiAddress.getDomain(), commonApiAddress.getInstance());
ASSERT_TRUE((bool)defaultTestProxy);
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- bool serviceNameAcquired = servicePublisher->registerService(stub, commonApiAddresses[0], stubFactory);
+ bool serviceNameAcquired = runtime->registerService(commonApiAddress.getDomain(), commonApiAddress.getInstance(), stub, "connection");
for(unsigned int i = 0; !serviceNameAcquired && i < 100; i++) {
- serviceNameAcquired = servicePublisher->registerService(stub, commonApiAddresses[0], stubFactory);
+ serviceNameAcquired = runtime->registerService(commonApiAddress.getDomain(), commonApiAddress.getInstance(), stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceNameAcquired);
@@ -206,58 +421,65 @@ 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);
-
- servicePublisher->unregisterService(commonApiAddresses[0]);
+
+ runtime->unregisterService(commonApiAddress.getDomain(), stub->getStubAdapter()->getInterface(), commonApiAddress.getInstance());
}
#ifndef WIN32
-const std::string addressOfFakeLegacyService = commonApiAddresses[8];
const std::string domainOfFakeLegacyService = "local";
-const std::string serviceIdOfFakeLegacyService = "fake.legacy.service.LegacyInterface";
-const std::string participantIdOfFakeLegacyService = "fake.legacy.service";
+const std::string interfaceOfFakeLegacyService = "fake.legacy.service.LegacyInterface";
+const std::string instanceOfFakeLegacyService = "fake.legacy.service";
TEST_F(AddressTranslatorTest, CreatedProxyHasCorrectCommonApiAddress) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
- ASSERT_TRUE(dbusRuntime != NULL);
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- auto proxyForFakeLegacyService = proxyFactory->buildProxy<fake::legacy::service::LegacyInterfaceProxy>(addressOfFakeLegacyService);
+ auto proxyForFakeLegacyService = runtime->buildProxy<VERSION::fake::legacy::service::LegacyInterfaceProxy>(domainOfFakeLegacyService, instanceOfFakeLegacyService);
ASSERT_TRUE((bool)proxyForFakeLegacyService);
- ASSERT_EQ(addressOfFakeLegacyService, proxyForFakeLegacyService->getAddress());
- ASSERT_EQ(domainOfFakeLegacyService, proxyForFakeLegacyService->getDomain());
- ASSERT_EQ(serviceIdOfFakeLegacyService, proxyForFakeLegacyService->getServiceId());
- ASSERT_EQ(participantIdOfFakeLegacyService, proxyForFakeLegacyService->getInstanceId());
+ const CommonAPI::Address & address = proxyForFakeLegacyService->getAddress();
+ ASSERT_EQ(domainOfFakeLegacyService, address.getDomain());
+ ASSERT_EQ(interfaceOfFakeLegacyService, address.getInterface());
+ ASSERT_EQ(instanceOfFakeLegacyService, address.getInstance());
}
+void callPythonService(std::string _pythonFileNameAndCommand) {
+ const char *pathToFolderForFakeLegacyService =
+ getenv("TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER");
-void fakeLegacyServiceThread() {
- int resultCode = system("python ./src/test/fakeLegacyService/fakeLegacyService.py");
+ ASSERT_NE(pathToFolderForFakeLegacyService, NULL) << "Environment variable "
+ "TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER "
+ "is not set!";
+
+ std::stringstream stream;
+ stream << "python " << pathToFolderForFakeLegacyService << "/" << _pythonFileNameAndCommand;
+
+ int resultCode = system(stream.str().c_str());
EXPECT_EQ(0, resultCode);
}
+void fakeLegacyServiceThread() {
+ callPythonService("fakeLegacyService.py");
+}
+
TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressed) {
std::thread fakeServiceThread = std::thread(fakeLegacyServiceThread);
usleep(500000);
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
- ASSERT_TRUE(dbusRuntime != NULL);
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- auto proxyForFakeLegacyService = proxyFactory->buildProxy<fake::legacy::service::LegacyInterfaceProxy>(addressOfFakeLegacyService);
+ auto proxyForFakeLegacyService = runtime->buildProxy<VERSION::fake::legacy::service::LegacyInterfaceProxy>(domainOfFakeLegacyService, instanceOfFakeLegacyService);
ASSERT_TRUE((bool)proxyForFakeLegacyService);
- ASSERT_EQ(addressOfFakeLegacyService, proxyForFakeLegacyService->getAddress());
+ const CommonAPI::Address & address = proxyForFakeLegacyService->getAddress();
+ ASSERT_EQ(domainOfFakeLegacyService, address.getDomain());
+ ASSERT_EQ(interfaceOfFakeLegacyService, address.getInterface());
+ ASSERT_EQ(instanceOfFakeLegacyService, address.getInstance());
CommonAPI::CallStatus status;
@@ -280,14 +502,15 @@ TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressed) {
}
//end the fake legacy service via dbus
- int resultCode = system("python ./src/test/fakeLegacyService/sendToFakeLegacyService.py finish");
- ASSERT_EQ(0, resultCode);
+ callPythonService("sendToFakeLegacyService.py finish");
fakeServiceThread.join();
}
+#endif // !WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-#endif // !WIN32
+#endif
diff --git a/src/test/DBusBroadcastTest.cpp b/src/test/DBusBroadcastTest.cpp
index b07571a..c74c296 100644
--- a/src/test/DBusBroadcastTest.cpp
+++ b/src/test/DBusBroadcastTest.cpp
@@ -1,9 +1,7 @@
-/* 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/. */
+// 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>
@@ -18,30 +16,37 @@
#include <tuple>
#include <type_traits>
-#include <CommonAPI/CommonAPI.h>
+#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/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
+#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 "commonapi/tests/PredefinedTypeCollection.h"
-#include "commonapi/tests/DerivedTypeCollection.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
-#include "commonapi/tests/TestInterfaceDBusStubAdapter.h"
+#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
-#include "commonapi/tests/TestInterfaceDBusProxy.h"
+#define VERSION v1_0
-class SelectiveBroadcastSender: public commonapi::tests::TestInterfaceStubDefault {
+class SelectiveBroadcastSender: public VERSION::commonapi::tests::TestInterfaceStubDefault {
public:
SelectiveBroadcastSender():
acceptSubs(true),
sentBroadcasts(0) {
- }
+ }
+
+ virtual ~SelectiveBroadcastSender() {
+
+ }
void startSending() {
sentBroadcasts = 0;
@@ -96,22 +101,10 @@ private:
class DBusBroadcastTest: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime_);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime_));
- ASSERT_TRUE(dbusRuntime != NULL);
-
- proxyFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory_);
- proxyFactory2_ = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory2_);
-
- stubFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool)stubFactory_);
-
- servicePublisher_ = runtime_->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher_);
+ serviceAddressObject_ = CommonAPI::Address(serviceAddress_);
selectiveBroadcastArrivedAtProxyFromSameFactory1 = 0;
selectiveBroadcastArrivedAtProxyFromSameFactory2 = 0;
@@ -119,21 +112,20 @@ protected:
}
virtual void TearDown() {
- servicePublisher_->unregisterService(serviceAddress_);
+ runtime_->unregisterService(serviceAddressObject_.getDomain(), serviceAddressInterface_, serviceAddressObject_.getInstance());
}
std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::shared_ptr<CommonAPI::Factory> proxyFactory_;
- std::shared_ptr<CommonAPI::Factory> proxyFactory2_;
- std::shared_ptr<CommonAPI::Factory> stubFactory_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
static const std::string serviceAddress_;
- static const std::string nonstandardAddress_;
+ CommonAPI::Address serviceAddressObject_;
+ std::string serviceAddressInterface_;
+ static const CommonAPI::ConnectionId_t connectionId_;
int selectiveBroadcastArrivedAtProxyFromSameFactory1;
int selectiveBroadcastArrivedAtProxyFromSameFactory2;
int selectiveBroadcastArrivedAtProxyFromOtherFactory;
+
public:
void selectiveBroadcastCallbackForProxyFromSameFactory1() {
selectiveBroadcastArrivedAtProxyFromSameFactory1++;
@@ -149,29 +141,30 @@ public:
};
const std::string DBusBroadcastTest::serviceAddress_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService";
-const std::string DBusBroadcastTest::nonstandardAddress_ = "local:non.standard.ServiceName:non.standard.participand.ID";
+const CommonAPI::ConnectionId_t DBusBroadcastTest::connectionId_ = "connection";
TEST_F(DBusBroadcastTest, ProxysCanHandleBroadcast) {
auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- auto proxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
+
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
bool callbackArrived = false;
- broadcastEvent.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
callbackArrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
@@ -183,28 +176,29 @@ TEST_F(DBusBroadcastTest, ProxysCanHandleBroadcast) {
ASSERT_TRUE(callbackArrived);
}
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgain) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
+TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgain) {
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- auto proxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
+ 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.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
EXPECT_EQ(intParam, 1);
callbackArrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
@@ -219,10 +213,9 @@ TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgain) {
callbackArrived = false;
- auto broadcastSubscription2 = broadcastEvent.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ auto broadcastSubscription2 = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
EXPECT_EQ(intParam, 2);
callbackArrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
@@ -233,23 +226,24 @@ TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgain) {
ASSERT_TRUE(callbackArrived);
- broadcastEvent.unsubscribe(broadcastSubscription2);
+ broadcastEvent.unsubscribe(broadcastSubscription2);
}
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainInALoop) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
+TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainInALoop) {
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- auto proxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
for(unsigned int i=0; i<10; i++) {
@@ -269,31 +263,31 @@ TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainInAL
ASSERT_TRUE(callbackArrived);
broadcastEvent.unsubscribe(broadcastSubscription);
- }
+ }
}
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWithOtherProxy) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
+TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWithOtherProxy) {
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- auto proxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
bool callbackArrived = false;
- auto broadcastSubscription = broadcastEvent.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
EXPECT_EQ(intParam, 1);
callbackArrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
@@ -306,17 +300,16 @@ TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWith
broadcastEvent.unsubscribe(broadcastSubscription);
- auto proxy2 = proxyFactory2_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxy2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
proxy->getTestPredefinedTypeBroadcastEvent();
callbackArrived = false;
- auto broadcastSubscription2 = broadcastEvent2.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
EXPECT_EQ(intParam, 2);
callbackArrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
@@ -327,31 +320,31 @@ TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWith
ASSERT_TRUE(callbackArrived);
- broadcastEvent.unsubscribe(broadcastSubscription2);
+ broadcastEvent.unsubscribe(broadcastSubscription2);
}
-TEST_F(DBusBroadcastTest, ProxysCanCancelSubscriptionAndSubscribeAgainWithOtherProxy) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
+TEST_F(DBusBroadcastTest, DISABLED_ProxysCanCancelSubscriptionAndSubscribeAgainWithOtherProxy) {
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- auto proxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
bool callbackArrived = false;
- broadcastEvent.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
EXPECT_EQ(intParam, 1);
callbackArrived = true;
- return CommonAPI::SubscriptionStatus::CANCEL;
});
stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
@@ -362,17 +355,16 @@ TEST_F(DBusBroadcastTest, ProxysCanCancelSubscriptionAndSubscribeAgainWithOtherP
ASSERT_TRUE(callbackArrived);
- auto proxy2 = proxyFactory2_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxy2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
proxy->getTestPredefinedTypeBroadcastEvent();
callbackArrived = false;
- auto broadcastSubscription2 = broadcastEvent2.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
EXPECT_EQ(intParam, 2);
callbackArrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
@@ -383,42 +375,41 @@ TEST_F(DBusBroadcastTest, ProxysCanCancelSubscriptionAndSubscribeAgainWithOtherP
ASSERT_TRUE(callbackArrived);
- broadcastEvent2.unsubscribe(broadcastSubscription2);
+ broadcastEvent2.unsubscribe(broadcastSubscription2);
}
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWhileOtherProxyIsStillSubscribed) {
+TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWhileOtherProxyIsStillSubscribed) {
// register service
- auto stub = std::make_shared<SelectiveBroadcastSender>();
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
// build 2 proxies from same factory
- auto proxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
- auto proxy2 = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
+ auto proxy2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
- commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
+ VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
proxy2->getTestPredefinedTypeBroadcastEvent();
bool callback1Arrived = false;
bool callback2Arrived = false;
// subscribe for each proxy's broadcast event
- auto broadcastSubscription = broadcastEvent.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
callback1Arrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
- auto broadcastSubscription2 = broadcastEvent2.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
callback2Arrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
// fire broadcast and wait for results
@@ -450,9 +441,8 @@ TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWhil
EXPECT_TRUE(onlyCallback2Arrived);
// subscribe first proxy again
- broadcastSubscription = broadcastEvent.subscribeCancellableListener([&](uint32_t intParam, std::string stringParam) -> CommonAPI::SubscriptionStatus {
+ broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
callback1Arrived = true;
- return CommonAPI::SubscriptionStatus::RETAIN;
});
// fire broadcast another time
@@ -470,25 +460,24 @@ TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWhil
EXPECT_TRUE(callbackOnBothSubscriptionsArrivedAgain);
broadcastEvent.unsubscribe(broadcastSubscription);
- broadcastEvent2.unsubscribe(broadcastSubscription2);
+ broadcastEvent2.unsubscribe(broadcastSubscription2);
}
-
-
-TEST_F(DBusBroadcastTest, ProxysCanSubscribeForSelectiveBroadcast)
+TEST_F(DBusBroadcastTest, DISABLED_ProxysCanSubscribeForSelectiveBroadcast)
{
- auto proxyFromSameFactory1 = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxyFromSameFactory1 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
ASSERT_TRUE((bool)proxyFromSameFactory1);
- auto proxyFromSameFactory2 = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxyFromSameFactory2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
ASSERT_TRUE((bool)proxyFromSameFactory2);
- auto proxyFromOtherFactory = proxyFactory2_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxyFromOtherFactory = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
ASSERT_TRUE((bool)proxyFromOtherFactory);
- auto stub = std::make_shared<SelectiveBroadcastSender>();
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -539,21 +528,22 @@ TEST_F(DBusBroadcastTest, ProxysCanSubscribeForSelectiveBroadcast)
EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromOtherFactory, 2);
proxyFromSameFactory1->getTestSelectiveBroadcastSelectiveEvent().unsubscribe(subscriptionResult1);
- EXPECT_EQ(stub->getNumberOfSubscribedClients(), 1);
+ EXPECT_EQ(stub->getNumberOfSubscribedClients(), 1);
}
TEST_F(DBusBroadcastTest, ProxysCanBeRejectedForSelectiveBroadcast) {
- auto proxyFromSameFactory1 = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxyFromSameFactory1 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
ASSERT_TRUE((bool)proxyFromSameFactory1);
- auto proxyFromOtherFactory = proxyFactory2_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto proxyFromOtherFactory = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
ASSERT_TRUE((bool)proxyFromOtherFactory);
- auto stub = std::make_shared<SelectiveBroadcastSender>();
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -566,27 +556,25 @@ TEST_F(DBusBroadcastTest, ProxysCanBeRejectedForSelectiveBroadcast) {
bool subbed = false;
proxyFromSameFactory1->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameFactory1, this),
- subbed);
+ std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameFactory1, this));
ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
- ASSERT_TRUE(subbed);
+ //ASSERT_TRUE(subbed);
stub->acceptSubs = false;
proxyFromOtherFactory->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherFactory, this),
- subbed);
+ std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherFactory, this));
ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
- ASSERT_FALSE(subbed);
+ //ASSERT_FALSE(subbed);
stub->send();
usleep(20000);
ASSERT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory1, 1);
- ASSERT_EQ(selectiveBroadcastArrivedAtProxyFromOtherFactory, 0);
+ ASSERT_EQ(selectiveBroadcastArrivedAtProxyFromOtherFactory, 0);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusClientIdTest.cpp b/src/test/DBusClientIdTest.cpp
index b21aeb9..38d9d29 100644
--- a/src/test/DBusClientIdTest.cpp
+++ b/src/test/DBusClientIdTest.cpp
@@ -1,14 +1,16 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <gtest/gtest.h>
-#include "CommonAPI/DBus/DBusClientId.h"
-#include "CommonAPI/types.h"
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include "CommonAPI/DBus/DBusClientId.hpp"
+#include "CommonAPI/Types.hpp"
using namespace CommonAPI::DBus;
@@ -49,7 +51,9 @@ TEST_F(DBusClientIdTest, TestClientIdImplementation) {
ASSERT_FALSE(dbusId1 == testId);
}
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
+#endif
diff --git a/src/test/DBusCommunicationTest.cpp b/src/test/DBusCommunicationTest.cpp
index dee5c42..2471d5e 100644
--- a/src/test/DBusCommunicationTest.cpp
+++ b/src/test/DBusCommunicationTest.cpp
@@ -1,9 +1,7 @@
-/* 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/. */
+// 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>
@@ -20,54 +18,47 @@
#include <dbus/dbus.h>
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
+#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
-#include <CommonAPI/types.h>
+#endif
+
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
+#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 "commonapi/tests/PredefinedTypeCollection.h"
-#include "commonapi/tests/DerivedTypeCollection.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
-#include "commonapi/tests/TestInterfaceDBusStubAdapter.h"
+#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
-#include "commonapi/tests/TestInterfaceDBusProxy.h"
+#define VERSION v1_0
class DBusCommunicationTest: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime_);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime_));
- ASSERT_TRUE(dbusRuntime != NULL);
-
- proxyFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory_);
- stubFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool)stubFactory_);
-
- servicePublisher_ = runtime_->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher_);
}
virtual void TearDown() {
- servicePublisher_->unregisterService(serviceAddress_);
- servicePublisher_->unregisterService(serviceAddress2_);
- servicePublisher_->unregisterService(serviceAddress3_);
- servicePublisher_->unregisterService(serviceAddress4_);
- servicePublisher_->unregisterService(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::shared_ptr<CommonAPI::Factory> proxyFactory_;
- std::shared_ptr<CommonAPI::Factory> stubFactory_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
+ std::string interface_;
+
+ static const std::string domain_;
static const std::string serviceAddress_;
static const std::string serviceAddress2_;
static const std::string serviceAddress3_;
@@ -76,23 +67,25 @@ class DBusCommunicationTest: public ::testing::Test {
static const std::string serviceAddress5_;
};
-const std::string DBusCommunicationTest::serviceAddress_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService";
-const std::string DBusCommunicationTest::serviceAddress2_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService2";
-const std::string DBusCommunicationTest::serviceAddress3_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService3";
-const std::string DBusCommunicationTest::serviceAddress4_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService4";
-const std::string DBusCommunicationTest::nonstandardAddress_ = "local:non.standard.ServiceName:non.standard.participand.ID";
-const std::string DBusCommunicationTest::serviceAddress5_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService5";
+const std::string DBusCommunicationTest::domain_ = "local";
+const std::string DBusCommunicationTest::serviceAddress_ = "CommonAPI.DBus.tests.DBusProxyTestService";
+const std::string DBusCommunicationTest::serviceAddress2_ = "CommonAPI.DBus.tests.DBusProxyTestService2";
+const std::string DBusCommunicationTest::serviceAddress3_ = "CommonAPI.DBus.tests.DBusProxyTestService3";
+const std::string DBusCommunicationTest::serviceAddress4_ = "CommonAPI.DBus.tests.DBusProxyTestService4";
+const std::string DBusCommunicationTest::nonstandardAddress_ = "non.standard.participand.ID";
+const std::string DBusCommunicationTest::serviceAddress5_ = "CommonAPI.DBus.tests.DBusProxyTestService5";
TEST_F(DBusCommunicationTest, RemoteMethodCallSucceeds) {
- auto defaultTestProxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress_);
ASSERT_TRUE((bool)defaultTestProxy);
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -107,21 +100,20 @@ TEST_F(DBusCommunicationTest, RemoteMethodCallSucceeds) {
CommonAPI::CallStatus stat;
defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
-
- servicePublisher_->unregisterService(serviceAddress_);
+ EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
}
TEST_F(DBusCommunicationTest, AccessStubAdapterAfterInitialised) {
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ 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 = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
}
usleep(10000);
}
@@ -130,16 +122,17 @@ TEST_F(DBusCommunicationTest, AccessStubAdapterAfterInitialised) {
}
TEST_F(DBusCommunicationTest, AccessStubAdapterBeforeInitialised) {
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
unsigned int in = 5;
stub->setTestPredefinedTypeAttributeAttribute(in);
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
for (unsigned int i = 0; !serviceRegistered && i < 100; i++) {
if (!serviceRegistered) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
}
usleep(10000);
}
@@ -147,27 +140,28 @@ TEST_F(DBusCommunicationTest, AccessStubAdapterBeforeInitialised) {
}
TEST_F(DBusCommunicationTest, SameStubCanBeRegisteredSeveralTimes) {
- auto defaultTestProxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress_);
- auto defaultTestProxy2 = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress2_);
- auto defaultTestProxy3 = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(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<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
- bool serviceRegistered2 = servicePublisher_->registerService(stub, serviceAddress2_, stubFactory_);
- bool serviceRegistered3 = servicePublisher_->registerService(stub, serviceAddress3_, stubFactory_);
+ 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 = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
}
if (!serviceRegistered2) {
- serviceRegistered2 = servicePublisher_->registerService(stub, serviceAddress2_, stubFactory_);
+ serviceRegistered2 = runtime_->registerService(domain_, serviceAddress2_, stub, "connection");
}
if (!serviceRegistered3) {
- serviceRegistered3 = servicePublisher_->registerService(stub, serviceAddress3_, stubFactory_);
+ serviceRegistered3 = runtime_->registerService(domain_, serviceAddress3_, stub, "connection");
}
usleep(10000);
}
@@ -191,21 +185,20 @@ TEST_F(DBusCommunicationTest, SameStubCanBeRegisteredSeveralTimes) {
EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
EXPECT_EQ(stat2, CommonAPI::CallStatus::SUCCESS);
- EXPECT_EQ(stat3, CommonAPI::CallStatus::SUCCESS);
-
- servicePublisher_->unregisterService(serviceAddress_);
+ EXPECT_EQ(stat3, CommonAPI::CallStatus::SUCCESS);
}
TEST_F(DBusCommunicationTest, RemoteMethodCallWithNonstandardAddressSucceeds) {
- auto defaultTestProxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(nonstandardAddress_);
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, nonstandardAddress_);
ASSERT_TRUE((bool)defaultTestProxy);
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, nonstandardAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, nonstandardAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -220,20 +213,20 @@ TEST_F(DBusCommunicationTest, RemoteMethodCallWithNonstandardAddressSucceeds) {
CommonAPI::CallStatus stat;
defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- servicePublisher_->unregisterService(nonstandardAddress_);
+ EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
}
TEST_F(DBusCommunicationTest, MixedSyncAndAsyncCallsSucceed) {
- auto defaultTestProxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress5_);
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress5_);
ASSERT_TRUE((bool)defaultTestProxy);
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress5_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress5_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -262,21 +255,20 @@ TEST_F(DBusCommunicationTest, MixedSyncAndAsyncCallsSucceed) {
for (unsigned int i = 0; i < 500 && responseCounter < 10; i++) {
usleep(1000);
}
- EXPECT_EQ(10, responseCounter);
-
- servicePublisher_->unregisterService(serviceAddress5_);
+ EXPECT_EQ(10, responseCounter);
}
TEST_F(DBusCommunicationTest, RemoteMethodCallHeavyLoad) {
- auto defaultTestProxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress4_);
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress4_);
ASSERT_TRUE((bool)defaultTestProxy);
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress4_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress4_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -293,18 +285,17 @@ TEST_F(DBusCommunicationTest, RemoteMethodCallHeavyLoad) {
for (uint32_t i = 0; i < 1000; i++) {
defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- }
-
- servicePublisher_->unregisterService(serviceAddress4_);
+ }
}
TEST_F(DBusCommunicationTest, ProxyCanFetchVersionAttributeFromStub) {
- auto defaultTestProxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress4_);
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress4_);
ASSERT_TRUE((bool)defaultTestProxy);
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress4_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
ASSERT_TRUE(serviceRegistered);
@@ -334,7 +325,7 @@ TEST_F(DBusCommunicationTest, ProxyCanFetchVersionAttributeFromStub) {
// auto proxyDBusConnection = CommonAPI::DBus::DBusConnection::getSessionBus();
// ASSERT_TRUE(proxyDBusConnection->connect());
//
-// auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+// auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
//
// bool serviceRegistered = stubFactory_->registerService(stub, serviceAddress_);
// for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
@@ -343,7 +334,7 @@ TEST_F(DBusCommunicationTest, ProxyCanFetchVersionAttributeFromStub) {
// }
// ASSERT_TRUE(serviceRegistered);
//
-// auto defaultTestProxy = std::make_shared<commonapi::tests::TestInterfaceDBusProxy>(
+// auto defaultTestProxy = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(
// commonApiAddress,
// interfaceName,
// busName,
@@ -355,8 +346,8 @@ TEST_F(DBusCommunicationTest, ProxyCanFetchVersionAttributeFromStub) {
// }
// ASSERT_TRUE(defaultTestProxy->isAvailable());
//
-// auto val1 = commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK;
-// commonapi::tests::DerivedTypeCollection::TestMap val2;
+// auto val1 = ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK;
+// ::commonapi::tests::DerivedTypeCollection::TestMap val2;
// CommonAPI::CallStatus status;
// unsigned int numCalled = 0;
// const unsigned int maxNumCalled = 1000;
@@ -415,15 +406,8 @@ TEST_F(DBusCommunicationTest, ProxyCanFetchVersionAttributeFromStub) {
class DBusLowLevelCommunicationTest: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime_);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime_));
- ASSERT_TRUE(dbusRuntime != NULL);
-
- proxyFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory_);
-
- dummy = std::shared_ptr<CommonAPI::DBus::DBusFactory>(NULL);
}
virtual void TearDown() {
@@ -432,15 +416,13 @@ class DBusLowLevelCommunicationTest: public ::testing::Test {
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createDBusStubAdapter(std::shared_ptr<CommonAPI::DBus::DBusConnection> dbusConnection,
const std::string& commonApiAddress) {
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
- CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);
+ CommonAPI::DBus::DBusAddress dbusAddress;
+ CommonAPI::DBus::DBusAddressTranslator::get()->translate(commonApiAddress, dbusAddress);
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter;
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- dbusStubAdapter = std::make_shared<commonapi::tests::TestInterfaceDBusStubAdapter>(dummy, commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection, stub);
+ dbusStubAdapter = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusStubAdapter>(dbusAddress, dbusConnection, stub);
dbusStubAdapter->init(dbusStubAdapter);
std::shared_ptr<CommonAPI::DBus::DBusObjectManagerStub> rootDBusObjectManagerStub = dbusConnection->getDBusObjectManager()->getRootDBusObjectManagerStub();
@@ -456,20 +438,16 @@ class DBusLowLevelCommunicationTest: public ::testing::Test {
std::shared_ptr<CommonAPI::Runtime> runtime_;
std::shared_ptr<CommonAPI::Factory> proxyFactory_;
- std::shared_ptr<CommonAPI::DBus::DBusFactory> dummy;
-
- static const std::string lowLevelAddress_;
+ static const std::string domain_;
+ static const std::string lowLevelAddress_;
+ static const std::string lowLevelAddressInstance_;
static const std::string lowLevelConnectionName_;
- static const std::string lowLevelAddress2_;
- static const std::string lowLevelAddress3_;
- static const std::string lowLevelAddress4_;
};
+const std::string DBusLowLevelCommunicationTest::domain_ = "local";
const std::string DBusLowLevelCommunicationTest::lowLevelAddress_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface: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::lowLevelAddress2_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyLowLevelService2";
-const std::string DBusLowLevelCommunicationTest::lowLevelAddress3_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyLowLevelService3";
-const std::string DBusLowLevelCommunicationTest::lowLevelAddress4_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyLowLevelService4";
namespace DBusCommunicationTestNamespace {
::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
@@ -484,11 +462,11 @@ DBusObjectPathVTable libdbusObjectPathVTable = {
};
}
-TEST_F(DBusLowLevelCommunicationTest, AgressiveNameClaimingOfServicesIsHandledCorrectly) {
- std::shared_ptr<CommonAPI::DBus::DBusConnection> connection1 = CommonAPI::DBus::DBusConnection::getSessionBus();
- std::shared_ptr<CommonAPI::DBus::DBusConnection> connection2 = CommonAPI::DBus::DBusConnection::getSessionBus();
+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 = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(lowLevelAddress_);
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, lowLevelAddressInstance_);
ASSERT_TRUE((bool)defaultTestProxy);
uint32_t counter = 0;
@@ -579,7 +557,7 @@ TEST_F(DBusLowLevelCommunicationTest, AgressiveNameClaimingOfServicesIsHandledCo
ASSERT_TRUE(hasEnded.get());
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusConnectionTest.cpp b/src/test/DBusConnectionTest.cpp
index 00d41fa..cc93990 100644
--- a/src/test/DBusConnectionTest.cpp
+++ b/src/test/DBusConnectionTest.cpp
@@ -1,18 +1,20 @@
-/* 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 <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h>
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp>
#include <gtest/gtest.h>
#include <dbus/dbus.h>
#include <cstring>
-
bool replyArrived;
class LibdbusTest: public ::testing::Test {
@@ -24,102 +26,11 @@ class LibdbusTest: public ::testing::Test {
}
};
-
-::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
- ::DBusMessage* libdbusMessage,
- void* userData) {
- return ::DBusHandlerResult::DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusObjectPathVTable libdbusObjectPathVTable = {
- NULL,
- &onLibdbusObjectPathMessageThunk
-};
-
-::DBusConnection* createConnection() {
- const ::DBusBusType libdbusType = ::DBusBusType::DBUS_BUS_SESSION;
- ::DBusConnection* libdbusConnection = dbus_bus_get_private(libdbusType, NULL);
- dbus_connection_ref(libdbusConnection);
- dbus_connection_set_exit_on_disconnect(libdbusConnection, false);
-
- return libdbusConnection;
-}
-
-static void onLibdbusPendingCallNotifyThunk(::DBusPendingCall* libdbusPendingCall, void *userData) {
- replyArrived = true;
- ::DBusMessage* libdbusMessage = dbus_pending_call_steal_reply(libdbusPendingCall);
- ASSERT_TRUE(libdbusMessage);
- dbus_pending_call_unref(libdbusPendingCall);
-}
-
-TEST_F(LibdbusTest, DISABLED_NonreplyingLibdbusConnectionsAreHandled) {
- const char problemServiceName[] = "problem.service";
- replyArrived = false;
- bool running = true;
-
- dbus_threads_init_default();
-
- ::DBusConnection* serviceConnection = createConnection();
- ::DBusConnection* clientConnection = createConnection();
-
-
- dbus_bus_request_name(serviceConnection,
- problemServiceName,
- DBUS_NAME_FLAG_DO_NOT_QUEUE,
- NULL);
-
- dbus_connection_try_register_object_path(serviceConnection,
- "/",
- &libdbusObjectPathVTable,
- NULL,
- NULL);
-
- std::thread([&, this] {
- while(running) {
- dbus_connection_read_write_dispatch(serviceConnection, 10);
- }
- }).detach();
-
- usleep(100000);
-
- ::DBusMessage* message = dbus_message_new_method_call(problemServiceName, "/", NULL, "someMethod");
-
- ::DBusPendingCall* libdbusPendingCall;
-
- dbus_connection_send_with_reply(
- clientConnection,
- message,
- &libdbusPendingCall,
- 3000);
-
- dbus_pending_call_set_notify(
- libdbusPendingCall,
- onLibdbusPendingCallNotifyThunk,
- NULL,
- NULL);
-
- //100*50 = 5000 (ms) ==> 3 seconds timeout pending call *should* have arrived by now.
- for (unsigned int i = 0; i < 100 && (!replyArrived); i++) {
- dbus_connection_read_write_dispatch(clientConnection, 50);
- }
-
- EXPECT_TRUE(replyArrived);
-
- running = false;
-
- usleep(100000);
-
- dbus_connection_close(serviceConnection);
- dbus_connection_unref(serviceConnection);
- dbus_connection_close(clientConnection);
- dbus_connection_unref(clientConnection);
-}
-
-
class DBusConnectionTest: public ::testing::Test {
protected:
virtual void SetUp() {
- dbusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+
+ dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
}
virtual void TearDown() {
@@ -182,15 +93,15 @@ TEST_F(DBusConnectionTest, ConnectionStatusEventWorks) {
}
TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
- const char busName[] = "commonapi.dbus.test.TestInterfaceHandler";
- const char objectPath[] = "/common/api/dbus/test/TestObject";
- const char interfaceName[] = "commonapi.dbus.test.TestInterface";
+ const char service[] = "commonapi.dbus.test.TestInterface_commonapi.dbus.test.TestObject";
+ const char objectPath[] = "/commonapi/dbus/test/TestObject";
+ const char interface[] = "commonapi.dbus.test.TestInterface";
const char methodName[] = "TestMethod";
- auto interfaceHandlerDBusConnection = CommonAPI::DBus::DBusConnection::getSessionBus();
+ auto interfaceHandlerDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(interfaceHandlerDBusConnection->connect());
- ASSERT_TRUE(interfaceHandlerDBusConnection->requestServiceNameAndBlock(busName));
+ ASSERT_TRUE(interfaceHandlerDBusConnection->requestServiceNameAndBlock(service));
uint32_t serviceHandlerDBusMessageCount = 0;
uint32_t clientReplyHandlerDBusMessageCount = 0;
@@ -208,26 +119,83 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
ASSERT_TRUE(dbusConnection_->connect());
- CommonAPI::DBus::DBusMessage dbusReplyMessage;
+ for (uint32_t expectedDBusMessageCount = 1; expectedDBusMessageCount <= 10; expectedDBusMessageCount++) {
+ CommonAPI::DBus::DBusMessage dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
+ CommonAPI::DBus::DBusAddress(service, objectPath, interface),
+ methodName,
+ "");
+
+ CommonAPI::DBus::DBusOutputStream dbusOutputStream(dbusMessageCall);
+
+ dbusConnection_->sendDBusMessageWithReplyAsync(
+ dbusMessageCall,
+ CommonAPI::DBus::DBusProxyAsyncCallbackHandler<>::create(
+ [&clientReplyHandlerDBusMessageCount](CommonAPI::CallStatus status) {
+ ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
+ ++clientReplyHandlerDBusMessageCount;
+ }, std::tuple<>()),
+ &CommonAPI::DBus::defaultCallInfo);
+
+ for (int i = 0; i < 100; i++) {
+ usleep(10);
+ }
+
+ ASSERT_EQ(serviceHandlerDBusMessageCount, expectedDBusMessageCount);
+
+ ASSERT_EQ(clientReplyHandlerDBusMessageCount, expectedDBusMessageCount);
+ }
+
+ dbusConnection_->disconnect();
+
+ interfaceHandlerDBusConnection->unregisterObjectPath(objectPath);
+
+ ASSERT_TRUE(interfaceHandlerDBusConnection->releaseServiceName(service));
+ interfaceHandlerDBusConnection->disconnect();
+}
+
+TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorksManualDispatch) {
+ const char service[] = "commonapi.dbus.test.TestInterface_commonapi.dbus.test.TestObject";
+ const char objectPath[] = "/commonapi/dbus/test/TestObject";
+ const char interface[] = "commonapi.dbus.test.TestInterface";
+ const char methodName[] = "TestMethod";
+
+ auto interfaceHandlerDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
+
+ ASSERT_TRUE(interfaceHandlerDBusConnection->connect(false));
+ ASSERT_TRUE(interfaceHandlerDBusConnection->requestServiceNameAndBlock(service));
+
+ uint32_t serviceHandlerDBusMessageCount = 0;
+ uint32_t clientReplyHandlerDBusMessageCount = 0;
+
+ interfaceHandlerDBusConnection->setObjectPathMessageHandler(
+ [&serviceHandlerDBusMessageCount, &interfaceHandlerDBusConnection] (CommonAPI::DBus::DBusMessage dbusMessage) -> bool {
+ ++serviceHandlerDBusMessageCount;
+ CommonAPI::DBus::DBusMessage dbusMessageReply = dbusMessage.createMethodReturn("");
+ interfaceHandlerDBusConnection->sendDBusMessage(dbusMessageReply);
+ return true;
+ }
+ );
+
+ interfaceHandlerDBusConnection->registerObjectPath(objectPath);
+
+ ASSERT_TRUE(dbusConnection_->connect(false));
for (uint32_t expectedDBusMessageCount = 1; expectedDBusMessageCount <= 10; expectedDBusMessageCount++) {
CommonAPI::DBus::DBusMessage dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- busName,
- objectPath,
- interfaceName,
+ CommonAPI::DBus::DBusAddress(service, objectPath, interface),
methodName,
"");
CommonAPI::DBus::DBusOutputStream dbusOutputStream(dbusMessageCall);
- interfaceHandlerDBusConnection->sendDBusMessageWithReplyAsync(
+ dbusConnection_->sendDBusMessageWithReplyAsync(
dbusMessageCall,
CommonAPI::DBus::DBusProxyAsyncCallbackHandler<>::create(
[&clientReplyHandlerDBusMessageCount](CommonAPI::CallStatus status) {
ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
++clientReplyHandlerDBusMessageCount;
- })
- );
+ }, std::tuple<>()),
+ &CommonAPI::DBus::defaultCallInfo);
for (int i = 0; i < 10 && serviceHandlerDBusMessageCount < expectedDBusMessageCount; i++) {
interfaceHandlerDBusConnection->readWriteDispatch(100);
@@ -246,10 +214,11 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
interfaceHandlerDBusConnection->unregisterObjectPath(objectPath);
- ASSERT_TRUE(interfaceHandlerDBusConnection->releaseServiceName(busName));
+ ASSERT_TRUE(interfaceHandlerDBusConnection->releaseServiceName(service));
interfaceHandlerDBusConnection->disconnect();
}
+
void dispatch(::DBusConnection* libdbusConnection) {
dbus_bool_t success = TRUE;
while (success) {
@@ -304,62 +273,7 @@ TEST_F(DBusConnectionTest, LibdbusConnectionsMayCommitSuicide) {
dispatchThread.join();
}
-//std::promise<bool> promise2;
-//std::future<bool> future2 = promise2.get_future();
-//std::promise<bool> promise3;
-//std::future<bool> future3 = promise3.get_future();
-//
-//void noPartnerCallback(DBusPendingCall*, void* data) {
-// ::DBusConnection* libdbusConnection = reinterpret_cast<DBusConnection*>(data);
-// dbus_connection_close(libdbusConnection);
-// dbus_connection_unref(libdbusConnection);
-// promise2.set_value(true);
-//}
-//
-//void noPartnerCleanup(void* data) {
-// promise3.set_value(true);
-//}
-
-// libdbus bug
-//TEST_F(DBusConnectionTest, DISABLED_TimeoutForNonexistingServices) {
-// const ::DBusBusType libdbusType = ::DBusBusType::DBUS_BUS_SESSION;
-// ::DBusError libdbusError;
-// dbus_error_init(&libdbusError);
-// ::DBusConnection* libdbusConnection = dbus_bus_get_private(libdbusType, &libdbusError);
-//
-// assert(libdbusConnection);
-// dbus_connection_set_exit_on_disconnect(libdbusConnection, false);
-//
-// auto dispatchThread = std::thread(&dispatch, libdbusConnection);
-//
-// ::DBusMessage* libdbusMessageCall = dbus_message_new_method_call(
-// "some.connection.somewhere",
-// "/some/non/existing/object",
-// "some.interface.somewhere.but.same.place",
-// "NoReasonableMethod");
-//
-// dbus_message_set_signature(libdbusMessageCall, "");
-//
-//
-// DBusPendingCall* libdbusPendingCall;
-//
-// dbus_connection_send_with_reply(
-// libdbusConnection,
-// libdbusMessageCall,
-// &libdbusPendingCall,
-// 5000);
-//
-// dbus_pending_call_set_notify(
-// libdbusPendingCall,
-// noPartnerCallback,
-// libdbusConnection,
-// noPartnerCleanup);
-//
-// ASSERT_EQ(true, future2.get());
-// dispatchThread.join();
-//}
-
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusDaemonProxyTest.cpp b/src/test/DBusDaemonProxyTest.cpp
index 8f47b6d..629f4ae 100644
--- a/src/test/DBusDaemonProxyTest.cpp
+++ b/src/test/DBusDaemonProxyTest.cpp
@@ -1,12 +1,15 @@
-/* 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 <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusDaemonProxy.h>
-#include <CommonAPI/DBus/DBusUtils.h>
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusDaemonProxy.hpp>
+#include <CommonAPI/DBus/DBusUtils.hpp>
#include <gtest/gtest.h>
@@ -18,7 +21,7 @@ namespace {
class DBusDaemonProxyTest: public ::testing::Test {
protected:
virtual void SetUp() {
- dbusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(dbusConnection_->connect());
dbusDaemonProxy_ = std::make_shared<CommonAPI::DBus::DBusDaemonProxy>(dbusConnection_);
}
@@ -44,7 +47,7 @@ TEST_F(DBusDaemonProxyTest, ListNames) {
}
}
-TEST_F(DBusDaemonProxyTest, ListNamesAsync) {
+TEST_F(DBusDaemonProxyTest, DISABLED_ListNamesAsync) {
std::promise<std::tuple<CommonAPI::CallStatus, std::vector<std::string>>>promise;
auto future = promise.get_future();
@@ -72,7 +75,7 @@ TEST_F(DBusDaemonProxyTest, ListNamesAsync) {
}
}
-TEST_F(DBusDaemonProxyTest, NameHasOwner) {
+TEST_F(DBusDaemonProxyTest, DISABLED_NameHasOwner) {
bool nameHasOwner;
CommonAPI::CallStatus callStatus;
@@ -109,7 +112,7 @@ TEST_F(DBusDaemonProxyTest, NameHasOwnerAsync) {
ASSERT_TRUE(nameHasOwner);
}
-TEST_F(DBusDaemonProxyTest, NameOwnerChangedEvent) {
+TEST_F(DBusDaemonProxyTest, DISABLED_NameOwnerChangedEvent) {
std::promise<bool> promise;
auto future = promise.get_future();
@@ -123,7 +126,7 @@ TEST_F(DBusDaemonProxyTest, NameOwnerChangedEvent) {
});
// Trigger NameOwnerChanged using a new DBusConnection
- ASSERT_TRUE(CommonAPI::DBus::DBusConnection::getSessionBus()->connect());
+ ASSERT_TRUE(CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION)->connect());
ASSERT_TRUE(future.get());
@@ -132,7 +135,7 @@ TEST_F(DBusDaemonProxyTest, NameOwnerChangedEvent) {
} // namespace
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusFactoryTest.cpp b/src/test/DBusFactoryTest.cpp
index 0b7a313..43f00e1 100644
--- a/src/test/DBusFactoryTest.cpp
+++ b/src/test/DBusFactoryTest.cpp
@@ -1,9 +1,7 @@
-/* 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/. */
+// 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>
@@ -19,22 +17,27 @@
#include <tuple>
#include <type_traits>
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
#define COMMONAPI_INTERNAL_COMPILATION
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
-#include <CommonAPI/DBus/DBusUtils.h>
+#include <CommonAPI/Utils.hpp>
-#include "commonapi/tests/PredefinedTypeCollection.h"
-#include "commonapi/tests/DerivedTypeCollection.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
-#include "commonapi/tests/TestInterfaceDBusStubAdapter.h"
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
+#include <CommonAPI/DBus/DBusUtils.hpp>
-#include "commonapi/tests/TestInterfaceDBusProxy.h"
+#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
+
+static const char DBUS_CONFIG_SUFFIX[] = "_dbus.conf";
static const std::string fileString =
""
@@ -48,13 +51,18 @@ static const std::string fileString =
class DBusProxyFactoryTest: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime_);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime_));
- ASSERT_TRUE(dbusRuntime != NULL);
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
- configFileName_ += CommonAPI::DBus::DBUS_CONFIG_SUFFIX;
+#ifdef WIN32
+ configFileName_ = _pgmptr;
+#else
+ char cCurrentPath[FILENAME_MAX];
+ getcwd(cCurrentPath, sizeof(cCurrentPath));
+ configFileName_ = cCurrentPath;
+#endif
+
+ configFileName_ += DBUS_CONFIG_SUFFIX;
std::ofstream configFile(configFileName_);
ASSERT_TRUE(configFile.is_open());
configFile << fileString;
@@ -97,25 +105,15 @@ public:
//####################################################################################################################
TEST_F(DBusProxyFactoryTest, DBusFactoryCanBeCreated) {
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- CommonAPI::DBus::DBusFactory* dbusProxyFactory = dynamic_cast<CommonAPI::DBus::DBusFactory*>(&(*proxyFactory));
- ASSERT_TRUE(dbusProxyFactory != NULL);
}
TEST_F(DBusProxyFactoryTest, CreatesDefaultTestProxy) {
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>("local:commonapi.tests.TestInterface:commonapi.tests.TestInterface");
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>("local", "commonapi.tests.TestInterface");
ASSERT_TRUE((bool)defaultTestProxy);
}
TEST_F(DBusProxyFactoryTest, CreatesDefaultExtendedTestProxy) {
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- auto defaultTestProxy = proxyFactory->buildProxyWithDefaultAttributeExtension<
- commonapi::tests::TestInterfaceProxy,
- myExtensions::AttributeTestExtension>("local:commonapi.tests.TestInterface: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();
@@ -123,12 +121,10 @@ TEST_F(DBusProxyFactoryTest, CreatesDefaultExtendedTestProxy) {
}
TEST_F(DBusProxyFactoryTest, CreatesIndividuallyExtendedTestProxy) {
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- auto specificAttributeExtendedTestProxy = proxyFactory->buildProxy<
- commonapi::tests::TestInterfaceProxy,
- commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<myExtensions::AttributeTestExtension> >
- ("local:commonapi.tests.TestInterface:commonapi.tests.TestInterface");
+ auto specificAttributeExtendedTestProxy = runtime_->buildProxy<
+ VERSION::commonapi::tests::TestInterfaceProxy,
+ VERSION::commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<myExtensions::AttributeTestExtension> >
+ ("local", "commonapi.tests.TestInterface");
ASSERT_TRUE((bool)specificAttributeExtendedTestProxy);
@@ -137,36 +133,11 @@ TEST_F(DBusProxyFactoryTest, CreatesIndividuallyExtendedTestProxy) {
}
TEST_F(DBusProxyFactoryTest, CreateNamedFactory) {
- std::shared_ptr<CommonAPI::Factory> defaultFactory = runtime_->createFactory(
- std::shared_ptr<CommonAPI::MainLoopContext>(NULL),
- "nonexistingFactoryName",
- false);
- ASSERT_TRUE((bool)defaultFactory);
- std::shared_ptr<CommonAPI::Factory> configuredFactory = runtime_->createFactory(
- std::shared_ptr<CommonAPI::MainLoopContext>(NULL),
- "configuredFactory",
- true);
- ASSERT_FALSE((bool)configuredFactory);
- std::shared_ptr<CommonAPI::Factory> configuredFactory2 = runtime_->createFactory(
- std::shared_ptr<CommonAPI::MainLoopContext>(NULL),
- "session",
- true);
- ASSERT_TRUE((bool)configuredFactory2);
- std::shared_ptr<CommonAPI::Factory> configuredFactory3 = runtime_->createFactory(
- std::shared_ptr<CommonAPI::MainLoopContext>(NULL),
- "system",
- true);
- ASSERT_TRUE((bool)configuredFactory3);
- std::shared_ptr<CommonAPI::Factory> nullFactory = runtime_->createFactory(
- std::shared_ptr<CommonAPI::MainLoopContext>(NULL),
- "nonexistingFactoryName",
- true);
- ASSERT_TRUE(nullFactory == NULL);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/test/DBusFreedesktopPropertiesTest.cpp b/src/test/DBusFreedesktopPropertiesTest.cpp
index a03798e..5ee5cbc 100644
--- a/src/test/DBusFreedesktopPropertiesTest.cpp
+++ b/src/test/DBusFreedesktopPropertiesTest.cpp
@@ -1,45 +1,34 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#include <gtest/gtest.h>
-#include <commonapi/tests/DerivedTypeCollection.h>
-#include <commonapi/tests/TestFreedesktopInterfaceProxy.h>
-#include <commonapi/tests/TestFreedesktopInterfaceStub.h>
-#include <commonapi/tests/TestFreedesktopInterfaceStubDefault.h>
-#include <commonapi/tests/TestFreedesktopDerivedInterfaceProxy.h>
-#include <commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.h>
+#include <CommonAPI/CommonAPI.hpp>
#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusRuntime.h>
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#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>
+
+#define VERSION v1_0
-static const std::string commonApiAddress =
- "local:CommonAPI.DBus.tests.DBusProxyTestFreedesktopPropertiesInterface:CommonAPI.DBus.tests.DBusProxyTestFreedesktopPropertiesInterface";
+static const std::string domain = "local";
+static const std::string commonApiAddress = "CommonAPI.DBus.tests.DBusProxyTestFreedesktopPropertiesInterface";
class FreedesktopPropertiesTest: public ::testing::Test {
protected:
void SetUp() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- servicePublisher_ = runtime->getServicePublisher();
-
- ASSERT_TRUE(servicePublisher_ != NULL);
+ runtime = CommonAPI::Runtime::get();
- serviceFactory_ = runtime->createFactory();
- proxyFactory_ = runtime->createFactory();
-
- ASSERT_TRUE(serviceFactory_ != NULL);
- ASSERT_TRUE(proxyFactory_ != NULL);
-
- proxy_ = proxyFactory_->buildProxy<commonapi::tests::TestFreedesktopInterfaceProxy>(commonApiAddress);
+ proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopInterfaceProxy>(domain, commonApiAddress);
registerTestStub();
@@ -55,22 +44,21 @@ protected:
}
void registerTestStub() {
- testStub_ = std::make_shared<commonapi::tests::TestFreedesktopInterfaceStubDefault>();
- const bool isServiceRegistered = servicePublisher_->registerService(testStub_, commonApiAddress, serviceFactory_);
+ 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 = servicePublisher_->unregisterService(commonApiAddress);
+ void deregisterTestStub() {
+ const bool isStubAdapterUnregistered = runtime->unregisterService(domain, testStub_->getStubAdapter()->getInterface(), commonApiAddress);
ASSERT_TRUE(isStubAdapterUnregistered);
}
- std::shared_ptr<CommonAPI::Factory> serviceFactory_, proxyFactory_;
- std::shared_ptr<commonapi::tests::TestFreedesktopInterfaceProxyDefault> proxy_;
- std::shared_ptr<commonapi::tests::TestFreedesktopInterfaceStubDefault> testStub_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
+ 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) {
@@ -143,18 +131,9 @@ TEST_F(FreedesktopPropertiesTest, CanSendAndReceiveNotificationForSingleProperty
class FreedesktopPropertiesOnInheritedInterfacesTest: public ::testing::Test {
protected:
void SetUp() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- servicePublisher_ = runtime->getServicePublisher();
-
- ASSERT_TRUE(servicePublisher_ != NULL);
-
- serviceFactory_ = runtime->createFactory();
- proxyFactory_ = runtime->createFactory();
-
- ASSERT_TRUE(serviceFactory_ != NULL);
- ASSERT_TRUE(proxyFactory_ != NULL);
+ runtime = CommonAPI::Runtime::get();
- proxy_ = proxyFactory_->buildProxy<commonapi::tests::TestFreedesktopDerivedInterfaceProxy>(commonApiAddress);
+ proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceProxy>(domain, commonApiAddress);
registerTestStub();
@@ -170,22 +149,21 @@ protected:
}
void registerTestStub() {
- testStub_ = std::make_shared<commonapi::tests::TestFreedesktopDerivedInterfaceStubDefault>();
- const bool isServiceRegistered = servicePublisher_->registerService(testStub_, commonApiAddress, serviceFactory_);
+ testStub_ = std::make_shared<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubDefault>();
+ const bool isServiceRegistered = runtime->registerService(domain, commonApiAddress, testStub_, "connection");
ASSERT_TRUE(isServiceRegistered);
}
void deregisterTestStub() {
- const bool isStubAdapterUnregistered = servicePublisher_->unregisterService(commonApiAddress);
+ const bool isStubAdapterUnregistered = runtime->unregisterService(domain, testStub_->CommonAPI::Stub<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubAdapter, VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubRemoteEvent>::getStubAdapter()->VERSION::commonapi::tests::TestFreedesktopDerivedInterface::getInterface(), commonApiAddress);
ASSERT_TRUE(isStubAdapterUnregistered);
}
- std::shared_ptr<CommonAPI::Factory> serviceFactory_, proxyFactory_;
- std::shared_ptr<commonapi::tests::TestFreedesktopDerivedInterfaceProxyDefault> proxy_;
- std::shared_ptr<commonapi::tests::TestFreedesktopDerivedInterfaceStubDefault> testStub_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
+ 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) {
@@ -234,7 +212,7 @@ TEST_F(FreedesktopPropertiesOnInheritedInterfacesTest, CanGetAndSetRemoteAttribu
ASSERT_EQ(value, 7);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusInputStreamTest.cpp b/src/test/DBusInputStreamTest.cpp
index dcfdc64..9a6a0f3 100644
--- a/src/test/DBusInputStreamTest.cpp
+++ b/src/test/DBusInputStreamTest.cpp
@@ -1,15 +1,16 @@
-/* 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 <CommonAPI/SerializableStruct.h>
-#include <CommonAPI/SerializableVariant.h>
-#include <CommonAPI/DBus/DBusInputStream.h>
-#include <CommonAPI/DBus/DBusOutputStream.h>
-
-#include "DBusTestUtils.h"
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+
+#include "DBusTestUtils.hpp"
#include <unordered_map>
@@ -237,36 +238,51 @@ TEST_F(InputStreamTest, ReadsStrings) {
namespace bmw {
namespace test {
-
-struct TestSerializableStruct: CommonAPI::SerializableStruct {
- uint32_t a;
- int16_t b;
- bool c;
- std::string d;
- double e;
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream) {
- inputStream >> a >> b >> c >> d >> e;
- }
-
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- outputStream << a << b << c << d << e;
- }
-
- static void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- typeOutputStream.writeUInt32Type();
- typeOutputStream.writeInt16Type();
- typeOutputStream.writeBoolType();
- typeOutputStream.writeStringType();
- typeOutputStream.writeDoubleType();
- }
+ 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();
+ }
};
bool operator==(const TestSerializableStruct& lhs, const TestSerializableStruct& rhs) {
if (&lhs == &rhs)
return true;
- return (lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c) && (lhs.d == rhs.d) && (lhs.e == rhs.e);
+ 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
@@ -275,21 +291,21 @@ bool operator==(const TestSerializableStruct& lhs, const TestSerializableStruct&
TEST_F(InputStreamTest, ReadsStructs) {
bmw::test::TestSerializableStruct testStruct;
- testStruct.a = 15;
- testStruct.b = -32;
- testStruct.c = FALSE;
- testStruct.d = "Hello all";
- testStruct.e = 3.414;
+ testStruct.setA(15);
+ testStruct.setB(-32);
+ testStruct.setC(FALSE);
+ testStruct.setD("Hello all");
+ testStruct.setE(3.414);
DBusMessageIter subIter;
dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &subIter);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_UINT32, &testStruct.a);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_INT16, &testStruct.b);
- dbus_bool_t dbusBool = static_cast<dbus_bool_t>(testStruct.c);
+ dbus_message_iter_append_basic(&subIter, DBUS_TYPE_UINT32, testStruct.getAderef());
+ dbus_message_iter_append_basic(&subIter, DBUS_TYPE_INT16, testStruct.getBderef());
+ dbus_bool_t dbusBool = static_cast<dbus_bool_t>(testStruct.getC());
dbus_message_iter_append_basic(&subIter, DBUS_TYPE_BOOLEAN, &dbusBool);
- const char* dPtr = testStruct.d.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.e);
+ dbus_message_iter_append_basic(&subIter, DBUS_TYPE_DOUBLE, testStruct.getEderef());
dbus_message_iter_close_container(&libdbusMessageWriteIter, &subIter);
CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
@@ -301,11 +317,11 @@ TEST_F(InputStreamTest, ReadsStructs) {
bmw::test::TestSerializableStruct verifyStruct;
inStream >> verifyStruct;
- EXPECT_EQ(testStruct.a, verifyStruct.a);
- EXPECT_EQ(testStruct.b, verifyStruct.b);
- EXPECT_EQ(testStruct.c, verifyStruct.c);
- EXPECT_EQ(testStruct.d, verifyStruct.d);
- EXPECT_EQ(testStruct.e, verifyStruct.e);
+ EXPECT_EQ(testStruct.getA(), verifyStruct.getA());
+ EXPECT_EQ(testStruct.getB(), verifyStruct.getB());
+ EXPECT_EQ(testStruct.getC(), verifyStruct.getC());
+ EXPECT_EQ(testStruct.getD(), verifyStruct.getD());
+ EXPECT_EQ(testStruct.getE(), verifyStruct.getE());
}
TEST_F(InputStreamTest, ReadsArrays) {
@@ -419,7 +435,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 >> readVariant;
+ inStream.readValue(readVariant, static_cast<CommonAPI::DBus::VariantDeployment<int32_t, double, std::string>*>(nullptr));
int32_t actualResult;
EXPECT_NO_THROW(actualResult = readVariant.get<int32_t>());
@@ -458,7 +474,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 >> readVariant;
+ inStream.readValue(readVariant, static_cast<CommonAPI::DBus::VariantDeployment<int32_t, double, std::string>*>(nullptr));
std::string actualResult = readVariant.get<std::string>();
@@ -512,7 +528,7 @@ TEST_F(InputStreamTest, ReadsVariantsWithAnArrayOfStrings) {
EXPECT_EQ(129 + 7 + 129, scopedMessage.getBodyLength());
for (unsigned int i = 0; i < numOfElements; i += 1) {
TestedVariantType readVariant;
- inStream >> readVariant;
+ inStream.readValue(readVariant, static_cast<CommonAPI::DBus::VariantDeployment<int32_t, double, std::vector<std::string>>*>(nullptr));
std::vector<std::string> actualResult = readVariant.get<std::vector<std::string>>();
@@ -622,8 +638,8 @@ TEST_F(InputStreamTest, ReadsVariantsWithVariants) {
TestedVariantType readVariant1;
TestedVariantType readVariant2;
- inStream >> readVariant1;
- inStream >> 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));
EXPECT_EQ(referenceVariant1, readVariant1);
EXPECT_EQ(referenceVariant2, readVariant2);
@@ -649,11 +665,11 @@ TEST_F(InputStreamTest, ReadsVariantsWithStructs) {
int8_t variantTypeIndex = 1;
bmw::test::TestSerializableStruct testStruct;
- testStruct.a = 15;
- testStruct.b = -32;
- testStruct.c = false;
- testStruct.d = "Hello all!";
- testStruct.e = 3.414;
+ testStruct.setA(15);
+ testStruct.setB(-32);
+ testStruct.setC(false);
+ testStruct.setD("Hello all!");
+ testStruct.setE(3.414);
DBusMessageIter variantStructIter;
@@ -669,12 +685,12 @@ TEST_F(InputStreamTest, ReadsVariantsWithStructs) {
dbus_message_iter_open_container(&variantActualIter, DBUS_TYPE_STRUCT, NULL, &innerStructIter);
dbus_bool_t dbusBool = 0;
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_UINT32, &testStruct.a);
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_INT16, &testStruct.b);
+ 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 = testStruct.d.c_str();
+ 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.e);
+ dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_DOUBLE, testStruct.getEderef());
dbus_message_iter_close_container(&variantActualIter, &innerStructIter);
//end variant content
@@ -695,11 +711,11 @@ TEST_F(InputStreamTest, ReadsVariantsWithStructs) {
inStream >> readVariant;
bmw::test::TestSerializableStruct readStruct = readVariant.get<bmw::test::TestSerializableStruct>();
- EXPECT_EQ(testStruct.a, readStruct.a);
- EXPECT_EQ(testStruct.b, readStruct.b);
- EXPECT_EQ(testStruct.c, readStruct.c);
- EXPECT_EQ(testStruct.d, readStruct.d);
- EXPECT_EQ(testStruct.e, readStruct.e);
+ EXPECT_EQ(testStruct.getA(), readStruct.getA());
+ EXPECT_EQ(testStruct.getB(), readStruct.getB());
+ EXPECT_EQ(testStruct.getC(), readStruct.getC());
+ EXPECT_EQ(testStruct.getD(), readStruct.getD());
+ EXPECT_EQ(testStruct.getE(), readStruct.getE());
EXPECT_EQ(testStruct, readStruct);
EXPECT_EQ(referenceVariant, readVariant);
}
@@ -708,12 +724,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.a = 15;
- testStruct.b = -32;
- testStruct.c = false;
- testStruct.d = "Hello all!";
- testStruct.e = 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;
@@ -734,12 +750,12 @@ TEST_F(InputStreamTest, ReadsVariantsWithAnArrayOfStructs) {
dbus_message_iter_open_container(&innerArrayIter, DBUS_TYPE_STRUCT, NULL, &innerStructIter);
dbus_bool_t dbusBool = 0;
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_UINT32, &testStruct.a);
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_INT16, &testStruct.b);
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_BOOLEAN, &dbusBool);
- const char* dPtr = testStruct.d.c_str();
+ dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_UINT32, testStruct.getAderef());
+ dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_INT16, testStruct.getBderef());
+ dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_BOOLEAN, &dbusBool);
+ const char* dPtr = std::get<3>(testStruct.values_).c_str();
dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_STRING, &dPtr);
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_DOUBLE, &testStruct.e);
+ dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_DOUBLE, testStruct.getEderef());
dbus_message_iter_close_container(&innerArrayIter, &innerStructIter);
//end struct
@@ -768,17 +784,17 @@ 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.a, readStruct.a);
- EXPECT_EQ(testStruct.b, readStruct.b);
- EXPECT_EQ(testStruct.c, readStruct.c);
- EXPECT_EQ(testStruct.d, readStruct.d);
- EXPECT_EQ(testStruct.e, readStruct.e);
+ EXPECT_EQ(testStruct.getA(), readStruct.getA());
+ EXPECT_EQ(testStruct.getB(), readStruct.getB());
+ EXPECT_EQ(testStruct.getC(), readStruct.getC());
+ EXPECT_EQ(testStruct.getD(), readStruct.getD());
+ EXPECT_EQ(testStruct.getE(), readStruct.getE());
EXPECT_EQ(testStruct, readStruct);
EXPECT_EQ(referenceInnerVector, actualResult);
EXPECT_EQ(referenceVariant, readVariant);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusLoadTest.cpp b/src/test/DBusLoadTest.cpp
index e5e26bc..fdd0351 100644
--- a/src/test/DBusLoadTest.cpp
+++ b/src/test/DBusLoadTest.cpp
@@ -1,9 +1,7 @@
-/* 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/. */
+// 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>
@@ -20,49 +18,42 @@
#include <type_traits>
#include <future>
-#include <CommonAPI/CommonAPI.h>
+#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/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
+#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 "commonapi/tests/PredefinedTypeCollection.h"
-#include "commonapi/tests/DerivedTypeCollection.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
+#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
-#include "commonapi/tests/TestInterfaceDBusProxy.h"
+#define VERSION v1_0
+
+class TestInterfaceStubFinal : public VERSION::commonapi::tests::TestInterfaceStubDefault {
-class TestInterfaceStubFinal: public commonapi::tests::TestInterfaceStubDefault {
public:
- void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
- uint32_t uint32InValue,
- std::string stringInValue,
- uint32_t& uint32OutValue,
- std::string& stringOutValue) {
-
- uint32OutValue = uint32InValue;
- stringOutValue = stringInValue;
- }
+ 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);
+ }
};
class DBusLoadTest: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool )runtime_);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime_));
- ASSERT_TRUE(dbusRuntime != NULL);
-
- proxyFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool )proxyFactory_);
- stubFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool )stubFactory_);
-
- servicePublisher_ = runtime_->getServicePublisher();
- ASSERT_TRUE((bool )servicePublisher_);
callSucceeded_.resize(numCallsPerProxy_ * numProxies_);
std::fill(callSucceeded_.begin(), callSucceeded_.end(), false);
@@ -90,41 +81,39 @@ public:
}
std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::shared_ptr<CommonAPI::Factory> proxyFactory_;
- std::shared_ptr<CommonAPI::Factory> stubFactory_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
std::vector<bool> callSucceeded_;
std::mutex mutexCallSucceeded_;
+ static const std::string domain_;
static const std::string serviceAddress_;
static const uint32_t numCallsPerProxy_;
static const uint32_t numProxies_;
};
-const std::string DBusLoadTest::serviceAddress_ =
- "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService";
+const std::string DBusLoadTest::domain_ = "local";
+const std::string DBusLoadTest::serviceAddress_ = "CommonAPI.DBus.tests.DBusProxyTestService";
const uint32_t DBusLoadTest::numCallsPerProxy_ = 100;
#ifdef WIN32
// test with just 50 proxies under windows as it becomes very slow with more ones
const uint32_t DBusLoadTest::numProxies_ = 50;
#else
-const uint32_t DBusLoadTest::numProxies_ = 100;
+const uint32_t DBusLoadTest::numProxies_ = 65;
#endif
// Multiple proxies in one thread, one stub
TEST_F(DBusLoadTest, SingleClientMultipleProxiesSingleStubCallsSucceed) {
- std::array<std::shared_ptr<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] = proxyFactory_->buildProxy < commonapi::tests::TestInterfaceProxy > (serviceAddress_);
+ testProxies[i] = runtime_->buildProxy < VERSION::commonapi::tests::TestInterfaceProxy >(domain_, serviceAddress_);
ASSERT_TRUE((bool )testProxies[i]);
}
auto stub = std::make_shared<TestInterfaceStubFinal>();
- bool serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
for (auto i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -168,25 +157,23 @@ TEST_F(DBusLoadTest, SingleClientMultipleProxiesSingleStubCallsSucceed) {
}
ASSERT_TRUE(allCallsSucceeded);
- servicePublisher_->unregisterService(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<commonapi::tests::TestInterfaceProxyBase>, numProxies_> testProxies;
+ std::array<std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxyBase>, numProxies_> testProxies;
for (unsigned int i = 0; i < numProxies_; i++) {
- testProxyFactories[i] = runtime_->createFactory();
- ASSERT_TRUE((bool )testProxyFactories[i]);
- testProxies[i] = testProxyFactories[i]->buildProxy < commonapi::tests::TestInterfaceProxy > (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 = servicePublisher_->registerService(stub, serviceAddress_, stubFactory_);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
if(!serviceRegistered)
usleep(10000);
}
@@ -211,7 +198,7 @@ TEST_F(DBusLoadTest, MultipleClientsSingleStubCallsSucceed) {
testProxies[j]->testPredefinedTypeMethodAsync(
in1,
in2,
- std::bind(
+ std::bind(
&DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
this,
callId++,
@@ -231,31 +218,27 @@ TEST_F(DBusLoadTest, MultipleClientsSingleStubCallsSucceed) {
}
ASSERT_TRUE(allCallsSucceeded);
- servicePublisher_->unregisterService(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<commonapi::tests::TestInterfaceProxyBase>, numProxies_> testProxies;
- std::array<std::shared_ptr<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++) {
- testProxyFactories[i] = runtime_->createFactory();
- ASSERT_TRUE((bool )testProxyFactories[i]);
- testProxies[i] = testProxyFactories[i]->buildProxy < commonapi::tests::TestInterfaceProxy > (serviceAddress_+std::to_string(i));
+ testProxies[i] = runtime_->buildProxy < VERSION::commonapi::tests::TestInterfaceProxy >(domain_, serviceAddress_ + std::to_string(i));
ASSERT_TRUE((bool )testProxies[i]);
}
for (unsigned int i = 0; i < numProxies_; i++) {
- testStubFactories[i] = runtime_->createFactory();
- ASSERT_TRUE((bool )testStubFactories[i]);
testStubs[i] = std::make_shared<TestInterfaceStubFinal>();
ASSERT_TRUE((bool )testStubs[i]);
bool serviceRegistered = false;
for (auto j = 0; !serviceRegistered && j < 100; ++j) {
- serviceRegistered = servicePublisher_->registerService(testStubs[i], serviceAddress_+std::to_string(i), testStubFactories[i]);
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_ + std::to_string(i), testStubs[i], "connection");
if(!serviceRegistered)
usleep(10000);
}
@@ -302,11 +285,11 @@ TEST_F(DBusLoadTest, MultipleClientsMultipleServersCallsSucceed) {
ASSERT_TRUE(allCallsSucceeded);
for (unsigned int i = 0; i < numProxies_; i++) {
- servicePublisher_->unregisterService(serviceAddress_+std::to_string(i));
+ runtime_->unregisterService(domain_, testStubs[i]->getStubAdapter()->getInterface(), serviceAddress_ + std::to_string(i));
}
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusMainLoopIntegrationTest.cpp b/src/test/DBusMainLoopIntegrationTest.cpp
index 34cccce..a7a364e 100644
--- a/src/test/DBusMainLoopIntegrationTest.cpp
+++ b/src/test/DBusMainLoopIntegrationTest.cpp
@@ -1,9 +1,7 @@
-/* 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/. */
+// 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>
@@ -20,34 +18,38 @@
#ifndef WIN32
#include <glib.h>
#endif
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
+
+#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
+#endif
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
-#include "DBusTestUtils.h"
-#include "DemoMainLoop.h"
+#include "DBusTestUtils.hpp"
+#include "DemoMainLoop.hpp"
-#include "commonapi/tests/PredefinedTypeCollection.h"
-#include "commonapi/tests/DerivedTypeCollection.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
-#include "commonapi/tests/TestInterfaceDBusStubAdapter.h"
+#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 "commonapi/tests/TestInterfaceDBusProxy.h"
+#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
+const std::string domain = "local";
+const std::string testAddress1 = "commonapi.address.one";
+const std::string testAddress2 = "commonapi.address.two";
+const std::string testAddress3 = "commonapi.address.three";
+const std::string testAddress4 = "commonapi.address.four";
+const std::string testAddress5 = "commonapi.address.five";
+const std::string testAddress6 = "commonapi.address.six";
+const std::string testAddress7 = "commonapi.address.seven";
+const std::string testAddress8 = "commonapi.address.eight";
-const std::string testAddress1 = "local:my.first.test:commonapi.address.one";
-const std::string testAddress2 = "local:my.second.test:commonapi.address.two";
-const std::string testAddress3 = "local:my.third.test:commonapi.address.three";
-const std::string testAddress4 = "local:my.fourth.test:commonapi.address.four";
-const std::string testAddress5 = "local:my.fifth.test:commonapi.address.five";
-const std::string testAddress6 = "local:my.sixth.test:commonapi.address.six";
-const std::string testAddress7 = "local:my.seventh.test:commonapi.address.seven";
-const std::string testAddress8 = "local:my.eigth.test:commonapi.address.eight";
+#define VERSION v1_0
//####################################################################################################################
@@ -60,44 +62,6 @@ protected:
}
};
-
-TEST_F(DBusBasicMainLoopTest, MainloopContextCanBeCreated) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- ASSERT_TRUE((bool) runtime);
-
- std::shared_ptr<CommonAPI::MainLoopContext> context = runtime->getNewMainLoopContext();
- ASSERT_TRUE((bool) context);
-}
-
-
-TEST_F(DBusBasicMainLoopTest, NoFactoryWillBeCreatedIfContextIsUninitialized) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- ASSERT_TRUE((bool) runtime);
-
- std::shared_ptr<CommonAPI::MainLoopContext> context = runtime->getNewMainLoopContext();
- ASSERT_TRUE((bool) context);
-
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory(context);
- ASSERT_FALSE((bool) factory);
-}
-
-
-TEST_F(DBusBasicMainLoopTest, SeveralMainloopContextsCanBeCreated) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::MainLoopContext> context1 = runtime->getNewMainLoopContext();
- ASSERT_TRUE((bool) context1);
- std::shared_ptr<CommonAPI::MainLoopContext> context2 = runtime->getNewMainLoopContext();
- ASSERT_TRUE((bool) context2);
- std::shared_ptr<CommonAPI::MainLoopContext> context3 = runtime->getNewMainLoopContext();
- ASSERT_TRUE((bool) context3);
-
- ASSERT_NE(context1, context2);
- ASSERT_NE(context1, context3);
- ASSERT_NE(context2, context3);
-}
-
struct TestSource: public CommonAPI::DispatchSource {
TestSource(const std::string value, std::string& result): value_(value), result_(result) {}
@@ -118,10 +82,10 @@ struct TestSource: public CommonAPI::DispatchSource {
};
TEST_F(DBusBasicMainLoopTest, PrioritiesAreHandledCorrectlyInDemoMainloop) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool) runtime);
- std::shared_ptr<CommonAPI::MainLoopContext> context = runtime->getNewMainLoopContext();
+ std::shared_ptr<CommonAPI::MainLoopContext> context = std::make_shared<CommonAPI::MainLoopContext>();
ASSERT_TRUE((bool) context);
auto mainLoop = new CommonAPI::MainLoop(context);
@@ -153,20 +117,12 @@ TEST_F(DBusBasicMainLoopTest, PrioritiesAreHandledCorrectlyInDemoMainloop) {
class DBusMainLoopTest: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool) runtime_);
- context_ = runtime_->getNewMainLoopContext();
+ context_ = std::make_shared<CommonAPI::MainLoopContext>();
ASSERT_TRUE((bool) context_);
mainLoop_ = new CommonAPI::MainLoop(context_);
-
- mainloopFactory_ = runtime_->createFactory(context_);
- ASSERT_TRUE((bool) mainloopFactory_);
- standardFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool) standardFactory_);
-
- servicePublisher_ = runtime_->getServicePublisher();
- ASSERT_TRUE((bool) servicePublisher_);
}
virtual void TearDown() {
@@ -175,19 +131,16 @@ protected:
std::shared_ptr<CommonAPI::Runtime> runtime_;
std::shared_ptr<CommonAPI::MainLoopContext> context_;
- std::shared_ptr<CommonAPI::Factory> mainloopFactory_;
- std::shared_ptr<CommonAPI::Factory> standardFactory_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
CommonAPI::MainLoop* mainLoop_;
};
TEST_F(DBusMainLoopTest, ServiceInDemoMainloopCanBeAddressed) {
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(servicePublisher_->registerService(stub, testAddress1, mainloopFactory_));
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ ASSERT_TRUE(runtime_->registerService(domain, testAddress1, stub, context_));
- auto proxy = standardFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress1);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress1, "connection");
ASSERT_TRUE((bool) proxy);
while (!proxy->isAvailable()) {
@@ -210,18 +163,18 @@ TEST_F(DBusMainLoopTest, ServiceInDemoMainloopCanBeAddressed) {
ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
- servicePublisher_->unregisterService(testAddress1);
+ runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress1);
}
TEST_F(DBusMainLoopTest, ProxyInDemoMainloopCanCallMethods) {
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(servicePublisher_->registerService(stub, testAddress2, standardFactory_));
+ 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 = mainloopFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress2);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress2, context_);
ASSERT_TRUE((bool) proxy);
while (!proxy->isAvailable()) {
@@ -245,15 +198,15 @@ TEST_F(DBusMainLoopTest, ProxyInDemoMainloopCanCallMethods) {
ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
- servicePublisher_->unregisterService(testAddress2);
+ runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress2);
}
TEST_F(DBusMainLoopTest, ProxyAndServiceInSameDemoMainloopCanCommunicate) {
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(servicePublisher_->registerService(stub, testAddress4, mainloopFactory_));
+ 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 = mainloopFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress4);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress4, context_);
ASSERT_TRUE((bool) proxy);
while (!proxy->isAvailable()) {
@@ -277,23 +230,23 @@ TEST_F(DBusMainLoopTest, ProxyAndServiceInSameDemoMainloopCanCommunicate) {
ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
- servicePublisher_->unregisterService(testAddress4);
+ runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress4);
}
-class BigDataTestStub: public commonapi::tests::TestInterfaceStubDefault {
+class BigDataTestStub : public VERSION::commonapi::tests::TestInterfaceStubDefault {
void testDerivedTypeMethod(
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue,
- commonapi::tests::DerivedTypeCollection::TestMap testMapInValue,
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue,
- commonapi::tests::DerivedTypeCollection::TestMap& testMapOutValue) {
+ ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue,
+ ::commonapi::tests::DerivedTypeCollection::TestMap testMapInValue,
+ ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue,
+ ::commonapi::tests::DerivedTypeCollection::TestMap& testMapOutValue) {
testEnumExtended2OutValue = testEnumExtended2InValue;
testMapOutValue = testMapInValue;
}
};
TEST_F(DBusMainLoopTest, DemoMainloopClientsHandleNonavailableServices) {
- auto proxy = mainloopFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress3);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress3, context_);
ASSERT_TRUE((bool) proxy);
uint32_t uint32Value = 42;
@@ -357,21 +310,13 @@ class DBusInGLibMainLoopTest: public ::testing::Test {
virtual void SetUp() {
running_ = true;
- std::shared_ptr<CommonAPI::Runtime> runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool) runtime_);
- context_ = runtime_->getNewMainLoopContext();
+ context_ = std::make_shared<CommonAPI::MainLoopContext>();
ASSERT_TRUE((bool) context_);
doSubscriptions();
-
- mainloopFactory_ = runtime_->createFactory(context_);
- ASSERT_TRUE((bool) mainloopFactory_);
- standardFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool) standardFactory_);
-
- servicePublisher_ = runtime_->getServicePublisher();
- ASSERT_TRUE((bool) servicePublisher_);
}
virtual void TearDown() {
@@ -396,9 +341,7 @@ class DBusInGLibMainLoopTest: public ::testing::Test {
public:
std::shared_ptr<CommonAPI::MainLoopContext> context_;
- std::shared_ptr<CommonAPI::Factory> mainloopFactory_;
- std::shared_ptr<CommonAPI::Factory> standardFactory_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
bool running_;
static constexpr bool mayBlock_ = true;
@@ -463,12 +406,12 @@ class DBusInGLibMainLoopTest: public ::testing::Test {
TEST_F(DBusInGLibMainLoopTest, ProxyInGLibMainloopCanCallMethods) {
- auto proxy = mainloopFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress5);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress5, context_);
ASSERT_TRUE((bool) proxy);
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(servicePublisher_->registerService(stub, testAddress5, standardFactory_));
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ ASSERT_TRUE(runtime_->registerService(domain, testAddress5, stub, "connection"));
while(!proxy->isAvailable()) {
g_main_context_iteration(NULL, mayBlock_);
@@ -494,17 +437,17 @@ TEST_F(DBusInGLibMainLoopTest, ProxyInGLibMainloopCanCallMethods) {
ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
- servicePublisher_->unregisterService(testAddress5);
+ runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress5);
}
TEST_F(DBusInGLibMainLoopTest, ServiceInGLibMainloopCanBeAddressed) {
- auto proxy = standardFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress6);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress6, "connection");
ASSERT_TRUE((bool) proxy);
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(servicePublisher_->registerService(stub, testAddress6, mainloopFactory_));
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ ASSERT_TRUE(runtime_->registerService(domain, testAddress6, stub, context_));
uint32_t uint32Value = 42;
std::string stringValue = "Ciao (:";
@@ -533,17 +476,17 @@ TEST_F(DBusInGLibMainLoopTest, ServiceInGLibMainloopCanBeAddressed) {
ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
- servicePublisher_->unregisterService(testAddress6);
+ runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress6);
}
TEST_F(DBusInGLibMainLoopTest, ProxyAndServiceInSameGlibMainloopCanCommunicate) {
- auto proxy = mainloopFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress7);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress7, context_);
ASSERT_TRUE((bool) proxy);
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(servicePublisher_->registerService(stub, testAddress7, mainloopFactory_));
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ ASSERT_TRUE(runtime_->registerService(domain, testAddress7, stub, context_));
uint32_t uint32Value = 42;
std::string stringValue = "Ciao (:";
@@ -572,11 +515,11 @@ TEST_F(DBusInGLibMainLoopTest, ProxyAndServiceInSameGlibMainloopCanCommunicate)
ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
- servicePublisher_->unregisterService(testAddress7);
+ runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress7);
}
#endif
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusManagedTest.cpp b/src/test/DBusManagedTest.cpp
index 867e0fd..421b645 100644
--- a/src/test/DBusManagedTest.cpp
+++ b/src/test/DBusManagedTest.cpp
@@ -1,42 +1,41 @@
-/* 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/. */
+// 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.h>
+#include <CommonAPI/CommonAPI.hpp>
#define COMMONAPI_INTERNAL_COMPILATION
-#include <CommonAPI/DBus/DBusObjectManagerStub.h>
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusInputStream.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/ProxyManager.h>
+#include <CommonAPI/ProxyManager.hpp>
-#include "commonapi/tests/managed/RootInterfaceStubDefault.h"
-#include "commonapi/tests/managed/LeafInterfaceStubDefault.h"
-#include "commonapi/tests/managed/BranchInterfaceStubDefault.h"
+#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 "commonapi/tests/managed/RootInterfaceProxy.h"
-#include "commonapi/tests/managed/RootInterfaceDBusProxy.h"
-#include "commonapi/tests/managed/LeafInterfaceProxy.h"
-#include "commonapi/tests/managed/SecondRootStubDefault.h"
+#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_0/commonapi/tests/managed/SecondRootStubDefault.hpp"
#include <gtest/gtest.h>
#include <algorithm>
#include <array>
#include <memory>
-static const std::string rootAddress =
- "local:commonapi.tests.managed.RootInterface:commonapi.tests.managed.RootInterface";
+#define VERSION v1_0
+
+static const std::string domain = "local";
+static const std::string rootAddress = "commonapi.tests.managed.RootInterface";
static const std::string leafInstance = "commonapi.tests.managed.RootInterface.LeafInterface";
static const std::string branchInstance = "commonapi.tests.managed.RootInterface.BranchInterface";
static const std::string secondLeafInstance = "commonapi.tests.managed.RootInterface.LeafInterface2";
@@ -52,9 +51,7 @@ static const std::string rootObjectPath = "/commonapi/tests/managed/RootInterfac
const CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict getManagedObjects(const std::string& dbusObjectPath,
std::shared_ptr<CommonAPI::DBus::DBusConnection> connection) {
auto dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- dbusServiceName,
- dbusObjectPath,
- CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName(),
+ CommonAPI::DBus::DBusAddress(dbusServiceName, dbusObjectPath, CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName()),
"GetManagedObjects");
CommonAPI::DBus::DBusError dbusError;
@@ -73,21 +70,18 @@ class DBusManagedTest: public ::testing::Test {
protected:
virtual void SetUp() {
leafStatus_ = CommonAPI::AvailabilityStatus::UNKNOWN;
- runtime_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load());
- serviceFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime_->createFactory());
- clientFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime_->createFactory());
+ runtime_ = CommonAPI::Runtime::get();
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
-
- stubDBusConnection_ = serviceFactory->getDbusConnection();
+ stubDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(stubDBusConnection_->connect());
ASSERT_TRUE(bool(stubDBusConnection_->getDBusObjectManager()));
ASSERT_TRUE(stubDBusConnection_->requestServiceNameAndBlock(dbusServiceName));
}
virtual void TearDown() {
- runtime_->getServicePublisher()->unregisterService(rootAddress);
+ //runtime_->unregisterService(rootAddress);
stubDBusConnection_->disconnect();
stubDBusConnection_.reset();
@@ -96,9 +90,7 @@ protected:
proxyDBusConnection_.reset();
}
- std::shared_ptr<CommonAPI::DBus::DBusRuntime> runtime_;
- std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory;
- std::shared_ptr<CommonAPI::DBus::DBusFactory> clientFactory;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> stubDBusConnection_;
@@ -112,34 +104,33 @@ public:
};
TEST_F(DBusManagedTest, RegisterRoot) {
- auto rootStub = std::make_shared<commonapi::tests::managed::RootInterfaceStubDefault>();
- runtime_->getServicePublisher()->registerService(rootStub, rootAddress, serviceFactory);
+ auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
+ runtime_->registerService(domain, rootAddress, rootStub);
auto dbusObjectPathAndInterfacesDict = getManagedObjects("/", proxyDBusConnection_);
EXPECT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- runtime_->getServicePublisher()->unregisterService(rootAddress);
+ //runtime_->unregisterService(rootAddress);
}
TEST_F(DBusManagedTest, RegisterLeafUnmanaged) {
- auto leafStub = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
- runtime_->getServicePublisher()->registerService(leafStub, leafAddress, serviceFactory);
+ auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
+ runtime_->registerService(domain, leafAddress, leafStub);
auto dbusObjectPathAndInterfacesDict = getManagedObjects("/", proxyDBusConnection_);
EXPECT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- runtime_->getServicePublisher()->unregisterService(leafAddress);
+ //runtime_->unregisterService(leafAddress);
}
TEST_F(DBusManagedTest, RegisterLeafManaged) {
- auto rootStub = std::make_shared<commonapi::tests::managed::RootInterfaceStubDefault>();
- runtime_->getServicePublisher()->registerService(rootStub, rootAddress, serviceFactory);
+ auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
+ runtime_->registerService(domain, rootAddress, rootStub);
- std::shared_ptr<commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- commonapi::tests::managed::RootInterfaceDBusProxy>(
- clientFactory,
+ std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
+ VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
rootAddress,
rootInterfaceName,
dbusServiceName,
@@ -161,7 +152,7 @@ TEST_F(DBusManagedTest, RegisterLeafManaged) {
std::placeholders::_1,
std::placeholders::_2));
- auto leafStub = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
+ auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
bool reg = rootStub->registerManagedStubLeafInterface(leafStub, leafInstance);
ASSERT_TRUE(reg);
@@ -188,19 +179,18 @@ TEST_F(DBusManagedTest, RegisterLeafManaged) {
dbusObjectPathAndInterfacesDict = getManagedObjects(rootInterfaceName, proxyDBusConnection_);
EXPECT_TRUE(dbusObjectPathAndInterfacesDict.empty());
- runtime_->getServicePublisher()->unregisterService(rootAddress);
+ //runtime_->unregisterService(rootAddress);
dbusObjectPathAndInterfacesDict = getManagedObjects("/", proxyDBusConnection_);
EXPECT_TRUE(dbusObjectPathAndInterfacesDict.empty());
}
TEST_F(DBusManagedTest, RegisterLeafManagedAndCreateProxyForLeaf) {
- auto rootStub = std::make_shared<commonapi::tests::managed::RootInterfaceStubDefault>();
- bool success = runtime_->getServicePublisher()->registerService(rootStub, rootAddress, serviceFactory);
+ auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
+ bool success = runtime_->registerService(domain, rootAddress, rootStub);
ASSERT_TRUE(success);
- std::shared_ptr<commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- commonapi::tests::managed::RootInterfaceDBusProxy>(
- clientFactory,
+ std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
+ VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
rootAddress,
rootInterfaceName,
dbusServiceName,
@@ -222,13 +212,13 @@ TEST_F(DBusManagedTest, RegisterLeafManagedAndCreateProxyForLeaf) {
std::placeholders::_1,
std::placeholders::_2));
- auto leafStub = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
+ auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
success = rootStub->registerManagedStubLeafInterface(leafStub, leafInstance);
ASSERT_TRUE(success);
usleep(2000000);
- auto leafProxy = proxyManagerLeafInterface.buildProxy<commonapi::tests::managed::LeafInterfaceProxy>(leafInstance);
+ auto leafProxy = proxyManagerLeafInterface.buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(leafInstance);
for (uint32_t i = 0; !leafProxy->isAvailable() && i < 500; ++i) {
usleep(10 * 1000);
}
@@ -236,7 +226,7 @@ TEST_F(DBusManagedTest, RegisterLeafManagedAndCreateProxyForLeaf) {
ASSERT_TRUE(leafProxy->isAvailable());
CommonAPI::CallStatus callStatus;
- commonapi::tests::managed::LeafInterface::testLeafMethodError error;
+ VERSION::commonapi::tests::managed::LeafInterface::testLeafMethodError error;
int outInt;
std::string outString;
leafProxy->testLeafMethod(42, "Test", callStatus, error, outInt, outString);
@@ -249,22 +239,21 @@ TEST_F(DBusManagedTest, RegisterLeafManagedAndCreateProxyForLeaf) {
auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootInterfaceName, proxyDBusConnection_);
EXPECT_TRUE(dbusObjectPathAndInterfacesDict.empty());
- success = runtime_->getServicePublisher()->unregisterService(rootAddress);
- EXPECT_TRUE(success);
+ //success = runtime_->unregisterService(rootAddress);
+ //EXPECT_TRUE(success);
dbusObjectPathAndInterfacesDict = getManagedObjects("/", proxyDBusConnection_);
EXPECT_TRUE(dbusObjectPathAndInterfacesDict.empty());
}
TEST_F(DBusManagedTest, PropagateTeardown) {
- auto rootStub = std::make_shared<commonapi::tests::managed::RootInterfaceStubDefault>();
- bool success = runtime_->getServicePublisher()->registerService(rootStub, rootAddress, serviceFactory);
+ auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
+ bool success = runtime_->registerService(domain, rootAddress, rootStub);
ASSERT_TRUE(success);
- std::shared_ptr<commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- commonapi::tests::managed::RootInterfaceDBusProxy>(
- clientFactory,
+ std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
+ VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
rootAddress,
rootInterfaceName,
dbusServiceName,
@@ -286,13 +275,13 @@ TEST_F(DBusManagedTest, PropagateTeardown) {
std::placeholders::_1,
std::placeholders::_2));
- auto leafStub = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
+ auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
bool reg = rootStub->registerManagedStubLeafInterface(leafStub, leafInstance);
ASSERT_TRUE(reg);
usleep(2000000);
- auto leafProxy = proxyManagerLeafInterface.buildProxy<commonapi::tests::managed::LeafInterfaceProxy>(leafInstance);
+ auto leafProxy = proxyManagerLeafInterface.buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(leafInstance);
for (uint32_t i = 0; !leafProxy->isAvailable() && i < 500; ++i) {
usleep(10 * 1000);
@@ -301,15 +290,15 @@ TEST_F(DBusManagedTest, PropagateTeardown) {
ASSERT_TRUE(leafProxy->isAvailable());
CommonAPI::CallStatus callStatus;
- commonapi::tests::managed::LeafInterface::testLeafMethodError error;
+ VERSION::commonapi::tests::managed::LeafInterface::testLeafMethodError error;
int outInt;
std::string outString;
leafProxy->testLeafMethod(42, "Test", callStatus, error, outInt, outString);
ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
- bool dereg = runtime_->getServicePublisher()->unregisterService(rootAddress);
- ASSERT_TRUE(dereg);
+ //bool dereg = runtime_->unregisterService(rootAddress);
+ //ASSERT_TRUE(dereg);
for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::NOT_AVAILABLE && i < 100; ++i) {
usleep(10 * 1000);
@@ -323,31 +312,27 @@ TEST_F(DBusManagedTest, PropagateTeardown) {
class DBusManagedTestExtended: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load());
- serviceFactory_ = runtime_->createFactory();
- clientFactory_ = runtime_->createFactory();
+ runtime_ = CommonAPI::Runtime::get();
leafInstanceAvailability = CommonAPI::AvailabilityStatus::UNKNOWN;
branchInstanceAvailability = CommonAPI::AvailabilityStatus::UNKNOWN;
- manualTestDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ manualTestDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(manualTestDBusConnection_->connect());
- auto dbusServiceFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(serviceFactory_);
- auto stubDBusConnection = dbusServiceFactory->getDbusConnection();
+ auto stubDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(stubDBusConnection->connect());
ASSERT_TRUE(stubDBusConnection->requestServiceNameAndBlock(dbusServiceName));
}
virtual void TearDown() {
for (auto it: rootStubs_) {
- runtime_->getServicePublisher()->unregisterService(it.first);
+ //runtime_->unregisterService(it.first);
}
rootStubs_.clear();
rootProxies_.clear();
- auto dbusServiceFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(serviceFactory_);
- auto stubDBusConnection = dbusServiceFactory->getDbusConnection();
+ auto stubDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(stubDBusConnection->releaseServiceName(dbusServiceName));
usleep(50000);
@@ -362,15 +347,15 @@ protected:
}
inline const bool registerRootStubForSuffix(const std::string& suffix) {
- std::shared_ptr<commonapi::tests::managed::RootInterfaceStubDefault> rootStub = std::make_shared<
- commonapi::tests::managed::RootInterfaceStubDefault>();
+ std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceStubDefault> rootStub = std::make_shared<
+ VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
const std::string rootAddress = getSuffixedRootAddress(suffix);
rootStubs_.insert( {rootAddress, rootStub} );
- return runtime_->getServicePublisher()->registerService(rootStub, rootAddress, serviceFactory_);
+ return runtime_->registerService(domain, rootAddress, rootStub);
}
inline void createRootProxyForSuffix(const std::string& suffix) {
- rootProxies_.push_back(clientFactory_->buildProxy<commonapi::tests::managed::RootInterfaceProxy>(getSuffixedRootAddress(suffix)));
+ rootProxies_.push_back(runtime_->buildProxy<VERSION::commonapi::tests::managed::RootInterfaceProxy>(domain, getSuffixedRootAddress(suffix)));
}
template<typename _ProxyType>
@@ -397,8 +382,8 @@ protected:
// subscriptions.push_back(subscription);
}
for (uint32_t i = 0; i < x; i++) {
- std::shared_ptr<commonapi::tests::managed::LeafInterfaceStubDefault> leafStub = std::make_shared<
- commonapi::tests::managed::LeafInterfaceStubDefault>();
+ std::shared_ptr<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault> leafStub = std::make_shared<
+ VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
success &= (rootStubIterator.second->registerManagedStubLeafInterfaceAutoInstance(leafStub) == expectedValueForRegistration);
}
//As all root interfaces are registered on the same object path, the leaf interfaces also will be registered with
@@ -413,7 +398,7 @@ protected:
void createXLeafProxiesForAllExistingLeafs() {
for (auto rootProxyIterator : rootProxies_) {
- std::vector<std::shared_ptr<commonapi::tests::managed::LeafInterfaceProxyDefault>> leafProxiesForRootX;
+ std::vector<std::shared_ptr<VERSION::commonapi::tests::managed::LeafInterfaceProxyDefault>> leafProxiesForRootX;
CommonAPI::ProxyManager& leafProxyManager = rootProxyIterator->getProxyManagerLeafInterface();
std::vector<std::string> availableInstances;
@@ -421,22 +406,20 @@ protected:
leafProxyManager.getAvailableInstances(status, availableInstances);
for (const std::string& availableInstance : availableInstances) {
- auto newLeafProxy = leafProxyManager.buildProxy<commonapi::tests::managed::LeafInterfaceProxy>(availableInstance);
+ auto newLeafProxy = leafProxyManager.buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(availableInstance);
leafProxiesForRootX.push_back(newLeafProxy);
}
leafProxies_.push_back(std::move(leafProxiesForRootX));
}
}
- std::shared_ptr<CommonAPI::DBus::DBusRuntime> runtime_;
- std::shared_ptr<CommonAPI::Factory> serviceFactory_;
- std::shared_ptr<CommonAPI::Factory> clientFactory_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> manualTestDBusConnection_;
- std::unordered_map<std::string, std::shared_ptr<commonapi::tests::managed::RootInterfaceStubDefault>> rootStubs_;
- std::vector<std::shared_ptr<commonapi::tests::managed::RootInterfaceProxyDefault>> rootProxies_;
- std::vector<std::vector<std::shared_ptr<commonapi::tests::managed::LeafInterfaceProxyDefault>>>leafProxies_;
+ std::unordered_map<std::string, std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>> rootStubs_;
+ std::vector<std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceProxyDefault>> rootProxies_;
+ std::vector<std::vector<std::shared_ptr<VERSION::commonapi::tests::managed::LeafInterfaceProxyDefault>>>leafProxies_;
CommonAPI::AvailabilityStatus leafInstanceAvailability;
CommonAPI::AvailabilityStatus branchInstanceAvailability;
@@ -475,7 +458,7 @@ TEST_F(DBusManagedTestExtended, RegisterSeveralRootsOnSameObjectPathAndCommunica
ASSERT_TRUE(allRootProxiesAreAvailable);
CommonAPI::CallStatus callStatus;
- commonapi::tests::managed::RootInterface::testRootMethodError applicationError;
+ VERSION::commonapi::tests::managed::RootInterface::testRootMethodError applicationError;
int32_t outInt;
std::string outString;
@@ -583,13 +566,13 @@ TEST_F(DBusManagedTestExtended, RegisterSeveralRootsAndSeveralLeafsForEachOnSame
TEST_F(DBusManagedTestExtended, RegisterTwoRootsForSameLeafInterface) {
ASSERT_TRUE(registerRootStubForSuffix("One"));
- std::shared_ptr<commonapi::tests::managed::SecondRootStubDefault> secondRootStub = std::make_shared<
- commonapi::tests::managed::SecondRootStubDefault>();
+ std::shared_ptr<VERSION::commonapi::tests::managed::SecondRootStubDefault> secondRootStub = std::make_shared<
+ VERSION::commonapi::tests::managed::SecondRootStubDefault>();
const std::string rootAddressLocal = getSuffixedRootAddress("Two");
- runtime_->getServicePublisher()->registerService(secondRootStub, rootAddressLocal, serviceFactory_);
+ runtime_->registerService(secondRootStub, rootAddressLocal, serviceFactory_);
- auto leafStub1 = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
- auto leafStub2 = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
+ auto leafStub1 = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
+ auto leafStub2 = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
bool leafStub1Registered = rootStubs_.begin()->second->registerManagedStubLeafInterface(leafStub1, leafInstance);
ASSERT_TRUE(leafStub1Registered);
@@ -597,7 +580,7 @@ TEST_F(DBusManagedTestExtended, RegisterTwoRootsForSameLeafInterface) {
bool leafStub2Registered = secondRootStub->registerManagedStubLeafInterface(leafStub2, secondLeafInstance);
ASSERT_TRUE(leafStub2Registered);
- runtime_->getServicePublisher()->unregisterService(rootAddressLocal);
+ runtime_->unregisterService(rootAddressLocal);
}
TEST_F(DBusManagedTestExtended, RegisterLeafsWithDistinctInterfacesOnSameRootManaged) {
@@ -621,8 +604,8 @@ TEST_F(DBusManagedTestExtended, RegisterLeafsWithDistinctInterfacesOnSameRootMan
std::placeholders::_1,
std::placeholders::_2));
- auto leafStub1 = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
- auto leafStub2 = std::make_shared<commonapi::tests::managed::BranchInterfaceStubDefault>();
+ auto leafStub1 = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
+ auto leafStub2 = std::make_shared<VERSION::commonapi::tests::managed::BranchInterfaceStubDefault>();
bool leafStub1Registered = rootStubs_.begin()->second->registerManagedStubLeafInterface(leafStub1, leafInstance);
ASSERT_TRUE(leafStub1Registered);
@@ -663,10 +646,10 @@ TEST_F(DBusManagedTestExtended, RegisterLeafsWithDistinctInterfacesOnSameRootUnm
std::placeholders::_1,
std::placeholders::_2));
- auto leafStub1 = std::make_shared<commonapi::tests::managed::LeafInterfaceStubDefault>();
+ auto leafStub1 = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
runtime_->getServicePublisher()->registerService(leafStub1, leafAddress, serviceFactory_);
- auto leafStub2 = std::make_shared<commonapi::tests::managed::BranchInterfaceStubDefault>();
+ auto leafStub2 = std::make_shared<VERSION::commonapi::tests::managed::BranchInterfaceStubDefault>();
runtime_->getServicePublisher()->registerService(leafStub2, branchAddress, serviceFactory_);
usleep(50000);
@@ -675,11 +658,11 @@ TEST_F(DBusManagedTestExtended, RegisterLeafsWithDistinctInterfacesOnSameRootUnm
ASSERT_EQ(CommonAPI::AvailabilityStatus::UNKNOWN, leafInstanceAvailability);
ASSERT_EQ(CommonAPI::AvailabilityStatus::UNKNOWN, branchInstanceAvailability);
- runtime_->getServicePublisher()->unregisterService(leafAddress);
- runtime_->getServicePublisher()->unregisterService(branchAddress);
+ runtime_->unregisterService(leafAddress);
+ runtime_->unregisterService(branchAddress);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusMultipleConnectionTest.cpp b/src/test/DBusMultipleConnectionTest.cpp
index d14d17b..f482267 100644
--- a/src/test/DBusMultipleConnectionTest.cpp
+++ b/src/test/DBusMultipleConnectionTest.cpp
@@ -1,9 +1,8 @@
-/* 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/. */
+// 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>
@@ -17,35 +16,34 @@
#include <tuple>
#include <type_traits>
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
+#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
+#endif
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
+#define VERSION v1_0
+#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
+#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
-const std::string serviceAddress = "local:commonapi.tests.TestInterface:commonapi.tests.TestInterface";
+const std::string domain = "local";
+const std::string serviceAddress = "commonapi.tests.TestInterface";
class DBusMultipleConnectionTest: public ::testing::Test {
protected:
- virtual void SetUp() {
- proxyFactory = CommonAPI::Runtime::load()->createFactory();
- stubFactory = CommonAPI::Runtime::load()->createFactory();
- servicePublisher = CommonAPI::Runtime::load()->getServicePublisher();
- ASSERT_TRUE((bool)proxyFactory);
- ASSERT_TRUE((bool)stubFactory);
-
- stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- bool serviceNameAcquired = servicePublisher->registerService(stub, serviceAddress, stubFactory);
+ 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 = servicePublisher->registerService(stub, serviceAddress, stubFactory);
+ serviceNameAcquired = runtime->registerService(domain, serviceAddress, stub, "connection");
}
ASSERT_TRUE(serviceNameAcquired);
- proxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress);
+ proxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, serviceAddress);
ASSERT_TRUE((bool)proxy);
for(unsigned int i = 0; !proxy->isAvailable() && i < 100; ++i) {
@@ -54,15 +52,13 @@ class DBusMultipleConnectionTest: public ::testing::Test {
}
virtual void TearDown() {
- servicePublisher->unregisterService(serviceAddress);
+ runtime->unregisterService(domain, stub->getStubAdapter()->getInterface(), serviceAddress);
usleep(30000);
}
- std::shared_ptr<CommonAPI::Factory> proxyFactory;
- std::shared_ptr<CommonAPI::Factory> stubFactory;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher;
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub;
- std::shared_ptr<commonapi::tests::TestInterfaceProxyDefault> proxy;
+ std::shared_ptr<CommonAPI::Runtime> runtime;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxy<>> proxy;
};
@@ -138,7 +134,7 @@ TEST_F(DBusMultipleConnectionTest, GetAttribute) {
ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusNameCacheTest.cpp b/src/test/DBusNameCacheTest.cpp
deleted file mode 100644
index e988131..0000000
--- a/src/test/DBusNameCacheTest.cpp
+++ /dev/null
@@ -1,30 +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 <common-api-dbus/dbus-connection.h>
-#include <common-api-dbus/dbus-name-cache.h>
-
-
-
-int main(void) {
- auto dbusConnection = common::api::dbus::DBusConnection::getSessionBus();
-
- dbusConnection->connect();
-
- common::api::dbus::DBusNameCache dbusNameCache(dbusConnection);
-
- dbusConnection->requestServiceNameAndBlock("common.api.dbus.test.DBusNameCache");
-
- for (int i = 0; i < 5; i++)
- dbusConnection->readWriteDispatch(100);
-
- dbusConnection->releaseServiceName("common.api.dbus.test.DBusNameCache");
-
- for (int i = 0; i < 5; i++)
- dbusConnection->readWriteDispatch(100);
-
- return 0;
-}
diff --git a/src/test/DBusObjectManagerStubTest.cpp b/src/test/DBusObjectManagerStubTest.cpp
index 5c75075..fa8a796 100644
--- a/src/test/DBusObjectManagerStubTest.cpp
+++ b/src/test/DBusObjectManagerStubTest.cpp
@@ -1,23 +1,20 @@
-/* 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/. */
+// 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.h>
+#include <CommonAPI/CommonAPI.hpp>
#define COMMONAPI_INTERNAL_COMPILATION
-#include <CommonAPI/DBus/DBusObjectManagerStub.h>
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusInputStream.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#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>
@@ -30,16 +27,10 @@ static const std::string& managedDBusObjectPathPrefix = "/commonapi/dbus/test/DB
class TestDBusStubAdapter: public CommonAPI::DBus::DBusStubAdapter {
public:
- TestDBusStubAdapter(const std::shared_ptr<CommonAPI::DBus::DBusFactory> factory,
- const std::string& dbusObjectPath,
+ TestDBusStubAdapter(const std::string& dbusObjectPath,
const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
const bool isManagingInterface) :
- DBusStubAdapter(
- factory,
- "local:" + dbusServiceName + ":commonapi.dbus.tests.TestDBusStubAdapter-" + dbusObjectPath,
- "commonapi.dbus.tests.TestDBusStubAdapter",
- dbusServiceName,
- dbusObjectPath,
+ DBusStubAdapter(CommonAPI::DBus::DBusAddress(dbusServiceName, dbusObjectPath, "commonapi.dbus.tests.TestDBusStubAdapter"),
dbusConnection,
isManagingInterface) {
}
@@ -61,30 +52,22 @@ public:
}
protected:
- TestDBusStubAdapter(const std::shared_ptr<CommonAPI::DBus::DBusFactory> factory,
- const std::string& dbusObjectPath,
+ TestDBusStubAdapter(const std::string& dbusObjectPath,
const std::string& dbusInterfaceName,
const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
const bool isManagingInterface) :
- DBusStubAdapter(
- factory,
- "local:" + dbusServiceName + ":" + dbusInterfaceName + "-" + dbusObjectPath,
- dbusInterfaceName,
- dbusServiceName,
- dbusObjectPath,
- dbusConnection,
- isManagingInterface) {
+ DBusStubAdapter(CommonAPI::DBus::DBusAddress(dbusServiceName, dbusObjectPath, dbusInterfaceName),
+ dbusConnection,
+ isManagingInterface) {
}
};
class ManagerTestDBusStubAdapter: public TestDBusStubAdapter {
public:
- ManagerTestDBusStubAdapter(const std::shared_ptr<CommonAPI::DBus::DBusFactory> factory,
- const std::string& dbusObjectPath,
+ ManagerTestDBusStubAdapter(const std::string& dbusObjectPath,
const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection) :
- TestDBusStubAdapter(
- factory,
+ TestDBusStubAdapter(
dbusObjectPath,
"commonapi.dbus.tests.ManagerTestDBusStubAdapter",
dbusConnection,
@@ -175,10 +158,9 @@ private:
class DBusObjectManagerStubTest: public ::testing::Test {
protected:
virtual void SetUp() {
- auto runtime = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load());
- serviceFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime->createFactory());
+ runtime = CommonAPI::Runtime::get();
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
stubDBusConnection_ = serviceFactory->getDbusConnection();
@@ -197,7 +179,7 @@ protected:
proxyDBusConnection_.reset();
}
- std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory;
+ std::shared_ptr<CommonAPI::Runtime> runtime;
void getManagedObjects(const std::string& dbusObjectPath,
CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dbusObjectPathAndInterfacesDict) {
@@ -498,7 +480,7 @@ TEST_F(DBusObjectManagerStubTest, DestructorUnpublishingWorks) {
ASSERT_TRUE(wasServiceDeregistrationSuccessful);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusOutputStreamTest.cpp b/src/test/DBusOutputStreamTest.cpp
index 1549101..98d8285 100644
--- a/src/test/DBusOutputStreamTest.cpp
+++ b/src/test/DBusOutputStreamTest.cpp
@@ -1,19 +1,23 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#include <dbus/dbus.h>
#include <gtest/gtest.h>
-#include <CommonAPI/DBus/DBusMessage.h>
-#include <CommonAPI/DBus/DBusOutputStream.h>
-#include <CommonAPI/DBus/DBusInputStream.h>
-#include <CommonAPI/SerializableStruct.h>
-#include <CommonAPI/SerializableVariant.h>
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/Struct.hpp>
+#include <CommonAPI/Variant.hpp>
-#include "commonapi/tests/DerivedTypeCollection.h"
+#include "commonapi/tests/DerivedTypeCollection.hpp"
class OutputStreamTest: public ::testing::Test {
protected:
@@ -42,10 +46,10 @@ TEST_F(OutputStreamTest, CanBeConstructed) {
TEST_F(OutputStreamTest, WritesBytes) {
const char signature[] = "yyyyyyyyyy";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(busName, objectPath, interfaceName, methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
CommonAPI::DBus::DBusOutputStream outStream(message);
- outStream.reserveMemory(numOfElements);
+ //outStream.reserveMemory(numOfElements);
uint8_t val1 = 0xff;
uint8_t val2 = 0x00;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -70,11 +74,11 @@ TEST_F(OutputStreamTest, WritesBytes) {
}
TEST_F(OutputStreamTest, WritesBools) {
- const char signature[] = "bbbbbbbbbb";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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) {
@@ -99,11 +103,11 @@ TEST_F(OutputStreamTest, WritesBools) {
}
TEST_F(OutputStreamTest, WritesUInt16) {
- const char signature[] = "qqqqqqqqqq";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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) {
@@ -128,11 +132,11 @@ TEST_F(OutputStreamTest, WritesUInt16) {
}
TEST_F(OutputStreamTest, WritesInt16) {
- const char signature[] = "nnnnnnnnnn";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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);
+ //outStream.reserveMemory(numOfElements * 2);
int16_t val1 = 0x7fff;
int16_t val2 = 0xffff;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -157,11 +161,11 @@ TEST_F(OutputStreamTest, WritesInt16) {
}
TEST_F(OutputStreamTest, WritesUInt32) {
- const char signature[] = "uuuuuuuuuu";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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) {
@@ -186,11 +190,11 @@ TEST_F(OutputStreamTest, WritesUInt32) {
}
TEST_F(OutputStreamTest, WritesInt32) {
- const char signature[] = "iiiiiiiiii";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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) {
@@ -215,11 +219,11 @@ TEST_F(OutputStreamTest, WritesInt32) {
}
TEST_F(OutputStreamTest, WritesUInt64) {
- const char signature[] = "tttttttttt";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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) {
@@ -244,11 +248,11 @@ TEST_F(OutputStreamTest, WritesUInt64) {
}
TEST_F(OutputStreamTest, WritesInt64) {
- const char signature[] = "xxxxxxxxxx";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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) {
@@ -273,11 +277,11 @@ TEST_F(OutputStreamTest, WritesInt64) {
}
TEST_F(OutputStreamTest, WritesDouble) {
- const char signature[] = "dddddddddd";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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) {
@@ -303,8 +307,8 @@ TEST_F(OutputStreamTest, WritesDouble) {
}
TEST_F(OutputStreamTest, WritesStrings) {
- const char signature[] = "sss";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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";
@@ -312,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();
@@ -338,48 +342,65 @@ TEST_F(OutputStreamTest, WritesStrings) {
namespace bmw {
namespace test {
-struct myStruct: CommonAPI::SerializableStruct {
+struct myStruct : CommonAPI::Struct<uint32_t, int16_t, bool, std::string, double> {
~myStruct();
- uint32_t a;
- int16_t b;
- bool c;
- std::string d;
- double e;
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputMessageStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputMessageStream) const;
+ 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();
+ }
};
myStruct::~myStruct() {
}
-void myStruct::readFromInputStream(CommonAPI::InputStream& inputMessageStream) {
- inputMessageStream >> a >> b >> c >> d >> e;
-}
-
-void myStruct::writeToOutputStream(CommonAPI::OutputStream& outputMessageStream) const {
- outputMessageStream << a << b << c << d << e;
-}
-
} //namespace test
} //namespace bmw
-TEST_F(OutputStreamTest, WritesStructs) {
- const char signature[] = "(unbsd)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(busName, objectPath, interfaceName, methodName, signature);
+TEST_F(OutputStreamTest, DISABLED_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.a = 15;
- testStruct.b = -32;
- testStruct.c = FALSE;
- testStruct.d = "Hello all";
- testStruct.e = 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();
@@ -389,16 +410,16 @@ TEST_F(OutputStreamTest, WritesStructs) {
bmw::test::myStruct verifyStruct;
inStream >> verifyStruct;
- EXPECT_EQ(testStruct.a, verifyStruct.a);
- EXPECT_EQ(testStruct.b, verifyStruct.b);
- EXPECT_EQ(testStruct.c, verifyStruct.c);
- EXPECT_EQ(testStruct.d, verifyStruct.d);
- EXPECT_EQ(testStruct.e, verifyStruct.e);
+ 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(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;
@@ -409,7 +430,7 @@ TEST_F(OutputStreamTest, WritesArrays) {
testVector.push_back(val2);
}
- outStream.reserveMemory(numOfElements * 4 + 4);
+ //outStream.reserveMemory(numOfElements * 4 + 4);
outStream << testVector;
outStream.flush();
@@ -430,8 +451,8 @@ TEST_F(OutputStreamTest, WritesArrays) {
}
TEST_F(OutputStreamTest, WritesArraysOfStrings) {
- const char signature[] = "as";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
@@ -446,7 +467,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();
@@ -467,8 +488,8 @@ TEST_F(OutputStreamTest, WritesArraysOfStrings) {
}
TEST_F(OutputStreamTest, WritesArraysInArrays) {
- const char signature[] = "aai";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
@@ -483,7 +504,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();
@@ -508,10 +529,10 @@ TEST_F(OutputStreamTest, WritesArraysInArrays) {
typedef CommonAPI::Variant<int8_t, uint32_t, double, std::string> BasicTypeVariant;
-TEST_F(OutputStreamTest, WritesArraysOfVariants) {
+TEST_F(OutputStreamTest, DISABLED_WritesArraysOfVariants) {
numOfElements = 4;
- const char signature[] = "(yv)(yv)(yv)(yv)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
@@ -535,15 +556,15 @@ TEST_F(OutputStreamTest, 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 << testVector;
+ //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 >> verifyVector;
+ inStream.readValue(verifyVector, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
BasicTypeVariant resultInt8Variant = verifyVector[0];
BasicTypeVariant resultUint32Variant = verifyVector[1];
@@ -560,39 +581,50 @@ namespace com {
namespace bmw {
namespace test {
-struct TestStruct: CommonAPI::SerializableStruct {
+struct TestStruct : CommonAPI::Struct<int32_t, double, double, std::string> {
TestStruct();
TestStruct(int32_t v1, double v2, double v3, std::string v4);
~TestStruct();
- int32_t val1;
- double val2;
- double val3;
- std::string val4;
+ 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 readFromInputStream(CommonAPI::InputStream& inputMessageStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputMessageStream) const;
+ virtual void setVal1(int32_t val1) { std::get<0>(values_) = val1; }
+ virtual void setVal2(double val2) { std::get<1>(values_) = val2; }
+ virtual void setVal3(double val3) { std::get<2>(values_) = val3; }
+ virtual void setVal4(std::string val4) { std::get<3>(values_) = val4; }
+
+ virtual void readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputMessageStream);
+ virtual void writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputMessageStream) const;
};
typedef std::vector<TestStruct> TestStructList;
-TestStruct::TestStruct() :
- val1(0), val2(0), val3(0), val4("") {
+TestStruct::TestStruct() {
+ std::get<0>(values_) = 0;
+ std::get<1>(values_) = 0;
+ std::get<2>(values_) = 0;
+ std::get<3>(values_) = "";
}
-TestStruct::TestStruct(int32_t v1, double v2, double v3, std::string v4) :
- val1(v1), val2(v2), val3(v3), val4(v4) {
+TestStruct::TestStruct(int32_t v1, double v2, double v3, std::string v4) {
+ std::get<0>(values_) = v1;
+ std::get<1>(values_) = v2;
+ std::get<2>(values_) = v3;
+ std::get<3>(values_) = v4;
}
TestStruct::~TestStruct() {
}
-void TestStruct::readFromInputStream(CommonAPI::InputStream& inputMessageStream) {
- inputMessageStream >> val1 >> val2 >> val3 >> val4;
+void TestStruct::readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputMessageStream) {
+ inputMessageStream >> std::get<0>(values_) >> std::get<1>(values_) >> std::get<2>(values_) >> std::get<3>(values_);
}
-void TestStruct::writeToOutputStream(CommonAPI::OutputStream& outputMessageStream) const {
- outputMessageStream << val1 << val2 << val3 << val4;
+void TestStruct::writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputMessageStream) const {
+ outputMessageStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_);
}
} // namespace test
@@ -600,15 +632,15 @@ void TestStruct::writeToOutputStream(CommonAPI::OutputStream& outputMessageStrea
} // namespace com
TEST_F(OutputStreamTest, WritesTestStructs) {
- const char signature[] = "(idds)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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();
@@ -618,15 +650,15 @@ TEST_F(OutputStreamTest, WritesTestStructs) {
com::bmw::test::TestStruct verifyStruct;
inStream >> verifyStruct;
- EXPECT_EQ(testStruct.val1, verifyStruct.val1);
- EXPECT_EQ(testStruct.val2, verifyStruct.val2);
- EXPECT_EQ(testStruct.val3, verifyStruct.val3);
- EXPECT_EQ(testStruct.val4, verifyStruct.val4);
+ EXPECT_EQ(testStruct.getVal1(), verifyStruct.getVal1());
+ EXPECT_EQ(testStruct.getVal2(), verifyStruct.getVal2());
+ EXPECT_EQ(testStruct.getVal3(), verifyStruct.getVal3());
+ EXPECT_EQ(testStruct.getVal4(), verifyStruct.getVal4());
}
TEST_F(OutputStreamTest, WritesTestStructLists) {
- const char signature[] = "a(idds)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
@@ -637,7 +669,7 @@ 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);
+ //outStream.reserveMemory(expectedSize);
outStream << testList;
outStream.flush();
@@ -654,7 +686,7 @@ namespace com {
namespace bmw {
namespace test {
-struct ArrayStruct: CommonAPI::SerializableStruct {
+struct ArrayStruct : CommonAPI::Struct<std::vector<int64_t>, std::vector<std::string>, std::vector<double>, std::vector<std::string>, std::vector<uint16_t>> {
ArrayStruct();
ArrayStruct(std::vector<int64_t> v1,
std::vector<std::string> v2,
@@ -663,14 +695,26 @@ struct ArrayStruct: CommonAPI::SerializableStruct {
std::vector<uint16_t> v5);
~ArrayStruct();
- std::vector<int64_t> val1;
- std::vector<std::string> val2;
- std::vector<double> val3;
- std::vector<std::string> val4;
- std::vector<uint16_t> val5;
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputMessageStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& 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;
@@ -682,19 +726,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) :
- val1(v1), val2(v2), val3(v3), val4(v4), val5(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& inputMessageStream) {
- inputMessageStream >> val1 >> val2 >> val3 >> val4 >> val5;
+void ArrayStruct::readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputMessageStream) {
+ inputMessageStream >> std::get<0>(values_) >> std::get<1>(values_) >> std::get<2>(values_) >> std::get<3>(values_) >> std::get<4>(values_);
}
-void ArrayStruct::writeToOutputStream(CommonAPI::OutputStream& outputMessageStream) const {
- outputMessageStream << val1 << val2 << val3 << val4 << val5;
+void ArrayStruct::writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputMessageStream) const {
+ outputMessageStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_) << std::get<4>(values_);
}
} // namespace test
@@ -702,17 +750,17 @@ void ArrayStruct::writeToOutputStream(CommonAPI::OutputStream& outputMessageStre
} // namespace com
TEST_F(OutputStreamTest, WritesStructsOfArraysWithSthBefore) {
- const char signature[] = "(axasadasaq)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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.val1.push_back(i * 50);
- arrayStruct.val2.push_back("Hai");
- arrayStruct.val3.push_back(3.414);
- arrayStruct.val4.push_back("Ciao");
- arrayStruct.val5.push_back(i * 5);
+ arrayStruct.addToVal1(i * 50);
+ arrayStruct.addToVal2("Hai");
+ arrayStruct.addToVal3(3.414);
+ arrayStruct.addToVal4("Ciao");
+ arrayStruct.addToVal5(i * 5);
}
uint16_t frontValue = 0;
@@ -723,7 +771,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();
@@ -744,11 +792,11 @@ TEST_F(OutputStreamTest, WritesStructsOfArraysWithSthBefore) {
uint16_t res5;
for (unsigned int i = 0; i < numOfElements; i++) {
- res1 = verifyStruct.val1[i];
- res2 = verifyStruct.val2[i];
- res3 = verifyStruct.val3[i];
- res4 = verifyStruct.val4[i];
- res5 = verifyStruct.val5[i];
+ res1 = verifyStruct.getVal1()[i];
+ res2 = verifyStruct.getVal2()[i];
+ res3 = verifyStruct.getVal3()[i];
+ res4 = verifyStruct.getVal4()[i];
+ res5 = verifyStruct.getVal5()[i];
EXPECT_EQ(i*50, res1);
EXPECT_EQ(std::string("Hai"), res2);
@@ -759,15 +807,15 @@ TEST_F(OutputStreamTest, WritesStructsOfArraysWithSthBefore) {
}
TEST_F(OutputStreamTest, WritesEnumKeyedMaps) {
- commonapi::tests::DerivedTypeCollection::TestEnumMap testEnumMap;
-
- commonapi::tests::DerivedTypeCollection::TestEnum key1 =
- commonapi::tests::DerivedTypeCollection::TestEnum::E_NOT_USED;
- commonapi::tests::DerivedTypeCollection::TestEnum key2 = commonapi::tests::DerivedTypeCollection::TestEnum::E_OK;
- commonapi::tests::DerivedTypeCollection::TestEnum key3 =
- commonapi::tests::DerivedTypeCollection::TestEnum::E_OUT_OF_RANGE;
- commonapi::tests::DerivedTypeCollection::TestEnum key4 =
- commonapi::tests::DerivedTypeCollection::TestEnum::E_UNKNOWN;
+ ::commonapi::tests::DerivedTypeCollection::TestEnumMap testEnumMap;
+
+ ::commonapi::tests::DerivedTypeCollection::TestEnum key1 =
+ ::commonapi::tests::DerivedTypeCollection::TestEnum::E_NOT_USED;
+ ::commonapi::tests::DerivedTypeCollection::TestEnum key2 = ::commonapi::tests::DerivedTypeCollection::TestEnum::E_OK;
+ ::commonapi::tests::DerivedTypeCollection::TestEnum key3 =
+ ::commonapi::tests::DerivedTypeCollection::TestEnum::E_OUT_OF_RANGE;
+ ::commonapi::tests::DerivedTypeCollection::TestEnum key4 =
+ ::commonapi::tests::DerivedTypeCollection::TestEnum::E_UNKNOWN;
std::string val = "Hai";
testEnumMap.insert( {key1, val});
@@ -775,14 +823,14 @@ TEST_F(OutputStreamTest, WritesEnumKeyedMaps) {
testEnumMap.insert( {key3, val});
testEnumMap.insert( {key4, val});
- const char signature[] = "a{is}";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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();
@@ -790,7 +838,7 @@ TEST_F(OutputStreamTest, WritesEnumKeyedMaps) {
CommonAPI::DBus::DBusInputStream inStream(message);
- commonapi::tests::DerivedTypeCollection::TestEnumMap verificationMap;
+ ::commonapi::tests::DerivedTypeCollection::TestEnumMap verificationMap;
inStream >> verificationMap;
for (auto it = verificationMap.begin(); it != verificationMap.end(); ++it) {
@@ -798,9 +846,9 @@ TEST_F(OutputStreamTest, WritesEnumKeyedMaps) {
}
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/test/DBusPolymorphicTest.cpp b/src/test/DBusPolymorphicTest.cpp
index 0c0dd98..be7082f 100644
--- a/src/test/DBusPolymorphicTest.cpp
+++ b/src/test/DBusPolymorphicTest.cpp
@@ -1,49 +1,50 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#include <gtest/gtest.h>
-#include <commonapi/tests/DerivedTypeCollection.h>
-#include <commonapi/tests/TestInterfaceDBusProxy.h>
-#include <commonapi/tests/TestInterfaceDBusStubAdapter.h>
-#include <commonapi/tests/TestInterfaceStubDefault.h>
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusRuntime.h>
+#include "CommonAPI/CommonAPI.hpp"
#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#endif
+#include "CommonAPI/DBus/DBusConnection.hpp"
+
+#define VERSION v1_0
+
+#include <commonapi/tests/DerivedTypeCollection.hpp>
+#include <v1_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";
static const std::string objectPath = "/CommonAPI/DBus/tests/DBusProxyTestService";
-class PolymorphicTestStub: public commonapi::tests::TestInterfaceStubDefault {
+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) {
+ std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> inArray) {
numberOfContainedElements_ = inArray.size();
if (numberOfContainedElements_ > 0) {
- std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
+ std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
std::dynamic_pointer_cast<
- commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
+ ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
inArray[0]);
firstElementIsExtended_ = (extended != NULL);
}
if (numberOfContainedElements_ > 1) {
- std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
+ std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
std::dynamic_pointer_cast<
- commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
+ ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
inArray[1]);
secondElementIsExtended_ = (extended != NULL);
}
@@ -51,38 +52,38 @@ public:
void TestMapOfPolymorphicStructMethod(
const std::shared_ptr<CommonAPI::ClientId> clientId,
- std::unordered_map<uint8_t, std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> inMap) {
+ std::unordered_map<uint8_t, std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> inMap) {
numberOfContainedElements_ = inMap.size();
auto iteratorFirst = inMap.find(5);
auto iteratorSecond = inMap.find(10);
if (iteratorFirst != inMap.end()) {
- std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
+ std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
std::dynamic_pointer_cast<
- commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
+ ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
iteratorFirst->second);
firstElementIsExtended_ = (extended != NULL);
}
if (iteratorSecond != inMap.end()) {
- std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
+ std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
std::dynamic_pointer_cast<
- commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
+ ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
iteratorSecond->second);
secondElementIsExtended_ = (extended != NULL);
}
}
void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
- commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inStruct) {
- if (inStruct.polymorphicMember != NULL) {
+ ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inStruct) {
+ if (inStruct.getPolymorphicMember() != NULL) {
numberOfContainedElements_ = 1;
- std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
+ std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
std::dynamic_pointer_cast<
- commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
- inStruct.polymorphicMember);
+ ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
+ inStruct.getPolymorphicMember());
firstElementIsExtended_ = (extended != NULL);
}
}
@@ -95,20 +96,12 @@ public:
class PolymorphicTest: public ::testing::Test {
protected:
void SetUp() {
- auto runtime = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load());
-
- serviceFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime->createFactory());
+ auto runtime = CommonAPI::Runtime::get();
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
- proxy_ = std::make_shared<commonapi::tests::TestInterfaceDBusProxy>(
- serviceFactory,
- commonApiAddress,
- interfaceName,
- busName,
- objectPath,
- proxyDBusConnection_);
+ proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
proxy_->init();
registerTestStub();
@@ -118,43 +111,33 @@ protected:
}
ASSERT_TRUE(proxy_->isAvailable());
- baseInstance1_ = std::make_shared<commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>();
- baseInstance1_->testString = "abc";
+ baseInstance1_ = std::make_shared<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>();
+ baseInstance1_->setTestString("abc");
- extendedInstance1_ = std::make_shared<commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>();
- extendedInstance1_->additionalValue = 7;
+ extendedInstance1_ = std::make_shared<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>();
+ extendedInstance1_->setAdditionalValue(7);
}
- std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory;
-
virtual void TearDown() {
deregisterTestStub();
usleep(30000);
}
void registerTestStub() {
- stubDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ stubDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(stubDBusConnection_->connect());
testStub = std::make_shared<PolymorphicTestStub>();
- stubAdapter_ = std::make_shared<commonapi::tests::TestInterfaceDBusStubAdapter>(
- serviceFactory,
- commonApiAddress,
- interfaceName,
- busName,
- objectPath,
- stubDBusConnection_,
- testStub);
- stubAdapter_->init(stubAdapter_);
-
- const bool isStubAdapterRegistered = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(
- 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);
ASSERT_TRUE(isStubAdapterRegistered);
}
void deregisterTestStub() {
- const bool isStubAdapterUnregistered = CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(
- stubAdapter_->getAddress());
+ const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(stubAdapter_->getAddress().getDomain(), stubAdapter_->getInterface(), stubAdapter_->getAddress().getInstance());
ASSERT_TRUE(isStubAdapterUnregistered);
stubAdapter_.reset();
@@ -165,48 +148,48 @@ protected:
}
std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<commonapi::tests::TestInterfaceDBusProxy> proxy_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> stubDBusConnection_;
- std::shared_ptr<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_;
+ std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> baseInstance1_;
+ std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extendedInstance1_;
std::shared_ptr<PolymorphicTestStub> testStub;
};
-TEST_F(PolymorphicTest, SendVectorOfBaseType) {
+TEST_F(PolymorphicTest, DISABLED_SendVectorOfBaseType) {
CommonAPI::CallStatus stat;
- std::vector<std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
+ std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
inputArray.push_back(baseInstance1_);
- proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat);
+ proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat, nullptr);
ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
ASSERT_EQ(testStub->numberOfContainedElements_, 1);
ASSERT_FALSE(testStub->firstElementIsExtended_);
}
-TEST_F(PolymorphicTest, SendVectorOfExtendedType) {
+TEST_F(PolymorphicTest, DISABLED_SendVectorOfExtendedType) {
CommonAPI::CallStatus stat;
- std::vector<std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
+ std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
inputArray.push_back(extendedInstance1_);
- proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat);
+ proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat, nullptr);
ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
ASSERT_EQ(testStub->numberOfContainedElements_, 1);
ASSERT_TRUE(testStub->firstElementIsExtended_);
}
-TEST_F(PolymorphicTest, SendVectorOfBaseAndExtendedType) {
+TEST_F(PolymorphicTest, DISABLED_SendVectorOfBaseAndExtendedType) {
CommonAPI::CallStatus stat;
- std::vector<std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
+ std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
inputArray.push_back(baseInstance1_);
inputArray.push_back(extendedInstance1_);
- proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat);
+ proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat, nullptr);
ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
ASSERT_EQ(testStub->numberOfContainedElements_, 2);
@@ -214,13 +197,13 @@ TEST_F(PolymorphicTest, SendVectorOfBaseAndExtendedType) {
ASSERT_TRUE(testStub->secondElementIsExtended_);
}
-TEST_F(PolymorphicTest, SendMapOfBaseAndExtendedType) {
+TEST_F(PolymorphicTest, DISABLED_SendMapOfBaseAndExtendedType) {
CommonAPI::CallStatus stat;
- std::unordered_map<uint8_t, std::shared_ptr<commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputMap;
+ std::unordered_map<uint8_t, std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputMap;
inputMap.insert( {5, baseInstance1_});
inputMap.insert( {10, extendedInstance1_});
- proxy_->TestMapOfPolymorphicStructMethod(inputMap, stat);
+ proxy_->TestMapOfPolymorphicStructMethod(inputMap, stat, nullptr);
ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
ASSERT_EQ(testStub->numberOfContainedElements_, 2);
@@ -228,31 +211,31 @@ TEST_F(PolymorphicTest, SendMapOfBaseAndExtendedType) {
ASSERT_TRUE(testStub->secondElementIsExtended_);
}
-TEST_F(PolymorphicTest, SendStructWithPolymorphicMember) {
+TEST_F(PolymorphicTest, DISABLED_SendStructWithPolymorphicMember) {
CommonAPI::CallStatus stat;
- commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inputStruct;
- inputStruct.polymorphicMember = extendedInstance1_;
+ ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inputStruct;
+ inputStruct.setPolymorphicMember(extendedInstance1_);
- proxy_->TestStructWithPolymorphicMemberMethod(inputStruct, stat);
+ proxy_->TestStructWithPolymorphicMemberMethod(inputStruct, stat, nullptr);
ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
ASSERT_EQ(testStub->numberOfContainedElements_, 1);
ASSERT_TRUE(testStub->firstElementIsExtended_);
}
-TEST_F(PolymorphicTest, SendStructWithMapWithEnumKeyMember) {
+TEST_F(PolymorphicTest, DISABLED_SendStructWithMapWithEnumKeyMember) {
CommonAPI::CallStatus stat;
- commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap inputStruct;
- inputStruct.testMap.insert( { commonapi::tests::DerivedTypeCollection::TestEnum::E_OK, "test" } );
+ ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap inputStruct;
+ std::get<0>(inputStruct.values_).insert( { commonapi::tests::DerivedTypeCollection::TestEnum::E_OK, "test" } );
- proxy_->TestStructWithEnumKeyMapMember(inputStruct, stat);
+ proxy_->TestStructWithEnumKeyMapMember(inputStruct, stat, nullptr);
ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/test/DBusProxyTest.cpp b/src/test/DBusProxyTest.cpp
index fd398c2..983879e 100644
--- a/src/test/DBusProxyTest.cpp
+++ b/src/test/DBusProxyTest.cpp
@@ -1,40 +1,35 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#ifndef _GLIBCXX_USE_NANOSLEEP
#define _GLIBCXX_USE_NANOSLEEP
#endif
+#include <CommonAPI/CommonAPI.hpp>
+
#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusInputStream.h>
-#include <CommonAPI/DBus/DBusMessage.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-
-#include <commonapi/tests/TestInterfaceDBusProxy.h>
-#include <commonapi/tests/TestInterfaceDBusStubAdapter.h>
-#include <commonapi/tests/TestInterfaceStubDefault.h>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <commonapi/tests/ExtendedInterfaceProxy.h>
-#include <commonapi/tests/ExtendedInterfaceDBusProxy.h>
-#include <commonapi/tests/ExtendedInterfaceDBusStubAdapter.h>
-#include <commonapi/tests/ExtendedInterfaceStubDefault.h>
+#include <v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp>
+#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
+#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
+#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 "DBusTestUtils.h"
+#include "DBusTestUtils.hpp"
#include <gtest/gtest.h>
@@ -45,72 +40,66 @@
#include <thread>
#include <vector>
-
-static const std::string commonApiAddress = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService";
-static const std::string commonApiAddressExtended = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService2";
+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 objectPath = "/CommonAPI/DBus/tests/DBusProxyTestService";
static const std::string objectPathExtended = "/CommonAPI/DBus/tests/DBusProxyTestService2";
-static const std::string commonApiAddressFreedesktop = "local:org.freedesktop.XYZ:CommonAPI.DBus.tests.DBusProxyTestInterface";
+static const std::string commonApiAddressFreedesktop = "CommonAPI.DBus.tests.DBusProxyTestInterface";
+#define VERSION v1_0
class ProxyTest: public ::testing::Test {
protected:
void SetUp() {
- runtime_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load());
-
- serviceFactory_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime_->createFactory());
+ runtime_ = CommonAPI::Runtime::get();
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
- proxy_ = std::make_shared<commonapi::tests::TestInterfaceDBusProxy>(
- serviceFactory_,
- commonApiAddress,
- interfaceName,
- busName,
- objectPath,
+ proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(
+ CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName),
proxyDBusConnection_);
proxy_->init();
}
- std::shared_ptr<CommonAPI::DBus::DBusRuntime> runtime_;
- std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
virtual void TearDown() {
usleep(300000);
}
void registerTestStub() {
- stubDefault_ = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- bool isTestStubAdapterRegistered_ = runtime_->getServicePublisher()->registerService<commonapi::tests::TestInterfaceStub>(stubDefault_, commonApiAddress, serviceFactory_);
+ 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<commonapi::tests::ExtendedInterfaceStubDefault>();
+ stubExtended_ = std::make_shared<VERSION::commonapi::tests::ExtendedInterfaceStubDefault>();
- bool isExtendedStubAdapterRegistered_ = runtime_->getServicePublisher()->registerService<commonapi::tests::ExtendedInterfaceStub>(stubExtended_, commonApiAddressExtended, serviceFactory_);
+ bool isExtendedStubAdapterRegistered_ = runtime_->registerService<VERSION::commonapi::tests::ExtendedInterfaceStub>(domain, commonApiAddressExtended, stubExtended_, "connection");
ASSERT_TRUE(isExtendedStubAdapterRegistered_);
usleep(100000);
}
void deregisterTestStub() {
- const bool isStubAdapterUnregistered = CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(
- commonApiAddress);
+ const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(
+ domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
ASSERT_TRUE(isStubAdapterUnregistered);
stubDefault_.reset();
isTestStubAdapterRegistered_ = false;
}
void deregisterExtendedStub() {
- const bool isStubAdapterUnregistered = runtime_->getServicePublisher()->unregisterService(
- commonApiAddressExtended);
+ const bool isStubAdapterUnregistered = runtime_->unregisterService(
+ domain, stubExtended_->CommonAPI::Stub<VERSION::commonapi::tests::ExtendedInterfaceStubAdapter, VERSION::commonapi::tests::ExtendedInterfaceStubRemoteEvent>::getStubAdapter()->VERSION::commonapi::tests::ExtendedInterface::getInterface(), commonApiAddressExtended);
ASSERT_TRUE(isStubAdapterUnregistered);
stubExtended_.reset();
isExtendedStubAdapterRegistered_ = false;
@@ -144,27 +133,28 @@ protected:
bool isTestStubAdapterRegistered_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<commonapi::tests::TestInterfaceDBusProxy> proxy_;
- CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
+
+ CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
CommonAPI::ProxyStatusEvent::Subscription proxyStatusSubscription_;
- std::shared_ptr<commonapi::tests::ExtendedInterfaceStubDefault> stubExtended_;
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stubDefault_;
+ std::shared_ptr<VERSION::commonapi::tests::ExtendedInterfaceStubDefault> stubExtended_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
};
TEST_F(ProxyTest, HasCorrectConnectionName) {
- std::string actualName = proxy_->getDBusBusName();
+ std::string actualName = proxy_->getDBusAddress().getService();
EXPECT_EQ(busName, actualName);
}
TEST_F(ProxyTest, HasCorrectObjectPath) {
- std::string actualPath = proxy_->getDBusObjectPath();
+ std::string actualPath = proxy_->getDBusAddress().getObjectPath();
EXPECT_EQ(objectPath, actualPath);
}
TEST_F(ProxyTest, HasCorrectInterfaceName) {
- std::string actualName = proxy_->getInterfaceName();
+ std::string actualName = proxy_->getDBusAddress().getInterface();
EXPECT_EQ(interfaceName, actualName);
}
@@ -179,8 +169,8 @@ TEST_F(ProxyTest, IsConnected) {
TEST_F(ProxyTest, AssociatedConnectionHasServiceRegistry) {
std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> connection = proxy_->getDBusConnection();
- auto registry = connection->getDBusServiceRegistry();
- ASSERT_FALSE(!registry);
+ //auto registry = connection->getDBusServiceRegistry();
+ //ASSERT_FALSE(!registry);
}
TEST_F(ProxyTest, DBusProxyStatusEventBeforeServiceIsRegistered) {
@@ -229,7 +219,7 @@ 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(
@@ -242,24 +232,23 @@ TEST_F(ProxyTest, ServiceStatus) {
}
auto found = std::find(availableDBusServices.begin(), availableDBusServices.end(), commonApiAddress);
-
- EXPECT_TRUE(availableDBusServices.begin() != availableDBusServices.end());
- EXPECT_TRUE(found != availableDBusServices.end());
-
- deregisterTestStub();
+ */
+ //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);
+ //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);
- }
+ //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);
+ //EXPECT_TRUE(isInstanceAlive);
deregisterTestStub();
}
@@ -291,14 +280,14 @@ TEST_F(ProxyTest, TestInterfaceVersionAttribute) {
}
TEST_F(ProxyTest, AsyncCallbacksAreCalledIfServiceNotAvailable) {
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testInputStruct;
- commonapi::tests::DerivedTypeCollection::TestMap testInputMap;
+ ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testInputStruct;
+ ::commonapi::tests::DerivedTypeCollection::TestMap testInputMap;
std::promise<bool> wasCalledPromise;
std::future<bool> wasCalledFuture = wasCalledPromise.get_future();
proxy_->testDerivedTypeMethodAsync(testInputStruct, testInputMap, [&] (
const CommonAPI::CallStatus& callStatus,
- const commonapi::tests::DerivedTypeCollection::TestEnumExtended2&,
- const commonapi::tests::DerivedTypeCollection::TestMap&) {
+ const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2&,
+ const ::commonapi::tests::DerivedTypeCollection::TestMap&) {
ASSERT_EQ(callStatus, CommonAPI::CallStatus::NOT_AVAILABLE);
wasCalledPromise.set_value(true);
}
@@ -310,7 +299,7 @@ TEST_F(ProxyTest, AsyncCallbacksAreCalledIfServiceNotAvailable) {
TEST_F(ProxyTest, CallMethodFromExtendedInterface) {
registerExtendedStub();
- auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::ExtendedInterfaceProxy>(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) {
@@ -336,13 +325,13 @@ TEST_F(ProxyTest, CallMethodFromExtendedInterface) {
TEST_F(ProxyTest, CallMethodFromParentInterface) {
registerExtendedStub();
- auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::ExtendedInterfaceProxy>(commonApiAddressExtended);
+ auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
usleep(20 * 1000);
}
EXPECT_TRUE(extendedProxy->isAvailable());
-
+
bool wasCalled = false;
extendedProxy->testEmptyMethodAsync(
[&](const CommonAPI::CallStatus& callStatus) {
@@ -351,7 +340,7 @@ TEST_F(ProxyTest, CallMethodFromParentInterface) {
});
usleep(100000);
EXPECT_TRUE(wasCalled);
-
+
deregisterExtendedStub();
}
@@ -387,10 +376,7 @@ TEST_F(ProxyTest, CanHandleRemoteAttribute) {
TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
registerExtendedStub();
- std::shared_ptr<CommonAPI::DBus::DBusFactory> proxyFactory_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime_->createFactory());
-
- auto extendedProxy = proxyFactory_->buildProxy<commonapi::tests::ExtendedInterfaceProxy>(commonApiAddressExtended);
-
+ auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
usleep(20 * 1000);
@@ -400,8 +386,8 @@ TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
uint32_t value;
- //usleep(200000000);
-
+ usleep(200000000);
+
auto& testAttribute = extendedProxy->getTestPredefinedTypeAttributeAttribute();
testAttribute.getValue(callStatus, value);
@@ -414,7 +400,7 @@ TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
EXPECT_EQ(value, responseValue);
-
+
usleep(50000);
deregisterExtendedStub();
}
@@ -422,7 +408,7 @@ TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
TEST_F(ProxyTest, ProxyCanFetchVersionAttributeFromInheritedInterfaceStub) {
registerExtendedStub();
- auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(commonApiAddressExtended);
+ auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, commonApiAddressExtended);
for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
usleep(20 * 1000);
@@ -453,8 +439,7 @@ TEST_F(ProxyTest, ProxyCanFetchVersionAttributeFromInheritedInterfaceStub) {
class ProxyTest2: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load());
- serviceFactory_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime_->createFactory());
+ runtime_ = CommonAPI::Runtime::get();
}
virtual void TearDown() {
@@ -462,17 +447,16 @@ protected:
}
void registerTestStub(const std::string commonApiAddress) {
- stubDefault_ = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- bool isTestStubAdapterRegistered_ = runtime_->getServicePublisher()->registerService<
- commonapi::tests::TestInterfaceStub>(stubDefault_, commonApiAddress, serviceFactory_);
+ stubDefault_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ bool isTestStubAdapterRegistered_ = runtime_->registerService<
+ VERSION::commonapi::tests::TestInterfaceStub>(domain, commonApiAddress, stubDefault_);
ASSERT_TRUE(isTestStubAdapterRegistered_);
usleep(100000);
}
void deregisterTestStub(const std::string commonApiAddress) {
- const bool isStubAdapterUnregistered = CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(
- commonApiAddress);
+ const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
ASSERT_TRUE(isStubAdapterUnregistered);
stubDefault_.reset();
isTestStubAdapterRegistered_ = false;
@@ -503,31 +487,24 @@ protected:
}
bool isTestStubAdapterRegistered_;
- std::shared_ptr<CommonAPI::DBus::DBusRuntime> runtime_;
- std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<commonapi::tests::TestInterfaceDBusProxy> proxy_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
CommonAPI::ProxyStatusEvent::Subscription proxyStatusSubscription_;
- std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stubDefault_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
};
TEST_F(ProxyTest2, DBusProxyStatusEventAfterServiceIsRegistered) {
registerTestStub(commonApiAddress);
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus();
+ proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
- proxy_ = std::make_shared<commonapi::tests::TestInterfaceDBusProxy>(
- serviceFactory_,
- commonApiAddress,
- interfaceName,
- busName,
- objectPath,
- proxyDBusConnection_);
+ proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
proxy_->init();
proxyRegisterForAvailabilityStatus();
@@ -545,8 +522,8 @@ TEST_F(ProxyTest2, DBusProxyStatusEventAfterServiceIsRegistered) {
TEST_F(ProxyTest2, DBusProxyCanUseOrgFreedesktopAddress) {
registerTestStub(commonApiAddressFreedesktop);
- std::shared_ptr<commonapi::tests::TestInterfaceProxyDefault> proxy =
- serviceFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(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())
@@ -572,7 +549,7 @@ TEST_F(ProxyTest2, DBusProxyCanUseOrgFreedesktopAddress) {
deregisterTestStub(commonApiAddressFreedesktop);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusRuntimeTest.cpp b/src/test/DBusRuntimeTest.cpp
index f2ea9b7..bcc99a6 100644
--- a/src/test/DBusRuntimeTest.cpp
+++ b/src/test/DBusRuntimeTest.cpp
@@ -1,16 +1,15 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#include <gtest/gtest.h>
#include <cstring>
-#include <CommonAPI/DBus/DBusRuntime.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#include <CommonAPI/CommonAPI.hpp>
+
+//#include <CommonAPI/DBus/DBusFactory.hpp>
class DBusRuntimeTest: public ::testing::Test {
protected:
@@ -23,49 +22,43 @@ class DBusRuntimeTest: public ::testing::Test {
TEST_F(DBusRuntimeTest, LoadsDefaultStaticallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
- ASSERT_TRUE(dbusRuntime != NULL);
}
-TEST_F(DBusRuntimeTest, LoadsSpecifiedStaticallyLinkedDBusLibrary) {
+/*TEST_F(DBusRuntimeTest, LoadsSpecifiedStaticallyLinkedDBusLibrary) {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
ASSERT_TRUE((bool)runtime);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
- ASSERT_TRUE(dbusRuntime != NULL);
-}
+}*/
-TEST_F(DBusRuntimeTest, LoadsDBusLibraryAsSingleton) {
-#ifdef WIN32
+/*TEST_F(DBusRuntimeTest, LoadsDBusLibraryAsSingleton) {
+#ifdef WIN32*/
/*
access the middlewareInfo in order to get a call to DBusRuntime. This forces the windows linker not to remove DBusRuntime from resulting binary
*/
- ASSERT_TRUE(CommonAPI::DBus::DBusRuntime::middlewareInfo_.middlewareName_);
+/* ASSERT_TRUE(CommonAPI::DBus::DBusRuntime::middlewareInfo_.middlewareName_);
#endif
- std::shared_ptr<CommonAPI::Runtime> runtime1 = CommonAPI::Runtime::load("DBus");
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::load("DBus");
+ std::shared_ptr<CommonAPI::Runtime> runtime1 = CommonAPI::Runtime::get();
+ std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime1);
ASSERT_TRUE((bool)runtime2);
- CommonAPI::DBus::DBusRuntime* dbusRuntime1 = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime1));
- CommonAPI::DBus::DBusRuntime* dbusRuntime2 = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime2));
ASSERT_TRUE(dbusRuntime1 != NULL);
ASSERT_TRUE(dbusRuntime2 != NULL);
ASSERT_TRUE(dbusRuntime1 == dbusRuntime2);
-}
+}*/
-TEST_F(DBusRuntimeTest, ReturnsEmptyPointerOnRequestForUnknownMiddleware) {
+/*TEST_F(DBusRuntimeTest, ReturnsEmptyPointerOnRequestForUnknownMiddleware) {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("UnknownMiddlewareId");
ASSERT_FALSE((bool)runtime);
-}
+}*/
-TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusFactory) {
+/*TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusFactory) {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
ASSERT_TRUE((bool)runtime);
CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
@@ -75,10 +68,10 @@ TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusFactory) {
ASSERT_TRUE((bool)proxyFactory);
CommonAPI::DBus::DBusFactory* dbusProxyFactory = dynamic_cast<CommonAPI::DBus::DBusFactory*>(&(*proxyFactory));
ASSERT_TRUE(dbusProxyFactory != NULL);
-}
+}*/
-TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusServicePublisher) {
+/*TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusServicePublisher) {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
ASSERT_TRUE((bool)runtime);
CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
@@ -88,9 +81,9 @@ TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusServicePublisher) {
ASSERT_TRUE((bool)servicePublisher);
CommonAPI::DBus::DBusServicePublisher* dbusServicePublisher = dynamic_cast<CommonAPI::DBus::DBusServicePublisher*>(&(*servicePublisher));
ASSERT_TRUE(dbusServicePublisher != NULL);
-}
+}*/
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusSerializableStructTest.cpp b/src/test/DBusSerializableStructTest.cpp
deleted file mode 100644
index e306319..0000000
--- a/src/test/DBusSerializableStructTest.cpp
+++ /dev/null
@@ -1,79 +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 <iostream>
-
-#include <common-api-dbus/dbus-message.h>
-
-#include "TestDBusSerializableStruct.h"
-
-
-#define COMMON_API_TEST_TEST_STRUCT_SIGNATURE "(ud)"
-#define COMMON_API_TEST_TEST_STRUCT_ARRAY_SIGNATURE "a" COMMON_API_TEST_TEST_STRUCT_SIGNATURE
-
-#define COMMON_API_TEST_TEST_STRUCT_EXTENDED_SIGNATURE "(uds)"
-#define COMMON_API_TEST_TEST_STRUCT_EXTENDED_ARRAY_SIGNATURE "a" COMMON_API_TEST_TEST_STRUCT_EXTENDED_SIGNATURE
-
-
-namespace common {
-namespace api {
-namespace test {
-
-
-TestStruct::TestStruct(const uint32_t& fromIntValue, const double& fromDoubleValue):
- intValue(fromIntValue),
- doubleValue(fromDoubleValue) {
-}
-
-common::api::dbus::DBusInputMessageStream& TestStruct::readFromDBusInputMessageStream(
- common::api::dbus::DBusInputMessageStream& inputMessageStream) {
- return inputMessageStream >> intValue
- >> doubleValue;
-}
-
-common::api::dbus::DBusOutputMessageStream& TestStruct::writeToDBusOutputMessageStream(
- common::api::dbus::DBusOutputMessageStream& outputMessageStream) const {
- return outputMessageStream << intValue
- << doubleValue;
-}
-
-
-TestStructExtended::TestStructExtended(const uint32_t& fromIntValue, const double& fromDoubleValue, const std::string& fromStringValue):
- TestStruct(fromIntValue, fromDoubleValue),
- stringValue(fromStringValue) {
-}
-
-common::api::dbus::DBusInputMessageStream& TestStructExtended::readFromDBusInputMessageStream(
- common::api::dbus::DBusInputMessageStream& inputMessageStream) {
- return TestStruct::readFromDBusInputMessageStream(inputMessageStream) >> stringValue;
-}
-
-common::api::dbus::DBusOutputMessageStream& TestStructExtended::writeToDBusOutputMessageStream(
- common::api::dbus::DBusOutputMessageStream& outputMessageStream) const {
- return TestStruct::writeToDBusOutputMessageStream(outputMessageStream) << stringValue;
-}
-
-} //namespace test
-} //namespace api
-} //namespace common
-
-
-int main(void) {
- using namespace common::api::test;
-
- TestStructExtended testStructExtended(123, 456.789, "TestStructExtended");
-
- common::api::dbus::DBusMessage message = common::api::dbus::DBusMessage::createMethodCall(
- "com.bmw.test.TestStruct",
- "/com/bmw/test/TestStruct",
- "com.bmw.test.TestStruct",
- "SingleTestStruct",
- COMMON_API_TEST_TEST_STRUCT_EXTENDED_SIGNATURE);
-
- common::api::dbus::DBusOutputMessageStream outStream(message);
- outStream << testStructExtended;
- outStream.flush();
-}
diff --git a/src/test/DBusSerializableStructTest.h b/src/test/DBusSerializableStructTest.h
deleted file mode 100644
index fc6d304..0000000
--- a/src/test/DBusSerializableStructTest.h
+++ /dev/null
@@ -1,68 +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 DEMO_POSITIONING_H_
-#define DEMO_POSITIONING_H_
-
-
-#include <common-api-dbus/dbus-serializable-struct.h>
-#include <vector>
-
-
-namespace common {
-namespace api {
-namespace test {
-
-
-struct TestStruct: public common::api::dbus::SerializableStruct {
- TestStruct() = default;
- TestStruct(const uint32_t& fromIntValue, const double& fromDoubleValue);
-
- virtual common::api::dbus::DBusInputMessageStream& readFromDBusInputMessageStream(
- common::api::dbus::DBusInputMessageStream& inputMessageStream);
-
- virtual common::api::dbus::DBusOutputMessageStream& writeToDBusOutputMessageStream(
- common::api::dbus::DBusOutputMessageStream& outputMessageStream) const;
-
- uint32_t intValue;
- double doubleValue;
-};
-
-
-struct TestStructExtended: public TestStruct {
- TestStructExtended() = default;
-
- TestStructExtended(const uint32_t& fromIntValue, const double& fromDoubleValue, const std::string& fromStringValue);
-
- virtual common::api::dbus::DBusInputMessageStream& readFromDBusInputMessageStream(
- common::api::dbus::DBusInputMessageStream& inputMessageStream);
-
- virtual common::api::dbus::DBusOutputMessageStream& writeToDBusOutputMessageStream(
- common::api::dbus::DBusOutputMessageStream& outputMessageStream) const;
-
- std::string stringValue;
-};
-
-
-typedef std::vector<TestStruct> TestStructArray;
-typedef std::vector<TestStructExtended> TestStructExtendedArray;
-
-
-} //namespace test
-
-namespace dbus {
-
-template<>
-struct Alignment<common::api::test::TestStruct>: SizeConstant<8> { };
-
-template<>
-struct Alignment<common::api::test::TestStructExtended>: SizeConstant<8> { };
-
-} //namespace dbus
-} //namespace api
-} //namespace common
-
-#endif /* DEMO_POSITIONING_H_ */
diff --git a/src/test/DBusServicePublisherTest.cpp b/src/test/DBusServicePublisherTest.cpp
index b265e71..c35fcf4 100644
--- a/src/test/DBusServicePublisherTest.cpp
+++ b/src/test/DBusServicePublisherTest.cpp
@@ -1,9 +1,7 @@
-/* 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/. */
+// 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>
@@ -18,30 +16,29 @@
#include <tuple>
#include <type_traits>
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
+#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
+#endif
-#include <CommonAPI/AttributeExtension.h>
-#include <CommonAPI/types.h>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
+#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 "commonapi/tests/PredefinedTypeCollection.h"
-#include "commonapi/tests/DerivedTypeCollection.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "commonapi/tests/TestInterfaceStubDefault.h"
-#include "commonapi/tests/TestInterfaceDBusStubAdapter.h"
-
-#include "commonapi/tests/TestInterfaceDBusProxy.h"
+#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
+#define VERSION v1_0
class DBusServicePublisherTest: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
+ runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime_);
}
@@ -52,66 +49,57 @@ class DBusServicePublisherTest: public ::testing::Test {
std::shared_ptr<CommonAPI::Runtime> runtime_;
};
+/** TODO: CHECK IF STILL USEFUL **/
+/*
TEST_F(DBusServicePublisherTest, HandlesManagementOfServices) {
- std::shared_ptr<CommonAPI::Factory> serviceFactory = runtime_->createFactory();
- ASSERT_TRUE((bool)serviceFactory);
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime_->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher);
-
+ 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 = servicePublisher->registerService(myStub, serviceAddress, serviceFactory);
+ bool success = runtime_->registerService(domain, serviceAddress, myStub);
EXPECT_TRUE(success);
auto myStub2 = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- success = servicePublisher->registerService(myStub2, serviceAddress2, serviceFactory);
+ success = runtime_->registerService(domain, serviceAddress2, myStub2);
EXPECT_TRUE(success);
- std::shared_ptr<CommonAPI::Factory> clientFactory = runtime_->createFactory();
-
usleep(10000);
- bool instanceIsAvailable = clientFactory->isServiceInstanceAlive(serviceAddress);
+ bool instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress);
EXPECT_TRUE(instanceIsAvailable);
- instanceIsAvailable = clientFactory->isServiceInstanceAlive(serviceAddress2);
+ instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress2);
EXPECT_TRUE(instanceIsAvailable);
- success = servicePublisher->unregisterService("SomeOther:Unknown:Service");
+ success = runtime_->unregisterService("SomeOther:Unknown:Service");
EXPECT_FALSE(success);
- success = servicePublisher->unregisterService(serviceAddress);
+ success = runtime_->unregisterService(serviceAddress);
EXPECT_TRUE(success);
- success = servicePublisher->unregisterService(serviceAddress2);
+ success = runtime_->unregisterService(serviceAddress2);
EXPECT_TRUE(success);
usleep(10000);
- instanceIsAvailable = clientFactory->isServiceInstanceAlive(serviceAddress);
+ instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress);
EXPECT_FALSE(instanceIsAvailable);
- instanceIsAvailable = clientFactory->isServiceInstanceAlive(serviceAddress2);
+ instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress2);
EXPECT_FALSE(instanceIsAvailable);
}
-
+*/
TEST_F(DBusServicePublisherTest, GracefullyHandlesWrongAddresses) {
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime_->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher);
-
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- EXPECT_FALSE(servicePublisher->registerService(myStub, "", proxyFactory));
- EXPECT_FALSE(servicePublisher->registerService(myStub, "too:much:stuff:here", proxyFactory));
+ EXPECT_FALSE(runtime_->registerService("local", "", myStub, "connection"));
+ EXPECT_FALSE(runtime_->registerService("local", "too:much:stuff:here", myStub, "connection"));
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/test/DBusServiceRegistryTest.cpp b/src/test/DBusServiceRegistryTest.cpp
index bad8181..53620bd 100644
--- a/src/test/DBusServiceRegistryTest.cpp
+++ b/src/test/DBusServiceRegistryTest.cpp
@@ -1,38 +1,38 @@
-/* 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/. */
+// 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.h>
+#include <CommonAPI/CommonAPI.hpp>
#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusServiceRegistry.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
-#include <CommonAPI/DBus/DBusConnection.h>
-#include <CommonAPI/DBus/DBusUtils.h>
-#include <CommonAPI/DBus/DBusRuntime.h>
+#include <CommonAPI/Utils.hpp>
+
+#include <CommonAPI/DBus/DBusServiceRegistry.hpp>
+#include <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusUtils.hpp>
-#include <commonapi/tests/TestInterfaceStub.h>
-#include <commonapi/tests/TestInterfaceStubDefault.h>
-#include <commonapi/tests/TestInterfaceDBusStubAdapter.h>
+#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.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";
@@ -52,7 +52,7 @@ public:
virtual void SetUp() {
configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
- configFileName_ += CommonAPI::DBus::DBUS_CONFIG_SUFFIX;
+ configFileName_ += DBUS_CONFIG_SUFFIX;
std::ofstream configFile(configFileName_);
ASSERT_TRUE(configFile.is_open());
@@ -92,8 +92,7 @@ struct TestDBusServiceListener {
const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection):
availabilityStatusCount(0),
isSubscribed(false),
- commonApiAddress_(commonApiAddress),
- dbusServiceRegistry_(dbusConnection->getDBusServiceRegistry()) {
+ commonApiAddress_(commonApiAddress) {
}
~TestDBusServiceListener() {
@@ -140,17 +139,12 @@ struct TestDBusServiceListener {
class DBusServiceRegistryTestDBusStubAdapter: public CommonAPI::DBus::DBusStubAdapter {
public:
- DBusServiceRegistryTestDBusStubAdapter(const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
+ 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(factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
+ DBusStubAdapter(CommonAPI::DBus::DBusAddress(dbusBusName, dbusObjectPath, dbusInterfaceName),
dbusConnection,
false),
introspectionCount(0) {
@@ -179,10 +173,7 @@ class DBusServiceRegistryTest: public ::testing::Test {
protected:
virtual void SetUp() {
- auto runtime = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load());
-
- clientFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime->createFactory());
- serviceFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime->createFactory());
+ auto runtime = CommonAPI::Runtime::get();
clientDBusConnection = clientFactory->getDbusConnection();
clientConnectionRegistry = clientDBusConnection->getDBusServiceRegistry();
@@ -210,9 +201,6 @@ class DBusServiceRegistryTest: public ::testing::Test {
return waitResult;
}
- std::shared_ptr<CommonAPI::DBus::DBusFactory> clientFactory;
- std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory;
-
std::shared_ptr<CommonAPI::DBus::DBusConnection> clientDBusConnection;
std::shared_ptr<CommonAPI::DBus::DBusConnection> serviceDBusConnection;
@@ -243,13 +231,12 @@ TEST_F(DBusServiceRegistryTest, SubscribeBeforeConnectWorks) {
ASSERT_TRUE(serviceDBusConnection->connect());
ASSERT_TRUE(serviceDBusConnection->requestServiceNameAndBlock(dbusServiceName));
auto testDBusStubAdapter = std::make_shared<DBusServiceRegistryTestDBusStubAdapter>(
- serviceFactory,
"local:Interface1:predefined.Instance1",
"tests.Interface1",
dbusServiceName,
"/tests/predefined/Object1",
serviceDBusConnection);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(testDBusStubAdapter);
+ CommonAPI::Runtime::get()->registerService("local", "predefined.Instance1", testDBusStubAdapter);
EXPECT_TRUE(waitForAvailabilityStatusChanged(
testDBusServiceListener,
@@ -258,24 +245,23 @@ TEST_F(DBusServiceRegistryTest, SubscribeBeforeConnectWorks) {
EXPECT_LE(testDBusServiceListener.availabilityStatusCount, 3);
EXPECT_EQ(testDBusStubAdapter->introspectionCount, 1);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
+ //CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
- EXPECT_TRUE(waitForAvailabilityStatusChanged(
- testDBusServiceListener,
- CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
- EXPECT_LE(testDBusServiceListener.availabilityStatusCount, 4);
+ //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>(
- serviceFactory,
"local:Interface1:predefined.Instance1",
"tests.Interface1",
dbusServiceName,
"/tests/predefined/Object1",
serviceDBusConnection);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(testDBusStubAdapter);
+ CommonAPI::Runtime::get()->registerService("local", "predefined.Instance1", testDBusStubAdapter);
TestDBusServiceListener testDBusServiceListener("local:Interface1:predefined.Instance1", clientDBusConnection);
testDBusServiceListener.subscribe();
@@ -295,19 +281,18 @@ TEST_F(DBusServiceRegistryTest, SubscribeBeforeConnectWithServiceWorks) {
usleep(300 * 1000);
EXPECT_EQ(testDBusServiceListener.availabilityStatusCount, 2);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
+ //CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
}
TEST_F(DBusServiceRegistryTest, SubscribeAfterConnectWithServiceWorks) {
ASSERT_TRUE(serviceDBusConnection->connect());
auto testDBusStubAdapter = std::make_shared<DBusServiceRegistryTestDBusStubAdapter>(
- serviceFactory,
"local:Interface1:predefined.Instance1",
"tests.Interface1",
dbusServiceName,
"/tests/predefined/Object1",
serviceDBusConnection);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(testDBusStubAdapter);
+ CommonAPI::Runtime::get()->registerService("local", "predefined.Interface1", testDBusStubAdapter);
ASSERT_TRUE(clientDBusConnection->connect());
TestDBusServiceListener testDBusServiceListener("local:Interface1:predefined.Instance1", clientDBusConnection);
@@ -321,7 +306,7 @@ TEST_F(DBusServiceRegistryTest, SubscribeAfterConnectWithServiceWorks) {
EXPECT_EQ(testDBusServiceListener.availabilityStatusCount, 1);
EXPECT_EQ(testDBusStubAdapter->introspectionCount, 1);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
+ //CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
EXPECT_TRUE(waitForAvailabilityStatusChanged(
testDBusServiceListener,
@@ -331,7 +316,7 @@ TEST_F(DBusServiceRegistryTest, SubscribeAfterConnectWithServiceWorks) {
}
TEST_F(DBusServiceRegistryTest, DBusAddressTranslatorPredefinedWorks) {
- std::vector<CommonAPI::DBus::DBusServiceAddress> loadedPredefinedInstances;
+ std::vector<CommonAPI::DBus::DBusAddress> loadedPredefinedInstances;
CommonAPI::DBus::DBusAddressTranslator::getInstance().getPredefinedInstances(dbusServiceName, loadedPredefinedInstances);
@@ -491,7 +476,7 @@ TEST_F(DBusServiceRegistryTest, DISABLED_PredefinedInstances) {
// }
}
-
+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";
@@ -503,37 +488,21 @@ const char nonexistingServiceName_[] = "nonexisting.service.name";
class DBusServiceDiscoveryTestWithPredefinedRemote: public ::testing::Test {
protected:
virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
- auto serviceFactory = runtime_->createFactory();
- servicePublisher_ = runtime_->getServicePublisher();
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- servicePublisher_->registerService(stub, serviceAddress_, serviceFactory);
- clientFactory_ = runtime_->createFactory();
+ 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() {
- servicePublisher_->unregisterService(serviceAddress_);
+ //runtime_->unregisterService(serviceAddress_);
usleep(500 * 1000);
}
- std::shared_ptr<CommonAPI::Factory> clientFactory_;
-
private:
std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
};
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, RecognizesInstanceOfExistingServiceAsAlive) {
- bool result = clientFactory_->isServiceInstanceAlive(serviceAddress_);
- EXPECT_TRUE(result);
-}
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, RecognizesInstanceOfNonexistingServiceAsDead) {
- bool result = clientFactory_->isServiceInstanceAlive(nonexistingServiceAddress_);
- EXPECT_FALSE(result);
-}
-
TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, RecognizesInstanceOfExistingServiceAsAliveAsync) {
//Wait for synchronous availability of the service, then verify the async version gets the same result
@@ -661,7 +630,7 @@ TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, DISABLED_ServiceRegistryUse
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
::testing::AddGlobalTestEnvironment(new Environment());
diff --git a/src/test/DBusStubAdapterTest.cpp b/src/test/DBusStubAdapterTest.cpp
index 45cabe1..85216d0 100644
--- a/src/test/DBusStubAdapterTest.cpp
+++ b/src/test/DBusStubAdapterTest.cpp
@@ -1,11 +1,11 @@
-/* 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 <CommonAPI/DBus/DBusFunctionalHash.h>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
+// 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 <CommonAPI/DBus/DBusConnection.hpp>
+#include <CommonAPI/DBus/DBusFunctionalHash.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
#include <cassert>
#include <iostream>
@@ -104,12 +104,10 @@ class TestDBusStubAdapter: public TestStubAdapter, public TestStubAdapterHelper
const std::shared_ptr<CommonAPI::DBus::DBusConnection>& dbusConnection,
const std::shared_ptr<TestStub>& testStub) :
TestStubAdapterHelper(
- commonApiAddress,
- dbusBusName,
- dbusObjectPath,
- "org.genivi.CommonAPI.DBus.TestInterface",
+ CommonAPI::DBus::DBusAddress(dbusBusName, dbusObjectPath, "org.genivi.CommonAPI.DBus.TestInterface"),
dbusConnection,
- testStub) {
+ testStub,
+ false) {
}
virtual void fireTestAttributeChanged(const int32_t& testValue) {
@@ -186,7 +184,7 @@ const TestStubAdapterHelper::StubDispatcherTable TestStubAdapterHelper::stubDisp
};
int main(void) {
- auto dbusConnection = CommonAPI::DBus::DBusConnection::getSessionBus();
+ auto dbusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
if (!dbusConnection->isConnected())
dbusConnection->connect();
@@ -204,13 +202,9 @@ int main(void) {
"/common/api/dbus/TestDBusInterfaceAdapter",
dbusConnection,
testStub);
- testStubAdapter->init();
+ testStubAdapter->init(testStubAdapter);
- auto dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- "org.genivi.CommonAPI.DBus.TestDBusInterfaceAdapter",
- testStubAdapter->getObjectPath().c_str(),
- testStubAdapter->getServiceId().c_str(),
- "GetEmptyResponse");
+ 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");
const bool messageSent = dbusConnection->sendDBusMessage(dbusMessageCall);
assert(messageSent);
diff --git a/src/test/DBusTestUtils.h b/src/test/DBusTestUtils.hpp
index 0ed4938..5761ff3 100644
--- a/src/test/DBusTestUtils.h
+++ b/src/test/DBusTestUtils.hpp
@@ -1,16 +1,18 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef __DBUS_TEST_UTILS__
#define __DBUS_TEST_UTILS__
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
#include <dbus/dbus.h>
-#include <CommonAPI/DBus/DBusServiceRegistry.h>
-#include <CommonAPI/DBus/DBusMessage.h>
+#include <CommonAPI/DBus/DBusServiceRegistry.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
inline char eliminateZeroes(char val) {
return !val ? '0' : val;
diff --git a/src/test/DBusTypeStreamTest.cpp b/src/test/DBusTypeStreamTest.cpp
index 52dee1b..b7e5592 100644
--- a/src/test/DBusTypeStreamTest.cpp
+++ b/src/test/DBusTypeStreamTest.cpp
@@ -1,38 +1,40 @@
-/* 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/. */
+// 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/SerializableStruct.h>
-#include <CommonAPI/SerializableVariant.h>
-#include <CommonAPI/types.h>
-#include <CommonAPI/ByteBuffer.h>
+#include <CommonAPI/Struct.hpp>
+#include <CommonAPI/Variant.hpp>
+#include <CommonAPI/Types.hpp>
+#include <CommonAPI/ByteBuffer.hpp>
-#include <CommonAPI/DBus/DBusOutputStream.h>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
-#include "commonapi/tests/DerivedTypeCollection.h"
+#include "commonapi/tests/DerivedTypeCollection.hpp"
#include <type_traits>
-struct TestStructWithVariant: public CommonAPI::SerializableStruct {
+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& inputStream) {
+ virtual void readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputStream) {
}
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
+ virtual void writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputStream) const {
}
- static void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
+ 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);
@@ -45,7 +47,7 @@ struct TestStructWithVariant: public CommonAPI::SerializableStruct {
};
-typedef std::vector<commonapi::tests::DerivedTypeCollection::TestEnum> TestEnumList;
+typedef std::vector<::commonapi::tests::DerivedTypeCollection::TestEnum> TestEnumList;
class TypeOutputStreamTest: public ::testing::Test {
@@ -140,7 +142,7 @@ TEST_F(TypeOutputStreamTest, CreatesVersionSignature) {
}
TEST_F(TypeOutputStreamTest, CreatesInt32EnumSignature) {
- CommonAPI::TypeWriter<commonapi::tests::DerivedTypeCollection::TestEnum>::writeType(typeStream_);
+ CommonAPI::TypeWriter<::commonapi::tests::DerivedTypeCollection::TestEnum>::writeType(typeStream_);
std::string signature = typeStream_.retrieveSignature();
ASSERT_TRUE(signature.compare("i") == 0);
}
@@ -268,8 +270,8 @@ TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericUInt32TypeVariantsCorrectly
}
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::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_);
@@ -325,9 +327,9 @@ TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericTestStructTypeVariantsCorre
ASSERT_TRUE(signature.compare("(qs(yv))") == 0);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/test/DBusVariantOutputStreamTest.cpp b/src/test/DBusVariantOutputStreamTest.cpp
index f8534e3..46267f8 100644
--- a/src/test/DBusVariantOutputStreamTest.cpp
+++ b/src/test/DBusVariantOutputStreamTest.cpp
@@ -1,14 +1,17 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <gtest/gtest.h>
-#include <CommonAPI/DBus/DBusOutputStream.h>
-#include <CommonAPI/DBus/DBusInputStream.h>
-#include <CommonAPI/SerializableVariant.h>
+
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
using namespace CommonAPI;
@@ -38,69 +41,56 @@ class VariantOutputStreamTest: public ::testing::Test {
typedef Variant<int,bool> InnerVar;
-struct MyStruct: CommonAPI::SerializableStruct {
+struct MyStruct: CommonAPI::Struct<uint32_t, InnerVar, bool, std::string, double> {
~MyStruct();
- uint32_t a;
- InnerVar b;
- bool c;
- std::string d;
- double e;
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputMessageStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputMessageStream) const;
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- typeOutputStream.writeUInt32Type();
- typeOutputStream.writeVariantType();
- typeOutputStream.writeBoolType();
- typeOutputStream.writeStringType();
- typeOutputStream.writeDoubleType();
- }
+ 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() {
}
-void MyStruct::readFromInputStream(CommonAPI::InputStream& inputMessageStream) {
- inputMessageStream >> a >> b >> c >> d >> e;
-}
-
-void MyStruct::writeToOutputStream(CommonAPI::OutputStream& outputMessageStream) const {
- outputMessageStream << a << b << c << d << e;
-}
-
bool operator==(const MyStruct& lhs, const MyStruct& rhs) {
if (&lhs == &rhs)
return true;
- return
- lhs.a == rhs.a &&
- lhs.b == rhs.b &&
- lhs.c == rhs.c &&
- lhs.d == rhs.d &&
- lhs.e == rhs.e
+ 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_));
;
}
TEST_F(VariantOutputStreamTest, CanBeCalled) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(busName, objectPath, interfaceName, methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
}
TEST_F(VariantOutputStreamTest, CanWriteVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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 << inVariant;
+ outputStream.writeValue(inVariant, static_cast<CommonAPI::DBus::VariantDeployment<int, bool>*>(nullptr));
outputStream.flush();
DBus::DBusInputStream inputStream(message);
- inputStream >> outVariant;
+ inputStream.readValue(outVariant, static_cast<CommonAPI::DBus::VariantDeployment<int, bool>*>(nullptr));
EXPECT_TRUE(outVariant.isType<int>());
EXPECT_EQ(inVariant.get<int>(), outVariant.get<int>());
@@ -108,7 +98,7 @@ TEST_F(VariantOutputStreamTest, CanWriteVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
@@ -118,12 +108,12 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInVariant) {
Variant<InnerVar, std::string, float> outVariant;
- outputStream << inVariant;
+ outputStream.writeValue(inVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::DBus::VariantDeployment<EmptyDeployment, EmptyDeployment>, EmptyDeployment, EmptyDeployment>*>(nullptr));
outputStream.flush();
DBus::DBusInputStream inputStream(message);
-
- inputStream >> outVariant;
+
+ 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>());
@@ -131,14 +121,14 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInStruct) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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> nestedVariant(fromInt);
MyStruct inStruct;
- inStruct.b = nestedVariant;
+ inStruct.setB(nestedVariant);
MyStruct outStruct;
@@ -149,13 +139,13 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInStruct) {
inputStream >> outStruct;
- EXPECT_TRUE(outStruct.b.isType<int>());
- EXPECT_EQ(outStruct.b.get<int>(), inStruct.b.get<int>());
- EXPECT_TRUE(inStruct.b == outStruct.b);
+ EXPECT_TRUE(outStruct.getB().isType<int>());
+ EXPECT_EQ(outStruct.getB().get<int>(), inStruct.getB().get<int>());
+ EXPECT_TRUE(inStruct.getB() == outStruct.getB());
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInArray) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
@@ -180,7 +170,7 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInArray) {
}
TEST_F(VariantOutputStreamTest, CanWriteArrayInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
@@ -209,14 +199,14 @@ TEST_F(VariantOutputStreamTest, CanWriteArrayInVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteStructInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
MyStruct str;
int fromInt = 14132;
- str.a = fromInt;
+ str.setA(fromInt);
StructVariant inVariant(str);
StructVariant outVariant;
@@ -236,14 +226,14 @@ TEST_F(VariantOutputStreamTest, CanWriteStructInVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInStructInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(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;
MyStruct str;
int fromInt = 14132;
- str.b = InnerVar(fromInt);
+ str.setB(InnerVar(fromInt));
StructVariant inVariant(str);
StructVariant outVariant;
@@ -257,13 +247,13 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInStructInVariant) {
EXPECT_TRUE(outVariant.isType<MyStruct>());
EXPECT_EQ(inVariant.get<MyStruct>(), outVariant.get<MyStruct>());
- EXPECT_TRUE(inVariant.get<MyStruct>().b == outVariant.get<MyStruct>().b);
- EXPECT_TRUE(inVariant.get<MyStruct>().b.get<int>() == outVariant.get<MyStruct>().b.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(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;
@@ -292,7 +282,7 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInArrayInVariant) {
EXPECT_TRUE(inVariant == outVariant);
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/test/DBusVariantTest.cpp b/src/test/DBusVariantTest.cpp
index a05ae03..b2b4b8b 100644
--- a/src/test/DBusVariantTest.cpp
+++ b/src/test/DBusVariantTest.cpp
@@ -1,12 +1,15 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <gtest/gtest.h>
-#include <CommonAPI/SerializableVariant.h>
+
+#ifndef COMMONAPI_INTERNAL_COMPILATION
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/Variant.hpp>
using namespace CommonAPI;
@@ -166,9 +169,9 @@ TEST_F(VariantTest, VariantStringArray) {
delete vectorVariant;
}
-#ifndef WIN32
+#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/test/DemoMainLoop.h b/src/test/DemoMainLoop.hpp
index 0de634f..8bcd741 100644
--- a/src/test/DemoMainLoop.h
+++ b/src/test/DemoMainLoop.hpp
@@ -1,26 +1,22 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef DEMO_MAIN_LOOP_H_
#define DEMO_MAIN_LOOP_H_
-
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/MainLoopContext.h>
-#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <CommonAPI/MainLoopContext.hpp>
#include <vector>
#include <set>
#include <map>
#ifdef WIN32
#include <WinSock2.h>
-#include "DemoPoll.h"
#else
#include <poll.h>
#include <sys/eventfd.h>
@@ -33,11 +29,7 @@
namespace CommonAPI {
-#ifdef WIN32
-typedef ::DemoPollFd DemoMainLoopPollFd;
-#else
typedef pollfd DemoMainLoopPollFd;
-#endif
class MainLoop {
public:
@@ -51,16 +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);
- }
-
- wakeFd_.isWsaEvent = true;
+ if (wsaEvent != WSA_INVALID_EVENT) {
+ wakeFd_.fd = PtrToInt(wsaEvent);
+ }
#else
wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK);
#endif
@@ -91,7 +81,8 @@ class MainLoop {
context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_);
#ifdef WIN32
- WSACloseEvent(IntToPtr(wakeFd_.fd));
+ WSACloseEvent(IntToPtr(wakeFd_.fd));
+
#else
close(wakeFd_.fd);
#endif
@@ -180,8 +171,17 @@ class MainLoop {
(*fileDescriptor).revents = 0;
}
- size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutInterval_);
+#if WIN32
+ INT currentMinimalTimeoutIntervalWin32_ = 1;
+ size_t numReadyFileDescriptors = ::WSAPoll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutIntervalWin32_);
+ if (numReadyFileDescriptors == SOCKET_ERROR) {
+ int iError = WSAGetLastError();
+ //printf("WSAPoll failed with error: %ld\n", iError);
+ }
+#else
+ size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutInterval_);
+#endif
// If no FileDescriptors are ready, poll returned because of a timeout that has expired.
// The only case in which this is not the reason is when the timeout handed in "prepare"
// expired before any other timeouts.
@@ -301,7 +301,6 @@ class MainLoop {
void registerWatch(Watch* watch, const DispatchPriority dispatchPriority) {
#ifdef WIN32
DemoMainLoopPollFd fdToRegister = watch->getAssociatedFileDescriptor();
- fdToRegister.isWsaEvent = false;
#else
DemoMainLoopPollFd fdToRegister = watch->getAssociatedFileDescriptor();
#endif
diff --git a/src/test/README.txt b/src/test/README.txt
new file mode 100644
index 0000000..c318bde
--- /dev/null
+++ b/src/test/README.txt
@@ -0,0 +1,12 @@
+This readme 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.
+
+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
+
+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
+
+
diff --git a/src/test/commonapi-dbus.ini b/src/test/commonapi-dbus.ini
new file mode 100644
index 0000000..ac1c897
--- /dev/null
+++ b/src/test/commonapi-dbus.ini
@@ -0,0 +1,41 @@
+[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
diff --git a/src/test/commonapi/tests/DerivedTypeCollection.cpp b/src/test/commonapi/tests/DerivedTypeCollection.cpp
index 09063a1..edf4c7c 100644
--- a/src/test/commonapi/tests/DerivedTypeCollection.cpp
+++ b/src/test/commonapi/tests/DerivedTypeCollection.cpp
@@ -1,225 +1,70 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.0.1.v201504231326.
+* Used org.franca.core 0.9.1.201412191134.
*
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*/
-#include "DerivedTypeCollection.h"
+#include "DerivedTypeCollection.hpp"
namespace commonapi {
namespace tests {
-namespace DerivedTypeCollection {
-
-TestStructExtended::TestStructExtended(const PredefinedTypeCollection::TestString& testStringValue, const uint16_t& uintValueValue, const TestEnumExtended2& testEnumExtended2Value):
- TestStruct(testStringValue, uintValueValue),
- testEnumExtended2(testEnumExtended2Value)
-{
-}
-
-
-bool operator==(const TestStructExtended& lhs, const TestStructExtended& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return
- static_cast<TestStructExtended::TestStruct>(lhs) == static_cast<TestStructExtended::TestStruct>(rhs) &&
- lhs.testEnumExtended2 == rhs.testEnumExtended2
- ;
-}
-
-void TestStructExtended::readFromInputStream(CommonAPI::InputStream& inputStream) {
- TestStruct::readFromInputStream(inputStream);
- inputStream >> testEnumExtended2;
-}
-
-void TestStructExtended::writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- TestStruct::writeToOutputStream(outputStream);
- outputStream << testEnumExtended2;
-}
-
-
-
-
-
-
-
-
-TestStruct::TestStruct(const PredefinedTypeCollection::TestString& testStringValue, const uint16_t& uintValueValue):
- testString(testStringValue),
- uintValue(uintValueValue)
-{
-}
-
-
-bool operator==(const TestStruct& lhs, const TestStruct& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return
- lhs.testString == rhs.testString &&
- lhs.uintValue == rhs.uintValue
- ;
-}
-
-void TestStruct::readFromInputStream(CommonAPI::InputStream& inputStream) {
- inputStream >> testString;
- inputStream >> uintValue;
-}
-
-void TestStruct::writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- outputStream << testString;
- outputStream << uintValue;
-}
-
-TestPolymorphicStruct::TestPolymorphicStruct(const PredefinedTypeCollection::TestString& testStringValue, const uint16_t& uintValueValue):
- testString(testStringValue),
- uintValue(uintValueValue)
-{
-}
-
-TestPolymorphicStruct* TestPolymorphicStruct::createInstance(const uint32_t& serialId) {
- if (serialId == SERIAL_ID)
- return new TestPolymorphicStruct;
-
- const std::function<TestPolymorphicStruct*()> createDerivedInstanceFuncs[] = {
- [&]() { return TestExtendedPolymorphicStruct::createInstance(serialId); }
- };
-
- for (auto& createDerivedInstanceFunc : createDerivedInstanceFuncs) {
- TestPolymorphicStruct* derivedInstance = createDerivedInstanceFunc();
- if (derivedInstance != NULL)
- return derivedInstance;
- }
-
- return NULL;
-}
-
-uint32_t TestPolymorphicStruct::getSerialId() const {
- return SERIAL_ID;
-}
-
-void TestPolymorphicStruct::createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const {
- TestPolymorphicStruct::writeToTypeOutputStream(typeOutputStream);
-}
-
-bool operator==(const TestPolymorphicStruct& lhs, const TestPolymorphicStruct& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return
- lhs.testString == rhs.testString &&
- lhs.uintValue == rhs.uintValue
- ;
-}
-
-void TestPolymorphicStruct::readFromInputStream(CommonAPI::InputStream& inputStream) {
- inputStream >> testString;
- inputStream >> uintValue;
-}
-
-void TestPolymorphicStruct::writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- outputStream << testString;
- outputStream << uintValue;
-}
-
-TestExtendedPolymorphicStruct::TestExtendedPolymorphicStruct(const PredefinedTypeCollection::TestString& testStringValue, const uint16_t& uintValueValue, const uint32_t& additionalValueValue):
- TestPolymorphicStruct(testStringValue, uintValueValue),
- additionalValue(additionalValueValue)
-{
-}
-
-TestExtendedPolymorphicStruct* TestExtendedPolymorphicStruct::createInstance(const uint32_t& serialId) {
- if (serialId == SERIAL_ID)
- return new TestExtendedPolymorphicStruct;
-
- return NULL;
-}
-
-uint32_t TestExtendedPolymorphicStruct::getSerialId() const {
- return SERIAL_ID;
-}
-
-void TestExtendedPolymorphicStruct::createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const {
- TestExtendedPolymorphicStruct::writeToTypeOutputStream(typeOutputStream);
+bool DerivedTypeCollection::TestStructExtended::operator==(const DerivedTypeCollection::TestStructExtended& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue() && getTestEnumExtended2() == _other.getTestEnumExtended2());
}
-bool operator==(const TestExtendedPolymorphicStruct& lhs, const TestExtendedPolymorphicStruct& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return
- static_cast<TestExtendedPolymorphicStruct::TestPolymorphicStruct>(lhs) == static_cast<TestExtendedPolymorphicStruct::TestPolymorphicStruct>(rhs) &&
- lhs.additionalValue == rhs.additionalValue
- ;
-}
+#ifndef WIN32
+const int32_t DerivedTypeCollection::TestEnum::E_UNKNOWN;
+const int32_t DerivedTypeCollection::TestEnum::E_OK;
+const int32_t DerivedTypeCollection::TestEnum::E_OUT_OF_RANGE;
+const int32_t DerivedTypeCollection::TestEnum::E_NOT_USED;
+const int32_t DerivedTypeCollection::TestEnumExtended2::E_NEW2;
+const int32_t DerivedTypeCollection::TestEnumMissingValue::E1;
+const int32_t DerivedTypeCollection::TestEnumMissingValue::E2;
+const int32_t DerivedTypeCollection::TestEnumMissingValue::E3;
+const int32_t DerivedTypeCollection::TestEnumExtended::E_NEW;
+#endif
-void TestExtendedPolymorphicStruct::readFromInputStream(CommonAPI::InputStream& inputStream) {
- TestPolymorphicStruct::readFromInputStream(inputStream);
- inputStream >> additionalValue;
+bool DerivedTypeCollection::TestStruct::operator==(const DerivedTypeCollection::TestStruct& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue());
}
-void TestExtendedPolymorphicStruct::writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- TestPolymorphicStruct::writeToOutputStream(outputStream);
- outputStream << additionalValue;
+std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct> DerivedTypeCollection::TestPolymorphicStruct::create(CommonAPI::Serial _serial) {
+ switch (_serial) {
+ case DerivedTypeCollection::TESTPOLYMORPHICSTRUCT_SERIAL:
+ return std::make_shared<DerivedTypeCollection::TestPolymorphicStruct>();
+ case DerivedTypeCollection::TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ return std::make_shared<DerivedTypeCollection::TestExtendedPolymorphicStruct>();
+ default:
+ break;
+ }
+ return std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>();
}
-
-StructWithPolymorphicMember::StructWithPolymorphicMember(const uint32_t& numberValueValue, const std::shared_ptr<TestPolymorphicStruct>& polymorphicMemberValue):
- numberValue(numberValueValue),
- polymorphicMember(polymorphicMemberValue)
-{
+bool DerivedTypeCollection::TestPolymorphicStruct::operator==(const DerivedTypeCollection::TestPolymorphicStruct& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue());
}
-bool operator==(const StructWithPolymorphicMember& lhs, const StructWithPolymorphicMember& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return
- lhs.numberValue == rhs.numberValue &&
- lhs.polymorphicMember == rhs.polymorphicMember
- ;
-}
-
-void StructWithPolymorphicMember::readFromInputStream(CommonAPI::InputStream& inputStream) {
- inputStream >> numberValue;
- inputStream >> polymorphicMember;
+bool DerivedTypeCollection::TestExtendedPolymorphicStruct::operator==(const DerivedTypeCollection::TestExtendedPolymorphicStruct& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue() && getAdditionalValue() == _other.getAdditionalValue());
}
-void StructWithPolymorphicMember::writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- outputStream << numberValue;
- outputStream << polymorphicMember;
-}
-StructWithEnumKeyMap::StructWithEnumKeyMap(const TestEnumMap& testMapValue):
- testMap(testMapValue)
-{
+bool DerivedTypeCollection::StructWithPolymorphicMember::operator==(const DerivedTypeCollection::StructWithPolymorphicMember& _other) const {
+ return (getNumberValue() == _other.getNumberValue() && getPolymorphicMember() == _other.getPolymorphicMember());
}
-bool operator==(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return
- lhs.testMap == rhs.testMap
- ;
-}
-
-void StructWithEnumKeyMap::readFromInputStream(CommonAPI::InputStream& inputStream) {
- inputStream >> testMap;
+bool DerivedTypeCollection::StructWithEnumKeyMap::operator==(const DerivedTypeCollection::StructWithEnumKeyMap& _other) const {
+ return (getTestMap() == _other.getTestMap());
}
-void StructWithEnumKeyMap::writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- outputStream << testMap;
-}
-} // namespace DerivedTypeCollection
} // namespace tests
} // namespace commonapi
diff --git a/src/test/commonapi/tests/DerivedTypeCollection.h b/src/test/commonapi/tests/DerivedTypeCollection.h
deleted file mode 100644
index 9e43d78..0000000
--- a/src/test/commonapi/tests/DerivedTypeCollection.h
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Derived_Type_Collection_H_
-#define COMMONAPI_TESTS_Derived_Type_Collection_H_
-
-
-#include <commonapi/tests/PredefinedTypeCollection.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.h>
-#include <CommonAPI/OutputStream.h>
-#include <CommonAPI/SerializableStruct.h>
-#include <CommonAPI/types.h>
-#include <cstdint>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-namespace DerivedTypeCollection {
- struct TestStruct: CommonAPI::SerializableStruct {
- /**
- * the name of the property
- */
- PredefinedTypeCollection::TestString testString;
- /**
- * the actual value
- */
- uint16_t uintValue;
-
- TestStruct() = default;
- TestStruct(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue);
-
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- typeOutputStream.writeStringType();
- typeOutputStream.writeUInt16Type();
- }
- };
- typedef std::vector<TestStruct> TestArrayTestStruct;
- typedef std::unordered_map<uint32_t, TestArrayTestStruct> TestMap;
- /**
- * Common errors.
- */
- enum class TestEnum: int32_t {
- /**
- * default
- */
- E_UNKNOWN = 0x0,
- /**
- * no error - positive reply
- */
- E_OK = 0x1,
- /**
- * value out of range
- */
- E_OUT_OF_RANGE = 0x2,
- /**
- * not used
- */
- E_NOT_USED = 0x3
- };
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct TestEnumComparator;
- enum class TestEnumExtended: int32_t {
- E_UNKNOWN = TestEnum::E_UNKNOWN,
- E_OK = TestEnum::E_OK,
- E_OUT_OF_RANGE = TestEnum::E_OUT_OF_RANGE,
- E_NOT_USED = TestEnum::E_NOT_USED
- ,
- /**
- * new error
- */
- E_NEW = 0x4
- };
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct TestEnumExtendedComparator;
- enum class TestEnumExtended2: int32_t {
- E_UNKNOWN = TestEnum::E_UNKNOWN,
- E_OK = TestEnum::E_OK,
- E_OUT_OF_RANGE = TestEnum::E_OUT_OF_RANGE,
- E_NOT_USED = TestEnum::E_NOT_USED,
-
- E_NEW = TestEnumExtended::E_NEW
- ,
- /**
- * new error
- */
- E_NEW2 = 0x5
- };
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct TestEnumExtended2Comparator;
- struct TestStructExtended: TestStruct {
- TestEnumExtended2 testEnumExtended2;
-
- TestStructExtended() = default;
- TestStructExtended(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue, const TestEnumExtended2& testEnumExtended2);
-
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- TestStruct::writeToTypeOutputStream(typeOutputStream);
- typeOutputStream.writeInt32Type();
- }
- };
- typedef std::unordered_map<TestEnum, std::string, CommonAPI::EnumHasher<TestEnum>> TestEnumMap;
- enum class TestEnumMissingValue: int32_t {
- /**
- * default
- */
- E1 = 0xa,
- E2,
- E3 = 2
- };
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct TestEnumMissingValueComparator;
- typedef std::vector<uint64_t> TestArrayUInt64;
- struct TestPolymorphicStruct: CommonAPI::SerializablePolymorphicStruct {
- /**
- * the name of the property
- */
- PredefinedTypeCollection::TestString testString;
- /**
- * the actual value
- */
- uint16_t uintValue;
-
- TestPolymorphicStruct() = default;
- TestPolymorphicStruct(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue);
-
- enum: uint32_t { SERIAL_ID = 0x8f51a326 };
-
- static TestPolymorphicStruct* createInstance(const uint32_t& serialId);
-
- virtual uint32_t getSerialId() const;
- virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const;
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- typeOutputStream.writeStringType();
- typeOutputStream.writeUInt16Type();
- }
- };
- struct TestExtendedPolymorphicStruct: TestPolymorphicStruct {
- uint32_t additionalValue;
-
- TestExtendedPolymorphicStruct() = default;
- TestExtendedPolymorphicStruct(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue, const uint32_t& additionalValue);
-
- enum: uint32_t { SERIAL_ID = 0xa49310f2 };
-
- static TestExtendedPolymorphicStruct* createInstance(const uint32_t& serialId);
-
- virtual uint32_t getSerialId() const;
- virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const;
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- TestPolymorphicStruct::writeToTypeOutputStream(typeOutputStream);
- typeOutputStream.writeUInt32Type();
- }
- };
- typedef std::unordered_map<uint8_t, std::shared_ptr<TestPolymorphicStruct>> MapIntToPolymorphic;
- struct StructWithPolymorphicMember: CommonAPI::SerializableStruct {
- uint32_t numberValue;
- std::shared_ptr<TestPolymorphicStruct> polymorphicMember;
-
- StructWithPolymorphicMember() = default;
- StructWithPolymorphicMember(const uint32_t& numberValue, const std::shared_ptr<TestPolymorphicStruct>& polymorphicMember);
-
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- typeOutputStream.writeUInt32Type();
- typeOutputStream.beginWriteStructType();
- typeOutputStream.writeStringType();typeOutputStream.writeUInt16Type();
- typeOutputStream.endWriteStructType();
- }
- };
- struct StructWithEnumKeyMap: CommonAPI::SerializableStruct {
- TestEnumMap testMap;
-
- StructWithEnumKeyMap() = default;
- StructWithEnumKeyMap(const TestEnumMap& testMap);
-
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- typeOutputStream.beginWriteMapType();
- typeOutputStream.writeInt32Type();
- typeOutputStream.writeStringType();
- typeOutputStream.endWriteMapType();
- }
- };
-
-bool operator==(const TestStructExtended& lhs, const TestStructExtended& rhs);
-inline bool operator!=(const TestStructExtended& lhs, const TestStructExtended& rhs) {
- return !(lhs == rhs);
-}
-inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnum& enumValue) {
- return inputStream.readEnumValue<int32_t>(enumValue);
-}
-
-inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnum& enumValue) {
- return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
-}
-
-struct TestEnumComparator {
- inline bool operator()(const TestEnum& lhs, const TestEnum& rhs) const {
- return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
- }
-};
-
-inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnumExtended2& enumValue) {
- return inputStream.readEnumValue<int32_t>(enumValue);
-}
-
-inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnumExtended2& enumValue) {
- return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
-}
-
-struct TestEnumExtended2Comparator {
- inline bool operator()(const TestEnumExtended2& lhs, const TestEnumExtended2& rhs) const {
- return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
- }
-};
-
-
-inline bool operator==(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnum& rhs) {
- return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
-}
-inline bool operator==(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended2& rhs) {
- return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
-}
-inline bool operator!=(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnum& rhs) {
- return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
-}
-inline bool operator!=(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended2& rhs) {
- return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
-}
-
-inline bool operator==(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnumExtended& rhs) {
- return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
-}
-inline bool operator==(const DerivedTypeCollection::TestEnumExtended& lhs, const TestEnumExtended2& rhs) {
- return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
-}
-inline bool operator!=(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnumExtended& rhs) {
- return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
-}
-inline bool operator!=(const DerivedTypeCollection::TestEnumExtended& lhs, const TestEnumExtended2& rhs) {
- return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
-}
-inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnumMissingValue& enumValue) {
- return inputStream.readEnumValue<int32_t>(enumValue);
-}
-
-inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnumMissingValue& enumValue) {
- return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
-}
-
-struct TestEnumMissingValueComparator {
- inline bool operator()(const TestEnumMissingValue& lhs, const TestEnumMissingValue& rhs) const {
- return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
- }
-};
-
-inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnumExtended& enumValue) {
- return inputStream.readEnumValue<int32_t>(enumValue);
-}
-
-inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnumExtended& enumValue) {
- return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
-}
-
-struct TestEnumExtendedComparator {
- inline bool operator()(const TestEnumExtended& lhs, const TestEnumExtended& rhs) const {
- return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
- }
-};
-
-
-inline bool operator==(const TestEnumExtended& lhs, const DerivedTypeCollection::TestEnum& rhs) {
- return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
-}
-inline bool operator==(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended& rhs) {
- return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
-}
-inline bool operator!=(const TestEnumExtended& lhs, const DerivedTypeCollection::TestEnum& rhs) {
- return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
-}
-inline bool operator!=(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended& rhs) {
- return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
-}
-bool operator==(const TestStruct& lhs, const TestStruct& rhs);
-inline bool operator!=(const TestStruct& lhs, const TestStruct& rhs) {
- return !(lhs == rhs);
-}
-bool operator==(const TestPolymorphicStruct& lhs, const TestPolymorphicStruct& rhs);
-inline bool operator!=(const TestPolymorphicStruct& lhs, const TestPolymorphicStruct& rhs) {
- return !(lhs == rhs);
-}
-bool operator==(const TestExtendedPolymorphicStruct& lhs, const TestExtendedPolymorphicStruct& rhs);
-inline bool operator!=(const TestExtendedPolymorphicStruct& lhs, const TestExtendedPolymorphicStruct& rhs) {
- return !(lhs == rhs);
-}
-bool operator==(const StructWithPolymorphicMember& lhs, const StructWithPolymorphicMember& rhs);
-inline bool operator!=(const StructWithPolymorphicMember& lhs, const StructWithPolymorphicMember& rhs) {
- return !(lhs == rhs);
-}
-bool operator==(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs);
-inline bool operator!=(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs) {
- return !(lhs == rhs);
-}
-
-
-static inline const char* getTypeCollectionName() {
- static const char* typeCollectionName = "commonapi.tests.DerivedTypeCollection";
- return typeCollectionName;
-}
-
-
-} // namespace DerivedTypeCollection
-
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-
- template<>
- struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnum> {
- inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
- typeStream.writeInt32EnumType();
- }
- };
-
- template<>
- struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnum> {
- static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnum>& vectorValue) {
- inputStream.beginReadInt32EnumVector();
- }
- };
-
- template <>
- struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnum> {
- static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnum>& vectorValue) {
- outputStream.beginWriteInt32EnumVector(vectorValue.size());
- }
- };
- template<>
- struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
- inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
- typeStream.writeInt32EnumType();
- }
- };
-
- template<>
- struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
- static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended2>& vectorValue) {
- inputStream.beginReadInt32EnumVector();
- }
- };
-
- template <>
- struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
- static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended2>& vectorValue) {
- outputStream.beginWriteInt32EnumVector(vectorValue.size());
- }
- };
- template<>
- struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
- inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
- typeStream.writeInt32EnumType();
- }
- };
-
- template<>
- struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
- static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue>& vectorValue) {
- inputStream.beginReadInt32EnumVector();
- }
- };
-
- template <>
- struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
- static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue>& vectorValue) {
- outputStream.beginWriteInt32EnumVector(vectorValue.size());
- }
- };
- template<>
- struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
- inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
- typeStream.writeInt32EnumType();
- }
- };
-
- template<>
- struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
- static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended>& vectorValue) {
- inputStream.beginReadInt32EnumVector();
- }
- };
-
- template <>
- struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
- static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended>& vectorValue) {
- outputStream.beginWriteInt32EnumVector(vectorValue.size());
- }
- };
-
-}
-
-
-namespace std {
- //Hash for TestEnum
- template<>
- struct hash<commonapi::tests::DerivedTypeCollection::TestEnum> {
- inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnum& testEnum) const {
- return static_cast<int32_t>(testEnum);
- }
- };
- //Hash for TestEnumExtended2
- template<>
- struct hash<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
- inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2) const {
- return static_cast<int32_t>(testEnumExtended2);
- }
- };
- //Hash for TestEnumMissingValue
- template<>
- struct hash<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
- inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnumMissingValue& testEnumMissingValue) const {
- return static_cast<int32_t>(testEnumMissingValue);
- }
- };
- //Hash for TestEnumExtended
- template<>
- struct hash<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
- inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnumExtended& testEnumExtended) const {
- return static_cast<int32_t>(testEnumExtended);
- }
- };
-}
-
-#endif // COMMONAPI_TESTS_Derived_Type_Collection_H_
diff --git a/src/test/commonapi/tests/DerivedTypeCollection.hpp b/src/test/commonapi/tests/DerivedTypeCollection.hpp
new file mode 100644
index 0000000..95d63c5
--- /dev/null
+++ b/src/test/commonapi/tests/DerivedTypeCollection.hpp
@@ -0,0 +1,354 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.0.1.v201504231326.
+* Used org.franca.core 0.9.1.201412191134.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+* If a copy of the MPL was not distributed with this file, You can obtain one at
+* http://mozilla.org/MPL/2.0/.
+*/
+#ifndef COMMONAPI_TESTS_Derived_Type_Collection_HPP_
+#define COMMONAPI_TESTS_Derived_Type_Collection_HPP_
+
+
+#include <commonapi/tests/PredefinedTypeCollection.hpp>
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/Deployment.hpp>
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/Struct.hpp>
+#include <CommonAPI/Types.hpp>
+#include <cstdint>
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace commonapi {
+namespace tests {
+
+struct DerivedTypeCollection {
+ struct TestStruct : CommonAPI::Struct<commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> {
+
+ TestStruct() {
+ }
+ TestStruct(const commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
+ {
+ std::get<0>(values_) = _testString;
+ std::get<1>(values_) = _uintValue;
+ }
+ /**
+ * the name of the property
+ */
+ inline const commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
+ inline void setTestString(const commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
+ /**
+ * the actual value
+ */
+ inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
+ inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
+ bool operator==(const TestStruct &_other) const;
+ inline bool operator!=(const TestStruct &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ typedef std::vector<TestStruct> TestArrayTestStruct;
+ typedef std::unordered_map<uint32_t, TestArrayTestStruct> TestMap;
+ /**
+ * Common errors.
+ */
+
+ struct TestEnum : CommonAPI::Enumeration<int32_t> {
+ TestEnum() = default;
+ TestEnum(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ static const int32_t E_UNKNOWN = 0;
+ static const int32_t E_OK = 1;
+ static const int32_t E_OUT_OF_RANGE = 2;
+ static const int32_t E_NOT_USED = 3;
+ };
+
+ struct TestEnumExtended : TestEnum {
+ TestEnumExtended() = default;
+ TestEnumExtended(const int32_t &_value)
+ : TestEnum(_value) {}
+ static const int32_t E_NEW = 4;
+ };
+
+ struct TestEnumExtended2 : TestEnumExtended {
+ TestEnumExtended2() = default;
+ TestEnumExtended2(const int32_t &_value)
+ : TestEnumExtended(_value) {}
+ static const int32_t E_NEW2 = 5;
+ };
+ struct TestStructExtended : CommonAPI::Struct<commonapi::tests::PredefinedTypeCollection::TestString, uint16_t, TestEnumExtended2> {
+
+ TestStructExtended() {
+ }
+ TestStructExtended(const commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const TestEnumExtended2 &_testEnumExtended2)
+ {
+ std::get<0>(values_) = _testString;
+ std::get<1>(values_) = _uintValue;
+ std::get<2>(values_) = _testEnumExtended2;
+ }
+ /**
+ * the name of the property
+ */
+ inline const commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
+ inline void setTestString(const commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
+ /**
+ * the actual value
+ */
+ inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
+ inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
+ inline const TestEnumExtended2 &getTestEnumExtended2() const { return std::get<2>(values_); }
+ inline void setTestEnumExtended2(const TestEnumExtended2 &_value) { std::get<2>(values_) = _value; }
+ bool operator==(const TestStructExtended &_other) const;
+ inline bool operator!=(const TestStructExtended &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ typedef std::unordered_map<TestEnum, std::string, CommonAPI::EnumHasher<TestEnum>> TestEnumMap;
+
+ struct TestEnumMissingValue : CommonAPI::Enumeration<int32_t> {
+ TestEnumMissingValue() = default;
+ TestEnumMissingValue(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ static const int32_t E1 = 0;
+ static const int32_t E2 = 1;
+ static const int32_t E3 = 2;
+ };
+ typedef std::vector<uint64_t> TestArrayUInt64;
+ static const CommonAPI::Serial TESTPOLYMORPHICSTRUCT_SERIAL = 0x8F51A326;
+ static const CommonAPI::Serial TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL = 0xA49310F2;
+
+ struct TestPolymorphicStruct : CommonAPI::PolymorphicStruct {
+ static std::shared_ptr<TestPolymorphicStruct> create(CommonAPI::Serial _serial);
+ const CommonAPI::Serial getSerial() const { return TESTPOLYMORPHICSTRUCT_SERIAL; }
+
+ TestPolymorphicStruct() {
+ }
+ TestPolymorphicStruct(const commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
+ {
+ std::get<0>(values_) = _testString;
+ std::get<1>(values_) = _uintValue;
+ }
+ template<class _Input>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
+ _input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
+ _input.template readValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<_Input>(_input, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Input, class _Deployment>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
+ _input.template readValue<>(std::get<0>(values_), std::get<0>(_depl->values_));
+ _input.template readValue<>(std::get<1>(values_), std::get<1>(_depl->values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<>(_input, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Output>
+ void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
+ _output.writeType(std::get<0>(values_));
+ _output.writeType(std::get<1>(values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template writeType<_Output>(_output);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Output>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
+ _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
+ _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<_Output>(_output, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Output, class _Deployment>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
+ _output.template writeValue<>(std::get<0>(values_), _depl, std::get<0>(_depl->values_));
+ _output.template writeValue<>(std::get<1>(values_), _depl, std::get<1>(_depl->values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<>(_output, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+ /**
+ * the name of the property
+ */
+ inline const commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
+ inline void setTestString(const commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
+ /**
+ * the actual value
+ */
+ inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
+ inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
+
+ std::tuple<commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> values_;
+ bool operator==(const TestPolymorphicStruct &_other) const;
+ inline bool operator!=(const TestPolymorphicStruct &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ struct TestExtendedPolymorphicStruct : TestPolymorphicStruct {
+ const CommonAPI::Serial getSerial() const { return TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL; }
+
+ TestExtendedPolymorphicStruct() {
+ }
+ TestExtendedPolymorphicStruct(const commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const uint32_t &_additionalValue)
+ : TestPolymorphicStruct(_testString, _uintValue)
+ {
+ std::get<0>(values_) = _additionalValue;
+ }
+ template<class _Input>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
+ _input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
+ }
+
+ template<class _Input, class _Deployment>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
+ _input.template readValue<>(std::get<0>(values_), std::get<2>(_depl->values_));
+ }
+
+ template<class _Output>
+ void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
+ _output.writeType(std::get<0>(values_));
+ }
+
+ template<class _Output>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_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_));
+ }
+ inline const uint32_t &getAdditionalValue() const { return std::get<0>(values_); }
+ inline void setAdditionalValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
+
+ std::tuple<uint32_t> values_;
+ bool operator==(const TestExtendedPolymorphicStruct &_other) const;
+ inline bool operator!=(const TestExtendedPolymorphicStruct &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ typedef std::unordered_map<uint8_t, std::shared_ptr<TestPolymorphicStruct>> MapIntToPolymorphic;
+ struct StructWithPolymorphicMember : CommonAPI::Struct<uint32_t, std::shared_ptr<TestPolymorphicStruct>> {
+
+ StructWithPolymorphicMember() {
+ }
+ StructWithPolymorphicMember(const uint32_t &_numberValue, const std::shared_ptr<TestPolymorphicStruct> &_polymorphicMember)
+ {
+ std::get<0>(values_) = _numberValue;
+ std::get<1>(values_) = _polymorphicMember;
+ }
+ inline const uint32_t &getNumberValue() const { return std::get<0>(values_); }
+ inline void setNumberValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
+ inline const std::shared_ptr<TestPolymorphicStruct> &getPolymorphicMember() const { return std::get<1>(values_); }
+ inline void setPolymorphicMember(const std::shared_ptr<TestPolymorphicStruct> &_value) { std::get<1>(values_) = _value; }
+ bool operator==(const StructWithPolymorphicMember &_other) const;
+ inline bool operator!=(const StructWithPolymorphicMember &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ struct StructWithEnumKeyMap : CommonAPI::Struct<TestEnumMap> {
+
+ StructWithEnumKeyMap() {
+ }
+ StructWithEnumKeyMap(const TestEnumMap &_testMap)
+ {
+ std::get<0>(values_) = _testMap;
+ }
+ inline const TestEnumMap &getTestMap() const { return std::get<0>(values_); }
+ inline void setTestMap(const TestEnumMap &_value) { std::get<0>(values_) = _value; }
+ bool operator==(const StructWithEnumKeyMap &_other) const;
+ inline bool operator!=(const StructWithEnumKeyMap &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+
+
+
+static inline const char* getTypeCollectionName() {
+ static const char* typeCollectionName = "commonapi.tests.DerivedTypeCollection";
+ return typeCollectionName;
+}
+
+
+}; // struct DerivedTypeCollection
+
+} // namespace tests
+} // namespace commonapi
+
+namespace CommonAPI {
+}
+
+
+namespace std {
+ //Hash for TestEnum
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnum> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnum& testEnum) const {
+ return static_cast<int32_t>(testEnum);
+ }
+ };
+ //Hash for TestEnumExtended2
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2) const {
+ return static_cast<int32_t>(testEnumExtended2);
+ }
+ };
+ //Hash for TestEnumMissingValue
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue& testEnumMissingValue) const {
+ return static_cast<int32_t>(testEnumMissingValue);
+ }
+ };
+ //Hash for TestEnumExtended
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended& testEnumExtended) const {
+ return static_cast<int32_t>(testEnumExtended);
+ }
+ };
+}
+
+#endif // COMMONAPI_TESTS_Derived_Type_Collection_HPP_
diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
deleted file mode 100644
index 8306c51..0000000
--- a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "ExtendedInterfaceDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createExtendedInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<ExtendedInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerExtendedInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(ExtendedInterface::getInterfaceId(),
- &createExtendedInterfaceDBusProxy);
-}
-
-ExtendedInterfaceDBusProxy::ExtendedInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
- , TestInterfaceDBusProxy(
- factory,
- commonApiAddress,
- interfaceName,
- busName,
- objectPath,
- dbusProxyconnection)
- {
- }
-
-
-
-void ExtendedInterfaceDBusProxy::TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "TestIntMethodExtended",
- "u",
- inInt,
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> ExtendedInterfaceDBusProxy::TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "TestIntMethodExtended",
- "u",
- inInt,
- std::move(callback));
-}
-
-
-
-void ExtendedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
-}
-
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h
deleted file mode 100644
index 9e59f68..0000000
--- a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_
-
-#include <commonapi/tests/ExtendedInterfaceProxyBase.h>
-#include <commonapi/tests/TestInterfaceDBusProxy.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-
-class ExtendedInterfaceDBusProxy: virtual public ExtendedInterfaceProxyBase, virtual public TestInterfaceDBusProxy {
- public:
- ExtendedInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~ExtendedInterfaceDBusProxy() { }
-
-
-
- virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
-
-
-};
-
-
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h b/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h
deleted file mode 100644
index b2d504a..0000000
--- a/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_
-#define COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_
-
-#include "ExtendedInterface.h"
-#include "TestInterfaceProxyBase.h"
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.h>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-class ExtendedInterfaceProxyBase: virtual public TestInterfaceProxyBase {
- public:
-
- typedef std::function<void(const CommonAPI::CallStatus&)> TestIntMethodExtendedAsyncCallback;
-
-
-
- virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback) = 0;
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_
diff --git a/src/test/commonapi/tests/PredefinedTypeCollection.h b/src/test/commonapi/tests/PredefinedTypeCollection.hpp
index 7ccf60d..4abfb2d 100644
--- a/src/test/commonapi/tests/PredefinedTypeCollection.h
+++ b/src/test/commonapi/tests/PredefinedTypeCollection.hpp
@@ -1,14 +1,14 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.0.1.v201504231326.
+* Used 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_H_
-#define COMMONAPI_TESTS_Predefined_Type_Collection_H_
+#ifndef COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
+#define COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
@@ -16,8 +16,8 @@
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/ByteBuffer.h>
-#include <CommonAPI/types.h>
+#include <CommonAPI/ByteBuffer.hpp>
+#include <CommonAPI/Types.hpp>
#include <cstdint>
#include <string>
@@ -26,7 +26,7 @@
namespace commonapi {
namespace tests {
-namespace PredefinedTypeCollection {
+struct PredefinedTypeCollection {
typedef uint8_t TestUInt8;
typedef uint16_t TestUInt16;
typedef uint32_t TestUInt32;
@@ -49,18 +49,16 @@ static inline const char* getTypeCollectionName() {
}
-} // namespace PredefinedTypeCollection
+}; // struct PredefinedTypeCollection
} // namespace tests
} // namespace commonapi
namespace CommonAPI {
-
-
}
namespace std {
}
-#endif // COMMONAPI_TESTS_Predefined_Type_Collection_H_
+#endif // COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterface.h b/src/test/commonapi/tests/TestFreedesktopDerivedInterface.h
deleted file mode 100644
index ea40d73..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterface.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_H_
-
-
-
-#include <commonapi/tests/TestFreedesktopInterface.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/types.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopDerivedInterface: public TestFreedesktopInterface {
- public:
- virtual ~TestFreedesktopDerivedInterface() { }
-
- static inline const char* getInterfaceId();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* TestFreedesktopDerivedInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.TestFreedesktopDerivedInterface";
- return interfaceId;
-}
-
-CommonAPI::Version TestFreedesktopDerivedInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
-}
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
deleted file mode 100644
index d8b2602..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "TestFreedesktopDerivedInterfaceDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestFreedesktopDerivedInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<TestFreedesktopDerivedInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerTestFreedesktopDerivedInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(TestFreedesktopDerivedInterface::getInterfaceId(),
- &createTestFreedesktopDerivedInterfaceDBusProxy);
-}
-
-TestFreedesktopDerivedInterfaceDBusProxy::TestFreedesktopDerivedInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
- , TestFreedesktopInterfaceDBusProxy(
- factory,
- commonApiAddress,
- interfaceName,
- busName,
- objectPath,
- dbusProxyconnection)
-,testAttributedFromDerivedInterface_(*this, interfaceName.c_str(), "TestAttributedFromDerivedInterface")
- {
- }
-
-TestFreedesktopDerivedInterfaceDBusProxy::TestAttributedFromDerivedInterfaceAttribute& TestFreedesktopDerivedInterfaceDBusProxy::getTestAttributedFromDerivedInterfaceAttribute() {
- return testAttributedFromDerivedInterface_;
-}
-
-
-
-
-
-void TestFreedesktopDerivedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
-}
-
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.h b/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.h
deleted file mode 100644
index 260e3ce..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_H_
-
-#include <commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.h>
-#include <commonapi/tests/TestFreedesktopInterfaceDBusProxy.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusAttribute.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopDerivedInterfaceDBusProxy: virtual public TestFreedesktopDerivedInterfaceProxyBase, virtual public TestFreedesktopInterfaceDBusProxy {
- public:
- TestFreedesktopDerivedInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~TestFreedesktopDerivedInterfaceDBusProxy() { }
-
- virtual TestAttributedFromDerivedInterfaceAttribute& getTestAttributedFromDerivedInterfaceAttribute();
-
-
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestAttributedFromDerivedInterfaceAttribute>> testAttributedFromDerivedInterface_;
-
-
-};
-
-
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.h b/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.h
deleted file mode 100644
index c449582..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_H_
-
-#include "TestFreedesktopDerivedInterfaceProxyBase.h"
-
-#include "TestFreedesktopInterfaceProxy.h"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/AttributeExtension.h>
-#include <CommonAPI/Factory.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-template <typename ... _AttributeExtensions>
-class TestFreedesktopDerivedInterfaceProxy: virtual public TestFreedesktopDerivedInterface, virtual public TestFreedesktopDerivedInterfaceProxyBase
-, virtual public TestFreedesktopInterfaceProxy<_AttributeExtensions...>
-, public _AttributeExtensions... {
-public:
- TestFreedesktopDerivedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~TestFreedesktopDerivedInterfaceProxy();
-
- typedef TestFreedesktopDerivedInterface InterfaceType;
-
- inline static const char* getInterfaceId() {
- return(TestFreedesktopDerivedInterface::getInterfaceId());
- }
-
- /**
- * Returns the wrapper class that provides access to the attribute TestAttributedFromDerivedInterface.
- */
- virtual TestAttributedFromDerivedInterfaceAttribute& getTestAttributedFromDerivedInterfaceAttribute() {
- return delegate_->getTestAttributedFromDerivedInterfaceAttribute();
- }
-
-
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<TestFreedesktopDerivedInterfaceProxyBase> delegate_;
-};
-
-#ifdef WIN32
- typedef TestFreedesktopDerivedInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> TestFreedesktopDerivedInterfaceProxyDefault;
-#else
- typedef TestFreedesktopDerivedInterfaceProxy<> TestFreedesktopDerivedInterfaceProxyDefault;
-#endif
-
-namespace TestFreedesktopDerivedInterfaceExtensions {
- template <template <typename > class _ExtensionType>
- class TestAttributedFromDerivedInterfaceAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopDerivedInterfaceProxyBase::TestAttributedFromDerivedInterfaceAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopDerivedInterfaceProxyBase::TestAttributedFromDerivedInterfaceAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestAttributedFromDerivedInterfaceAttributeExtension() {}
- #endif
-
- TestAttributedFromDerivedInterfaceAttributeExtension(TestFreedesktopDerivedInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestAttributedFromDerivedInterfaceAttribute()) {
- }
-
- inline extension_type& getTestAttributedFromDerivedInterfaceAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
-} // namespace TestFreedesktopDerivedInterfaceExtensions
-
-//
-// TestFreedesktopDerivedInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::TestFreedesktopDerivedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- TestFreedesktopInterfaceProxy<_AttributeExtensions...>(delegate),
- _AttributeExtensions(*(std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::~TestFreedesktopDerivedInterfaceProxy() {
-}
-
-
-template <typename ... _AttributeExtensions>
-std::string TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyFactoryHelper<commonapi::tests::TestFreedesktopDerivedInterfaceProxy,
- _AttributeExtension> {
- typedef typename commonapi::tests::TestFreedesktopDerivedInterfaceProxy<
- commonapi::tests::TestFreedesktopDerivedInterfaceExtensions::TestAttributedFromDerivedInterfaceAttributeExtension<_AttributeExtension>
- > class_t;
-};
-}
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.h b/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.h
deleted file mode 100644
index 97a3c0f..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_H_
-
-#include "TestFreedesktopDerivedInterface.h"
-#include "TestFreedesktopInterfaceProxyBase.h"
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Attribute.h>
-#include <CommonAPI/Proxy.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopDerivedInterfaceProxyBase: virtual public TestFreedesktopInterfaceProxyBase {
- public:
- typedef CommonAPI::ObservableAttribute<uint32_t> TestAttributedFromDerivedInterfaceAttribute;
-
-
- virtual TestAttributedFromDerivedInterfaceAttribute& getTestAttributedFromDerivedInterfaceAttribute() = 0;
-
-
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStub.h b/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStub.h
deleted file mode 100644
index c81a7d2..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStub.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_H_
-
-
-
-#include <commonapi/tests/TestFreedesktopInterfaceStub.h>
-
-#include "TestFreedesktopDerivedInterface.h"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Stub.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service TestFreedesktopDerivedInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class TestFreedesktopDerivedInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public TestFreedesktopDerivedInterface, public virtual TestFreedesktopInterfaceStubAdapter {
- public:
- ///Notifies all remote listeners about a change of value of the attribute TestAttributedFromDerivedInterface.
- virtual void fireTestAttributedFromDerivedInterfaceAttributeChanged(const uint32_t& TestAttributedFromDerivedInterface) = 0;
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for TestFreedesktopDerivedInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestFreedesktopDerivedInterfaceStubRemoteEvent: public virtual TestFreedesktopInterfaceStubRemoteEvent {
- public:
- virtual ~TestFreedesktopDerivedInterfaceStubRemoteEvent() { }
-
- /// Verification callback for remote set requests on the attribute TestAttributedFromDerivedInterface
- virtual bool onRemoteSetTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t TestAttributedFromDerivedInterface) = 0;
- /// Action callback for remote set requests on the attribute TestAttributedFromDerivedInterface
- virtual void onRemoteTestAttributedFromDerivedInterfaceAttributeChanged() = 0;
-
-};
-
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service TestFreedesktopDerivedInterface to remote clients.
- * This class and the one above are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestFreedesktopDerivedInterfaceStub: public virtual CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>, public virtual TestFreedesktopInterfaceStub {
-public:
- virtual ~TestFreedesktopDerivedInterfaceStub() { }
- virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
- /// Provides getter access to the attribute TestAttributedFromDerivedInterface
- virtual const uint32_t& getTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
-
- using CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef TestFreedesktopDerivedInterfaceStubRemoteEvent RemoteEventType;
- typedef TestFreedesktopDerivedInterface StubInterface;
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
deleted file mode 100644
index 44ef5a0..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include <commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.h>
-
-namespace commonapi {
-namespace tests {
-
-TestFreedesktopDerivedInterfaceStubDefault::TestFreedesktopDerivedInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(TestFreedesktopDerivedInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& TestFreedesktopDerivedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
- return interfaceVersion_;
-}
-
-TestFreedesktopDerivedInterfaceStubRemoteEvent* TestFreedesktopDerivedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestFreedesktopDerivedInterfaceStubAdapter>& stubAdapter) {
- TestFreedesktopInterfaceStubDefault::initStubAdapter(stubAdapter);
- CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
- return &remoteEventHandler_;
-}
-
-const uint32_t& TestFreedesktopDerivedInterfaceStubDefault::getTestAttributedFromDerivedInterfaceAttribute() {
- return testAttributedFromDerivedInterfaceAttributeValue_;
-}
-
-const uint32_t& TestFreedesktopDerivedInterfaceStubDefault::getTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestAttributedFromDerivedInterfaceAttribute();
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::setTestAttributedFromDerivedInterfaceAttribute(uint32_t value) {
- const bool valueChanged = trySetTestAttributedFromDerivedInterfaceAttribute(std::move(value));
- if (valueChanged) {
- CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::stubAdapter_->fireTestAttributedFromDerivedInterfaceAttributeChanged(testAttributedFromDerivedInterfaceAttributeValue_);
- }
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::trySetTestAttributedFromDerivedInterfaceAttribute(uint32_t value) {
- if (!validateTestAttributedFromDerivedInterfaceAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testAttributedFromDerivedInterfaceAttributeValue_ != value);
- testAttributedFromDerivedInterfaceAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::validateTestAttributedFromDerivedInterfaceAttributeRequestedValue(const uint32_t& value) {
- return true;
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::setTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) {
- setTestAttributedFromDerivedInterfaceAttribute(value);
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::onRemoteTestAttributedFromDerivedInterfaceAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteTestAttributedFromDerivedInterfaceAttributeChanged() {
- defaultStub_->onRemoteTestAttributedFromDerivedInterfaceAttributeChanged();
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestAttributedFromDerivedInterfaceAttribute(uint32_t value) {
- return defaultStub_->trySetTestAttributedFromDerivedInterfaceAttribute(std::move(value));
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) {
- return onRemoteSetTestAttributedFromDerivedInterfaceAttribute(value);
-}
-
-
-
-
-
-TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestFreedesktopDerivedInterfaceStubDefault* defaultStub):
- TestFreedesktopInterfaceStubDefault::RemoteEventHandler(defaultStub),
- defaultStub_(defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.h b/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.h
deleted file mode 100644
index 22f88d5..0000000
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT_H_
-
-#include <commonapi/tests/TestFreedesktopInterfaceStubDefault.h>
-
-#include <commonapi/tests/TestFreedesktopDerivedInterfaceStub.h>
-#include <sstream>
-
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for TestFreedesktopDerivedInterfaceStubRemoteEvent and
- * TestFreedesktopDerivedInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class TestFreedesktopDerivedInterfaceStubDefault : public virtual TestFreedesktopDerivedInterfaceStub, public virtual TestFreedesktopInterfaceStubDefault {
-public:
- TestFreedesktopDerivedInterfaceStubDefault();
-
- TestFreedesktopDerivedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestFreedesktopDerivedInterfaceStubAdapter>& stubAdapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
-
- virtual const uint32_t& getTestAttributedFromDerivedInterfaceAttribute();
- virtual const uint32_t& getTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestAttributedFromDerivedInterfaceAttribute(uint32_t value);
- virtual void setTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value);
-
-
-
-
-protected:
- virtual bool trySetTestAttributedFromDerivedInterfaceAttribute(uint32_t value);
- virtual bool validateTestAttributedFromDerivedInterfaceAttributeRequestedValue(const uint32_t& value);
- virtual void onRemoteTestAttributedFromDerivedInterfaceAttributeChanged();
- class RemoteEventHandler: public virtual TestFreedesktopDerivedInterfaceStubRemoteEvent, public virtual TestFreedesktopInterfaceStubDefault::RemoteEventHandler {
- public:
- RemoteEventHandler(TestFreedesktopDerivedInterfaceStubDefault* defaultStub);
-
- virtual bool onRemoteSetTestAttributedFromDerivedInterfaceAttribute(uint32_t value);
- virtual bool onRemoteSetTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value);
- virtual void onRemoteTestAttributedFromDerivedInterfaceAttributeChanged();
-
-
- private:
- TestFreedesktopDerivedInterfaceStubDefault* defaultStub_;
- };
-private:
- TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
- uint32_t testAttributedFromDerivedInterfaceAttributeValue_;
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopInterface.h b/src/test/commonapi/tests/TestFreedesktopInterface.h
deleted file mode 100644
index 7b97b15..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterface.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Interface_H_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/types.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopInterface {
- public:
- virtual ~TestFreedesktopInterface() { }
-
- static inline const char* getInterfaceId();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* TestFreedesktopInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.TestFreedesktopInterface";
- return interfaceId;
-}
-
-CommonAPI::Version TestFreedesktopInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
-}
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
deleted file mode 100644
index ad98cec..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "TestFreedesktopInterfaceDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestFreedesktopInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<TestFreedesktopInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerTestFreedesktopInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(TestFreedesktopInterface::getInterfaceId(),
- &createTestFreedesktopInterfaceDBusProxy);
-}
-
-TestFreedesktopInterfaceDBusProxy::TestFreedesktopInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
-,testPredefinedTypeAttribute_(*this, interfaceName.c_str(), "TestPredefinedTypeAttribute"),
-testReadonlyAttribute_(*this, interfaceName.c_str(), "TestReadonlyAttribute"),
-testDerivedStructAttribute_(*this, interfaceName.c_str(), "TestDerivedStructAttribute"),
-testDerivedArrayAttribute_(*this, interfaceName.c_str(), "TestDerivedArrayAttribute")
- {
- }
-
-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
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.h b/src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.h
deleted file mode 100644
index 869fa29..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_H_
-
-#include <commonapi/tests/TestFreedesktopInterfaceProxyBase.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusAttribute.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopInterfaceDBusProxy: virtual public TestFreedesktopInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy {
- public:
- TestFreedesktopInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~TestFreedesktopInterfaceDBusProxy() { }
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute();
- virtual TestReadonlyAttributeAttribute& getTestReadonlyAttributeAttribute();
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute();
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute();
-
-
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_;
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopReadonlyAttribute<TestReadonlyAttributeAttribute>> testReadonlyAttribute_;
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestDerivedStructAttributeAttribute>> testDerivedStructAttribute_;
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestDerivedArrayAttributeAttribute>> testDerivedArrayAttribute_;
-
-
-};
-
-
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceProxy.h b/src/test/commonapi/tests/TestFreedesktopInterfaceProxy.h
deleted file mode 100644
index 0b4ce8d..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceProxy.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_H_
-
-#include "TestFreedesktopInterfaceProxyBase.h"
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/AttributeExtension.h>
-#include <CommonAPI/Factory.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-template <typename ... _AttributeExtensions>
-class TestFreedesktopInterfaceProxy: virtual public TestFreedesktopInterface, virtual public TestFreedesktopInterfaceProxyBase
-, public _AttributeExtensions... {
-public:
- TestFreedesktopInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~TestFreedesktopInterfaceProxy();
-
- typedef TestFreedesktopInterface InterfaceType;
-
-
- /**
- * Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute.
- */
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() {
- return delegate_->getTestPredefinedTypeAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestReadonlyAttribute.
- */
- virtual TestReadonlyAttributeAttribute& getTestReadonlyAttributeAttribute() {
- return delegate_->getTestReadonlyAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestDerivedStructAttribute.
- */
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() {
- return delegate_->getTestDerivedStructAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestDerivedArrayAttribute.
- */
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() {
- return delegate_->getTestDerivedArrayAttributeAttribute();
- }
-
-
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<TestFreedesktopInterfaceProxyBase> delegate_;
-};
-
-#ifdef WIN32
- typedef TestFreedesktopInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> TestFreedesktopInterfaceProxyDefault;
-#else
- typedef TestFreedesktopInterfaceProxy<> TestFreedesktopInterfaceProxyDefault;
-#endif
-
-namespace TestFreedesktopInterfaceExtensions {
- template <template <typename > class _ExtensionType>
- class TestPredefinedTypeAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestPredefinedTypeAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestPredefinedTypeAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestPredefinedTypeAttributeAttributeExtension() {}
- #endif
-
- TestPredefinedTypeAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestPredefinedTypeAttributeAttribute()) {
- }
-
- inline extension_type& getTestPredefinedTypeAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestReadonlyAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestReadonlyAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestReadonlyAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestReadonlyAttributeAttributeExtension() {}
- #endif
-
- TestReadonlyAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestReadonlyAttributeAttribute()) {
- }
-
- inline extension_type& getTestReadonlyAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestDerivedStructAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestDerivedStructAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestDerivedStructAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestDerivedStructAttributeAttributeExtension() {}
- #endif
-
- TestDerivedStructAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedStructAttributeAttribute()) {
- }
-
- inline extension_type& getTestDerivedStructAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestDerivedArrayAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestDerivedArrayAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestDerivedArrayAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestDerivedArrayAttributeAttributeExtension() {}
- #endif
-
- TestDerivedArrayAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedArrayAttributeAttribute()) {
- }
-
- inline extension_type& getTestDerivedArrayAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
-} // namespace TestFreedesktopInterfaceExtensions
-
-//
-// TestFreedesktopInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-TestFreedesktopInterfaceProxy<_AttributeExtensions...>::TestFreedesktopInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<TestFreedesktopInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<TestFreedesktopInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-TestFreedesktopInterfaceProxy<_AttributeExtensions...>::~TestFreedesktopInterfaceProxy() {
-}
-
-
-template <typename ... _AttributeExtensions>
-std::string TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyFactoryHelper<commonapi::tests::TestFreedesktopInterfaceProxy,
- _AttributeExtension> {
- typedef typename commonapi::tests::TestFreedesktopInterfaceProxy<
- commonapi::tests::TestFreedesktopInterfaceExtensions::TestPredefinedTypeAttributeAttributeExtension<_AttributeExtension>,
- commonapi::tests::TestFreedesktopInterfaceExtensions::TestReadonlyAttributeAttributeExtension<_AttributeExtension>,
- commonapi::tests::TestFreedesktopInterfaceExtensions::TestDerivedStructAttributeAttributeExtension<_AttributeExtension>,
- commonapi::tests::TestFreedesktopInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<_AttributeExtension>
- > class_t;
-};
-}
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceProxyBase.h b/src/test/commonapi/tests/TestFreedesktopInterfaceProxyBase.h
deleted file mode 100644
index 417a157..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceProxyBase.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_H_
-
-#include "TestFreedesktopInterface.h"
-
-
-#include <commonapi/tests/DerivedTypeCollection.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <cstdint>
-#include <vector>
-
-#include <CommonAPI/Attribute.h>
-#include <CommonAPI/Proxy.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopInterfaceProxyBase: virtual public CommonAPI::Proxy {
- public:
- typedef CommonAPI::ObservableAttribute<uint32_t> TestPredefinedTypeAttributeAttribute;
- typedef CommonAPI::ObservableReadonlyAttribute<uint32_t> TestReadonlyAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<DerivedTypeCollection::TestStructExtended> TestDerivedStructAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<DerivedTypeCollection::TestArrayUInt64> TestDerivedArrayAttributeAttribute;
-
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() = 0;
- virtual TestReadonlyAttributeAttribute& getTestReadonlyAttributeAttribute() = 0;
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() = 0;
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() = 0;
-
-
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceStub.h b/src/test/commonapi/tests/TestFreedesktopInterfaceStub.h
deleted file mode 100644
index 623c012..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceStub.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_H_
-
-
-
-#include <commonapi/tests/DerivedTypeCollection.h>
-
-#include "TestFreedesktopInterface.h"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <cstdint>
-#include <vector>
-
-#include <CommonAPI/Stub.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service TestFreedesktopInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class TestFreedesktopInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public TestFreedesktopInterface {
- public:
- ///Notifies all remote listeners about a change of value of the attribute TestPredefinedTypeAttribute.
- virtual void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& TestPredefinedTypeAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestReadonlyAttribute.
- virtual void fireTestReadonlyAttributeAttributeChanged(const uint32_t& TestReadonlyAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestDerivedStructAttribute.
- virtual void fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& TestDerivedStructAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestDerivedArrayAttribute.
- virtual void fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& TestDerivedArrayAttribute) = 0;
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for TestFreedesktopInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestFreedesktopInterfaceStubRemoteEvent {
- public:
- virtual ~TestFreedesktopInterfaceStubRemoteEvent() { }
-
- /// Verification callback for remote set requests on the attribute TestPredefinedTypeAttribute
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t TestPredefinedTypeAttribute) = 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> clientId, DerivedTypeCollection::TestStructExtended TestDerivedStructAttribute) = 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> clientId, DerivedTypeCollection::TestArrayUInt64 TestDerivedArrayAttribute) = 0;
- /// Action callback for remote set requests on the attribute TestDerivedArrayAttribute
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged() = 0;
-
-};
-
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service TestFreedesktopInterface to remote clients.
- * This class and the one above are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestFreedesktopInterfaceStub: public virtual CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent> {
-public:
- virtual ~TestFreedesktopInterfaceStub() { }
- virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
- /// Provides getter access to the attribute TestPredefinedTypeAttribute
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
- /// Provides getter access to the attribute TestReadonlyAttribute
- virtual const uint32_t& getTestReadonlyAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
- /// Provides getter access to the attribute TestDerivedStructAttribute
- virtual const DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
- /// Provides getter access to the attribute TestDerivedArrayAttribute
- virtual const DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
-
- using CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef TestFreedesktopInterfaceStubRemoteEvent RemoteEventType;
- typedef TestFreedesktopInterface StubInterface;
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_H_
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
deleted file mode 100644
index 3de15da..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include <commonapi/tests/TestFreedesktopInterfaceStubDefault.h>
-
-namespace commonapi {
-namespace tests {
-
-TestFreedesktopInterfaceStubDefault::TestFreedesktopInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(TestFreedesktopInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& TestFreedesktopInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
- return interfaceVersion_;
-}
-
-TestFreedesktopInterfaceStubRemoteEvent* TestFreedesktopInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestFreedesktopInterfaceStubAdapter>& stubAdapter) {
- CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
- return &remoteEventHandler_;
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute() {
- return testPredefinedTypeAttributeAttributeValue_;
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestPredefinedTypeAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(uint32_t value) {
- const bool valueChanged = trySetTestPredefinedTypeAttributeAttribute(std::move(value));
- if (valueChanged) {
- stubAdapter_->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t value) {
- if (!validateTestPredefinedTypeAttributeAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testPredefinedTypeAttributeAttributeValue_ != value);
- testPredefinedTypeAttributeAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t& value) {
- return true;
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) {
- setTestPredefinedTypeAttributeAttribute(value);
-}
-
-void TestFreedesktopInterfaceStubDefault::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- defaultStub_->onRemoteTestPredefinedTypeAttributeAttributeChanged();
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t value) {
- return defaultStub_->trySetTestPredefinedTypeAttributeAttribute(std::move(value));
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) {
- return onRemoteSetTestPredefinedTypeAttributeAttribute(value);
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestReadonlyAttributeAttribute() {
- return testReadonlyAttributeAttributeValue_;
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestReadonlyAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestReadonlyAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestReadonlyAttributeAttribute(uint32_t value) {
- const bool valueChanged = trySetTestReadonlyAttributeAttribute(std::move(value));
- if (valueChanged) {
- stubAdapter_->fireTestReadonlyAttributeAttributeChanged(testReadonlyAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestReadonlyAttributeAttribute(uint32_t value) {
- if (!validateTestReadonlyAttributeAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testReadonlyAttributeAttributeValue_ != value);
- testReadonlyAttributeAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestReadonlyAttributeAttributeRequestedValue(const uint32_t& value) {
- return true;
-}
-
-
-const DerivedTypeCollection::TestStructExtended& TestFreedesktopInterfaceStubDefault::getTestDerivedStructAttributeAttribute() {
- return testDerivedStructAttributeAttributeValue_;
-}
-
-const DerivedTypeCollection::TestStructExtended& TestFreedesktopInterfaceStubDefault::getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestDerivedStructAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) {
- const bool valueChanged = trySetTestDerivedStructAttributeAttribute(std::move(value));
- if (valueChanged) {
- stubAdapter_->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) {
- if (!validateTestDerivedStructAttributeAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testDerivedStructAttributeAttributeValue_ != value);
- testDerivedStructAttributeAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestDerivedStructAttributeAttributeRequestedValue(const DerivedTypeCollection::TestStructExtended& value) {
- return true;
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) {
- setTestDerivedStructAttributeAttribute(value);
-}
-
-void TestFreedesktopInterfaceStubDefault::onRemoteTestDerivedStructAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedStructAttributeAttributeChanged() {
- defaultStub_->onRemoteTestDerivedStructAttributeAttributeChanged();
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) {
- return defaultStub_->trySetTestDerivedStructAttributeAttribute(std::move(value));
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) {
- return onRemoteSetTestDerivedStructAttributeAttribute(value);
-}
-
-const DerivedTypeCollection::TestArrayUInt64& TestFreedesktopInterfaceStubDefault::getTestDerivedArrayAttributeAttribute() {
- return testDerivedArrayAttributeAttributeValue_;
-}
-
-const DerivedTypeCollection::TestArrayUInt64& TestFreedesktopInterfaceStubDefault::getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestDerivedArrayAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) {
- const bool valueChanged = trySetTestDerivedArrayAttributeAttribute(std::move(value));
- if (valueChanged) {
- stubAdapter_->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) {
- if (!validateTestDerivedArrayAttributeAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testDerivedArrayAttributeAttributeValue_ != value);
- testDerivedArrayAttributeAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value) {
- return true;
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) {
- setTestDerivedArrayAttributeAttribute(value);
-}
-
-void TestFreedesktopInterfaceStubDefault::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- defaultStub_->onRemoteTestDerivedArrayAttributeAttributeChanged();
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) {
- return defaultStub_->trySetTestDerivedArrayAttributeAttribute(std::move(value));
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) {
- return onRemoteSetTestDerivedArrayAttributeAttribute(value);
-}
-
-
-
-
-
-TestFreedesktopInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestFreedesktopInterfaceStubDefault* defaultStub):
- defaultStub_(defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.h b/src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.h
deleted file mode 100644
index 597e176..0000000
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT_H_
-
-
-#include <commonapi/tests/TestFreedesktopInterfaceStub.h>
-#include <sstream>
-
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for TestFreedesktopInterfaceStubRemoteEvent and
- * TestFreedesktopInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class TestFreedesktopInterfaceStubDefault : public virtual TestFreedesktopInterfaceStub {
-public:
- TestFreedesktopInterfaceStubDefault();
-
- TestFreedesktopInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestFreedesktopInterfaceStubAdapter>& stubAdapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
-
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute();
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestPredefinedTypeAttributeAttribute(uint32_t value);
- virtual void setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value);
- virtual const uint32_t& getTestReadonlyAttributeAttribute();
- virtual const uint32_t& getTestReadonlyAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestReadonlyAttributeAttribute(uint32_t value);
- virtual const DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute();
- virtual const DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
- virtual void setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value);
- virtual const DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute();
- virtual const DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
- virtual void setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value);
-
-
-
-
-protected:
- virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t value);
- virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t& value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
- virtual bool trySetTestReadonlyAttributeAttribute(uint32_t value);
- virtual bool validateTestReadonlyAttributeAttributeRequestedValue(const uint32_t& value);
- virtual bool trySetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
- virtual bool validateTestDerivedStructAttributeAttributeRequestedValue(const DerivedTypeCollection::TestStructExtended& value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
- virtual bool trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
- virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
- class RemoteEventHandler: public virtual TestFreedesktopInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(TestFreedesktopInterfaceStubDefault* defaultStub);
-
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t value);
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
-
-
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
-
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
-
-
- private:
- TestFreedesktopInterfaceStubDefault* defaultStub_;
- };
-private:
- TestFreedesktopInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
- uint32_t testPredefinedTypeAttributeAttributeValue_;
- uint32_t testReadonlyAttributeAttributeValue_;
- DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_;
- DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_;
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT_H_
diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp
deleted file mode 100644
index bb0d482..0000000
--- a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "TestInterfaceDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<TestInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerTestInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(TestInterface::getInterfaceId(),
- &createTestInterfaceDBusProxy);
-}
-
-TestInterfaceDBusProxy::TestInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
-,testPredefinedTypeAttribute_(*this, "onTestPredefinedTypeAttributeAttributeChanged", "setTestPredefinedTypeAttributeAttribute", "u", "getTestPredefinedTypeAttributeAttribute"),
-testDerivedStructAttribute_(*this, "onTestDerivedStructAttributeAttributeChanged", "setTestDerivedStructAttributeAttribute", "(sqi)", "getTestDerivedStructAttributeAttribute"),
-testDerivedArrayAttribute_(*this, "onTestDerivedArrayAttributeAttributeChanged", "setTestDerivedArrayAttributeAttribute", "at", "getTestDerivedArrayAttributeAttribute")
-, testPredefinedTypeBroadcast_(*this, "TestPredefinedTypeBroadcast", "us"),
- testSelectiveBroadcastSelective_(*this, "TestSelectiveBroadcast", ""),
- testBroadcastWithOutArgsSelective_(*this, "TestBroadcastWithOutArgs", "us")
- {
- }
-
-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& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "testEmptyMethod",
- "",
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testEmptyMethodAsync(TestEmptyMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "testEmptyMethod",
- "",
- std::move(callback));
-}
-void TestInterfaceDBusProxy::testVoidPredefinedTypeMethod(const uint32_t& uint32Value, const std::string& stringValue, CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "testVoidPredefinedTypeMethod",
- "us",
- uint32Value, stringValue,
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testVoidPredefinedTypeMethodAsync(const uint32_t& uint32Value, const std::string& stringValue, TestVoidPredefinedTypeMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "testVoidPredefinedTypeMethod",
- "us",
- uint32Value, stringValue,
- std::move(callback));
-}
-void TestInterfaceDBusProxy::testPredefinedTypeMethod(const uint32_t& uint32InValue, const std::string& stringInValue, CommonAPI::CallStatus& callStatus, uint32_t& uint32OutValue, std::string& stringOutValue) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string> >::callMethodWithReply(
- *this,
- "testPredefinedTypeMethod",
- "us",
- uint32InValue, stringInValue,
- callStatus
- , uint32OutValue, stringOutValue);
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testPredefinedTypeMethodAsync(const uint32_t& uint32InValue, const std::string& stringInValue, TestPredefinedTypeMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string> >::callMethodAsync(
- *this,
- "testPredefinedTypeMethod",
- "us",
- uint32InValue, stringInValue,
- std::move(callback));
-}
-void TestInterfaceDBusProxy::testVoidDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "testVoidDerivedTypeMethod",
- "ia{ua(sq)}",
- testEnumExtended2Value, testMapValue,
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testVoidDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, TestVoidDerivedTypeMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "testVoidDerivedTypeMethod",
- "ia{ua(sq)}",
- testEnumExtended2Value, testMapValue,
- std::move(callback));
-}
-void TestInterfaceDBusProxy::testDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, CommonAPI::CallStatus& callStatus, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> >::callMethodWithReply(
- *this,
- "testDerivedTypeMethod",
- "ia{ua(sq)}",
- testEnumExtended2InValue, testMapInValue,
- callStatus
- , testEnumExtended2OutValue, testMapOutValue);
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, TestDerivedTypeMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> >::callMethodAsync(
- *this,
- "testDerivedTypeMethod",
- "ia{ua(sq)}",
- testEnumExtended2InValue, testMapInValue,
- std::move(callback));
-}
-void TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "TestArrayOfPolymorphicStructMethod",
- "a(uv)",
- inArray,
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, TestArrayOfPolymorphicStructMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "TestArrayOfPolymorphicStructMethod",
- "a(uv)",
- inArray,
- std::move(callback));
-}
-void TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethod(const DerivedTypeCollection::MapIntToPolymorphic& inMap, CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::MapIntToPolymorphic>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "TestMapOfPolymorphicStructMethod",
- "a{y(uv)}",
- inMap,
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethodAsync(const DerivedTypeCollection::MapIntToPolymorphic& inMap, TestMapOfPolymorphicStructMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::MapIntToPolymorphic>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "TestMapOfPolymorphicStructMethod",
- "a{y(uv)}",
- inMap,
- std::move(callback));
-}
-void TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethod(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::StructWithPolymorphicMember>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "TestStructWithPolymorphicMemberMethod",
- "(u(uv))",
- inStruct,
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethodAsync(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::StructWithPolymorphicMember>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "TestStructWithPolymorphicMemberMethod",
- "(u(uv))",
- inStruct,
- std::move(callback));
-}
-void TestInterfaceDBusProxy::TestStructWithEnumKeyMapMember(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::StructWithEnumKeyMap>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "TestStructWithEnumKeyMapMember",
- "(a{is})",
- inStruct,
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::StructWithEnumKeyMap>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "TestStructWithEnumKeyMapMember",
- "(a{is})",
- inStruct,
- std::move(callback));
-}
-
-
-
-void TestInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
-}
-
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.h b/src/test/commonapi/tests/TestInterfaceDBusProxy.h
deleted file mode 100644
index 3535339..0000000
--- a/src/test/commonapi/tests/TestInterfaceDBusProxy.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_H_
-
-#include <commonapi/tests/TestInterfaceProxyBase.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusAttribute.h>
-#include <CommonAPI/DBus/DBusEvent.h>
-#include <CommonAPI/types.h>
-#include <CommonAPI/DBus/DBusSelectiveEvent.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-
-class TestInterfaceDBusProxy: virtual public TestInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy {
- public:
- TestInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~TestInterfaceDBusProxy() { }
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute();
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute();
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute();
-
- virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent();
- virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent();
- virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent();
-
- virtual void testEmptyMethod(CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback callback);
- virtual void testVoidPredefinedTypeMethod(const uint32_t& uint32Value, const std::string& stringValue, CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> testVoidPredefinedTypeMethodAsync(const uint32_t& uint32Value, const std::string& stringValue, TestVoidPredefinedTypeMethodAsyncCallback callback);
- virtual void testPredefinedTypeMethod(const uint32_t& uint32InValue, const std::string& stringInValue, CommonAPI::CallStatus& callStatus, uint32_t& uint32OutValue, std::string& stringOutValue);
- virtual std::future<CommonAPI::CallStatus> testPredefinedTypeMethodAsync(const uint32_t& uint32InValue, const std::string& stringInValue, TestPredefinedTypeMethodAsyncCallback callback);
- virtual void testVoidDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> testVoidDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, TestVoidDerivedTypeMethodAsyncCallback callback);
- virtual void testDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, CommonAPI::CallStatus& callStatus, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue);
- virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, TestDerivedTypeMethodAsyncCallback callback);
- virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, TestArrayOfPolymorphicStructMethodAsyncCallback callback);
- virtual void TestMapOfPolymorphicStructMethod(const DerivedTypeCollection::MapIntToPolymorphic& inMap, CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> TestMapOfPolymorphicStructMethodAsync(const DerivedTypeCollection::MapIntToPolymorphic& inMap, TestMapOfPolymorphicStructMethodAsyncCallback callback);
- virtual void TestStructWithPolymorphicMemberMethod(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback callback);
- virtual void TestStructWithEnumKeyMapMember(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_;
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedStructAttributeAttribute>> testDerivedStructAttribute_;
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedArrayAttributeAttribute>> testDerivedArrayAttribute_;
-
- CommonAPI::DBus::DBusEvent<TestPredefinedTypeBroadcastEvent> testPredefinedTypeBroadcast_;
- CommonAPI::DBus::DBusSelectiveEvent<TestSelectiveBroadcastSelectiveEvent> testSelectiveBroadcastSelective_;
- CommonAPI::DBus::DBusSelectiveEvent<TestBroadcastWithOutArgsSelectiveEvent> testBroadcastWithOutArgsSelective_;
-
-};
-
-
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/TestInterfaceProxyBase.h b/src/test/commonapi/tests/TestInterfaceProxyBase.h
deleted file mode 100644
index 7c31463..0000000
--- a/src/test/commonapi/tests/TestInterfaceProxyBase.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Interface_PROXY_BASE_H_
-#define COMMONAPI_TESTS_Test_Interface_PROXY_BASE_H_
-
-#include "TestInterface.h"
-
-
-#include <commonapi/tests/DerivedTypeCollection.h>
-#include <commonapi/tests/PredefinedTypeCollection.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.h>
-#include <CommonAPI/OutputStream.h>
-#include <CommonAPI/SerializableStruct.h>
-#include <cstdint>
-#include <unordered_map>
-#include <vector>
-
-#include <CommonAPI/Attribute.h>
-#include <CommonAPI/Event.h>
-#include <CommonAPI/SelectiveEvent.h>
-#include <CommonAPI/Proxy.h>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-class TestInterfaceProxyBase: virtual public CommonAPI::Proxy {
- public:
- typedef CommonAPI::ObservableAttribute<uint32_t> TestPredefinedTypeAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<DerivedTypeCollection::TestStructExtended> TestDerivedStructAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<DerivedTypeCollection::TestArrayUInt64> TestDerivedArrayAttributeAttribute;
- typedef CommonAPI::Event<uint32_t, std::string> TestPredefinedTypeBroadcastEvent;
- typedef CommonAPI::SelectiveEvent<> TestSelectiveBroadcastSelectiveEvent;
- typedef CommonAPI::SelectiveEvent<uint32_t, std::string> TestBroadcastWithOutArgsSelectiveEvent;
-
- typedef std::function<void(const CommonAPI::CallStatus&)> TestEmptyMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestVoidPredefinedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, const uint32_t&, const std::string&)> TestPredefinedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestVoidDerivedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, const DerivedTypeCollection::TestEnumExtended2&, const DerivedTypeCollection::TestMap&)> TestDerivedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestArrayOfPolymorphicStructMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestMapOfPolymorphicStructMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestStructWithPolymorphicMemberMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestStructWithEnumKeyMapMemberAsyncCallback;
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() = 0;
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() = 0;
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() = 0;
-
- virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent() = 0;
- virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent() = 0;
- virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent() = 0;
-
- virtual void testEmptyMethod(CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback callback) = 0;
- virtual void testVoidPredefinedTypeMethod(const uint32_t& uint32Value, const std::string& stringValue, CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> testVoidPredefinedTypeMethodAsync(const uint32_t& uint32Value, const std::string& stringValue, TestVoidPredefinedTypeMethodAsyncCallback callback) = 0;
- virtual void testPredefinedTypeMethod(const uint32_t& uint32InValue, const std::string& stringInValue, CommonAPI::CallStatus& callStatus, uint32_t& uint32OutValue, std::string& stringOutValue) = 0;
- virtual std::future<CommonAPI::CallStatus> testPredefinedTypeMethodAsync(const uint32_t& uint32InValue, const std::string& stringInValue, TestPredefinedTypeMethodAsyncCallback callback) = 0;
- virtual void testVoidDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> testVoidDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, TestVoidDerivedTypeMethodAsyncCallback callback) = 0;
- virtual void testDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, CommonAPI::CallStatus& callStatus, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) = 0;
- virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, TestDerivedTypeMethodAsyncCallback callback) = 0;
- virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, TestArrayOfPolymorphicStructMethodAsyncCallback callback) = 0;
- virtual void TestMapOfPolymorphicStructMethod(const DerivedTypeCollection::MapIntToPolymorphic& inMap, CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> TestMapOfPolymorphicStructMethodAsync(const DerivedTypeCollection::MapIntToPolymorphic& inMap, TestMapOfPolymorphicStructMethodAsyncCallback callback) = 0;
- virtual void TestStructWithPolymorphicMemberMethod(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback callback) = 0;
- virtual void TestStructWithEnumKeyMapMember(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback) = 0;
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Interface_PROXY_BASE_H_
diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp
deleted file mode 100644
index 764e1b8..0000000
--- a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include <commonapi/tests/TestInterfaceStubDefault.h>
-
-namespace commonapi {
-namespace tests {
-
-TestInterfaceStubDefault::TestInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(TestInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& TestInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
- return interfaceVersion_;
-}
-
-TestInterfaceStubRemoteEvent* TestInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter) {
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
- return &remoteEventHandler_;
-}
-
-const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute() {
- return testPredefinedTypeAttributeAttributeValue_;
-}
-
-const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestPredefinedTypeAttributeAttribute();
-}
-
-void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(uint32_t value) {
- const bool valueChanged = trySetTestPredefinedTypeAttributeAttribute(std::move(value));
- if (valueChanged && stubAdapter_ != NULL) {
- stubAdapter_->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
- }
-}
-
-bool TestInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t value) {
- if (!validateTestPredefinedTypeAttributeAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testPredefinedTypeAttributeAttributeValue_ != value);
- testPredefinedTypeAttributeAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t& value) {
- return true;
-}
-
-void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) {
- setTestPredefinedTypeAttributeAttribute(value);
-}
-
-void TestInterfaceStubDefault::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- defaultStub_->onRemoteTestPredefinedTypeAttributeAttributeChanged();
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t value) {
- return defaultStub_->trySetTestPredefinedTypeAttributeAttribute(std::move(value));
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) {
- return onRemoteSetTestPredefinedTypeAttributeAttribute(value);
-}
-
-const DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTestDerivedStructAttributeAttribute() {
- return testDerivedStructAttributeAttributeValue_;
-}
-
-const DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestDerivedStructAttributeAttribute();
-}
-
-void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) {
- const bool valueChanged = trySetTestDerivedStructAttributeAttribute(std::move(value));
- if (valueChanged && stubAdapter_ != NULL) {
- stubAdapter_->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
- }
-}
-
-bool TestInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) {
- if (!validateTestDerivedStructAttributeAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testDerivedStructAttributeAttributeValue_ != value);
- testDerivedStructAttributeAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestInterfaceStubDefault::validateTestDerivedStructAttributeAttributeRequestedValue(const DerivedTypeCollection::TestStructExtended& value) {
- return true;
-}
-
-void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) {
- setTestDerivedStructAttributeAttribute(value);
-}
-
-void TestInterfaceStubDefault::onRemoteTestDerivedStructAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedStructAttributeAttributeChanged() {
- defaultStub_->onRemoteTestDerivedStructAttributeAttributeChanged();
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) {
- return defaultStub_->trySetTestDerivedStructAttributeAttribute(std::move(value));
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) {
- return onRemoteSetTestDerivedStructAttributeAttribute(value);
-}
-
-const DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestDerivedArrayAttributeAttribute() {
- return testDerivedArrayAttributeAttributeValue_;
-}
-
-const DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- return getTestDerivedArrayAttributeAttribute();
-}
-
-void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) {
- const bool valueChanged = trySetTestDerivedArrayAttributeAttribute(std::move(value));
- if (valueChanged && stubAdapter_ != NULL) {
- stubAdapter_->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
- }
-}
-
-bool TestInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) {
- if (!validateTestDerivedArrayAttributeAttributeRequestedValue(value))
- return false;
-
- const bool valueChanged = (testDerivedArrayAttributeAttributeValue_ != value);
- testDerivedArrayAttributeAttributeValue_ = std::move(value);
- return valueChanged;
-}
-
-bool TestInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value) {
- return true;
-}
-
-void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) {
- setTestDerivedArrayAttributeAttribute(value);
-}
-
-void TestInterfaceStubDefault::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- defaultStub_->onRemoteTestDerivedArrayAttributeAttributeChanged();
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) {
- return defaultStub_->trySetTestDerivedArrayAttributeAttribute(std::move(value));
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) {
- return onRemoteSetTestDerivedArrayAttributeAttribute(value);
-}
-
-
-void TestInterfaceStubDefault::testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- // Call old style methods in default
- testEmptyMethod();
-}
-void TestInterfaceStubDefault::testEmptyMethod() {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32Value, std::string stringValue) {
- // Call old style methods in default
- testVoidPredefinedTypeMethod(uint32Value, stringValue);
-}
-void TestInterfaceStubDefault::testVoidPredefinedTypeMethod(uint32_t uint32Value, std::string stringValue) {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue) {
- // Call old style methods in default
- testPredefinedTypeMethod(uint32InValue, stringInValue, uint32OutValue, stringOutValue);
-}
-void TestInterfaceStubDefault::testPredefinedTypeMethod(uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue) {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue) {
- // Call old style methods in default
- testVoidDerivedTypeMethod(testEnumExtended2Value, testMapValue);
-}
-void TestInterfaceStubDefault::testVoidDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue) {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) {
- // Call old style methods in default
- testDerivedTypeMethod(testEnumExtended2InValue, testMapInValue, testEnumExtended2OutValue, testMapOutValue);
-}
-void TestInterfaceStubDefault::testDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>> inArray) {
- // Call old style methods in default
- TestArrayOfPolymorphicStructMethod(inArray);
-}
-void TestInterfaceStubDefault::TestArrayOfPolymorphicStructMethod(std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>> inArray) {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::MapIntToPolymorphic inMap) {
- // Call old style methods in default
- TestMapOfPolymorphicStructMethod(inMap);
-}
-void TestInterfaceStubDefault::TestMapOfPolymorphicStructMethod(DerivedTypeCollection::MapIntToPolymorphic inMap) {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::StructWithPolymorphicMember inStruct) {
- // Call old style methods in default
- TestStructWithPolymorphicMemberMethod(inStruct);
-}
-void TestInterfaceStubDefault::TestStructWithPolymorphicMemberMethod(DerivedTypeCollection::StructWithPolymorphicMember inStruct) {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::StructWithEnumKeyMap inStruct) {
- // Call old style methods in default
- TestStructWithEnumKeyMapMember(inStruct);
-}
-void TestInterfaceStubDefault::TestStructWithEnumKeyMapMember(DerivedTypeCollection::StructWithEnumKeyMap inStruct) {
- // No operation in default
-}
-
-
-void TestInterfaceStubDefault::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) {
- stubAdapter_->fireTestPredefinedTypeBroadcastEvent(uint32Value, stringValue);
-}
-void TestInterfaceStubDefault::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) {
- stubAdapter_->sendTestSelectiveBroadcastSelective(receivers);
-}
-void TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) {
- // No operation in default
-}
-bool TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- // Accept in default
- return true;
-}
-std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestSelectiveBroadcastSelective() {
- return(stubAdapter_->getSubscribersForTestSelectiveBroadcastSelective());
-}
-
-void TestInterfaceStubDefault::fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) {
- stubAdapter_->sendTestBroadcastWithOutArgsSelective(uint32Value, stringValue, receivers);
-}
-void TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) {
- // No operation in default
-}
-bool TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- // Accept in default
- return true;
-}
-std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestBroadcastWithOutArgsSelective() {
- return(stubAdapter_->getSubscribersForTestBroadcastWithOutArgsSelective());
-}
-
-
-
-TestInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestInterfaceStubDefault* defaultStub):
- defaultStub_(defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.h b/src/test/commonapi/tests/TestInterfaceStubDefault.h
deleted file mode 100644
index e24ecdb..0000000
--- a/src/test/commonapi/tests/TestInterfaceStubDefault.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_H_
-
-
-#include <commonapi/tests/TestInterfaceStub.h>
-#include <sstream>
-
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for TestInterfaceStubRemoteEvent and
- * TestInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class TestInterfaceStubDefault : public virtual TestInterfaceStub {
-public:
- TestInterfaceStubDefault();
-
- TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
-
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute();
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestPredefinedTypeAttributeAttribute(uint32_t value);
- virtual void setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value);
- virtual const DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute();
- virtual const DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
- virtual void setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value);
- virtual const DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute();
- virtual const DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
- virtual void setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value);
-
- virtual void testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void testEmptyMethod();
-
- virtual void testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32Value, std::string stringValue);
- virtual void testVoidPredefinedTypeMethod(uint32_t uint32Value, std::string stringValue);
-
- virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue);
- virtual void testPredefinedTypeMethod(uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue);
-
- virtual void testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue);
- virtual void testVoidDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue);
-
- virtual void testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue);
- virtual void testDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue);
-
- virtual void TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>> inArray);
- virtual void TestArrayOfPolymorphicStructMethod(std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>> inArray);
-
- virtual void TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::MapIntToPolymorphic inMap);
- virtual void TestMapOfPolymorphicStructMethod(DerivedTypeCollection::MapIntToPolymorphic inMap);
-
- virtual void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::StructWithPolymorphicMember inStruct);
- virtual void TestStructWithPolymorphicMemberMethod(DerivedTypeCollection::StructWithPolymorphicMember inStruct);
-
- virtual void TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::StructWithEnumKeyMap inStruct);
- virtual void TestStructWithEnumKeyMapMember(DerivedTypeCollection::StructWithEnumKeyMap inStruct);
-
-
- virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue);
- virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL);
- virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective();
- /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event);
- /// Hook method for reacting accepting or denying new subscriptions
- virtual bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL);
- virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective();
- /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event);
- /// Hook method for reacting accepting or denying new subscriptions
- virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId);
-
-
-protected:
- virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t value);
- virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t& value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
- virtual bool trySetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
- virtual bool validateTestDerivedStructAttributeAttributeRequestedValue(const DerivedTypeCollection::TestStructExtended& value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
- virtual bool trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
- virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
- class RemoteEventHandler: public virtual TestInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(TestInterfaceStubDefault* defaultStub);
-
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t value);
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
-
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
-
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
-
-
- private:
- TestInterfaceStubDefault* defaultStub_;
- };
-private:
- TestInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
- uint32_t testPredefinedTypeAttributeAttributeValue_;
- DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_;
- DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_;
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_H_
diff --git a/src/test/commonapi/tests/managed/BranchInterface.h b/src/test/commonapi/tests/managed/BranchInterface.h
deleted file mode 100644
index dbf34b2..0000000
--- a/src/test/commonapi/tests/managed/BranchInterface.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_H_
-#define COMMONAPI_TESTS_MANAGED_Branch_Interface_H_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.h>
-#include <CommonAPI/OutputStream.h>
-#include <CommonAPI/types.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class BranchInterface {
- public:
- virtual ~BranchInterface() { }
-
- static inline const char* getInterfaceId();
- static inline CommonAPI::Version getInterfaceVersion();
- enum class testBranchMethodError: int32_t {
- OK,
- NOTOK
- };
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct testBranchMethodErrorComparator;
-};
-
-const char* BranchInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.managed.BranchInterface";
- return interfaceId;
-}
-
-CommonAPI::Version BranchInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, BranchInterface::testBranchMethodError& enumValue) {
- return inputStream.readEnumValue<int32_t>(enumValue);
-}
-
-inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const BranchInterface::testBranchMethodError& enumValue) {
- return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
-}
-
-struct BranchInterface::testBranchMethodErrorComparator {
- inline bool operator()(const testBranchMethodError& lhs, const testBranchMethodError& rhs) const {
- return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
- }
-};
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
- //Hash for testBranchMethodError
- template<>
- struct hash<commonapi::tests::managed::BranchInterface::testBranchMethodError> {
- inline size_t operator()(const commonapi::tests::managed::BranchInterface::testBranchMethodError& testBranchMethodError) const {
- return static_cast<int32_t>(testBranchMethodError);
- }
- };
-}
-
-#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_H_
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
deleted file mode 100644
index 4757c27..0000000
--- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "BranchInterfaceDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createBranchInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<BranchInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerBranchInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(BranchInterface::getInterfaceId(),
- &createBranchInterfaceDBusProxy);
-}
-
-BranchInterfaceDBusProxy::BranchInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
- {
- }
-
-
-
-void BranchInterfaceDBusProxy::testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<BranchInterface::testBranchMethodError, int32_t, std::string> >::callMethodWithReply(
- *this,
- "testBranchMethod",
- "is",
- inInt, inString,
- callStatus,
- methodError
- , outInt, outString);
-}
-std::future<CommonAPI::CallStatus> BranchInterfaceDBusProxy::testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<BranchInterface::testBranchMethodError, int32_t, std::string> >::callMethodAsync(
- *this,
- "testBranchMethod",
- "is",
- inInt, inString,
- std::move(callback));
-}
-
-
-
-void BranchInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h
deleted file mode 100644
index 455ab57..0000000
--- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_H_
-
-#include <commonapi/tests/managed/BranchInterfaceProxyBase.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class BranchInterfaceDBusProxy: virtual public BranchInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy {
- public:
- BranchInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~BranchInterfaceDBusProxy() { }
-
-
-
- virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString);
- virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
-
-
-};
-
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h
deleted file mode 100644
index d0a1d24..0000000
--- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_H_
-
-#include <commonapi/tests/managed/BranchInterfaceStub.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<BranchInterfaceStub> BranchInterfaceDBusStubAdapterHelper;
-
-class BranchInterfaceDBusStubAdapterInternal: public virtual BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper {
- public:
- BranchInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
-
- ~BranchInterfaceDBusStubAdapterInternal();
-
- virtual const bool hasFreedesktopProperties();
-
-
-
-
- const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- BranchInterfaceStub,
- CommonAPI::Version
- > getBranchInterfaceInterfaceVersionStubDispatcher;
-
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- BranchInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string>
- > testBranchMethodStubDispatcher;
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class BranchInterfaceDBusStubAdapter: public BranchInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<BranchInterfaceDBusStubAdapter> {
-public:
- BranchInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- BranchInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_H_
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h
deleted file mode 100644
index 9ca826a..0000000
--- a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_H_
-#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_H_
-
-#include "BranchInterface.h"
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.h>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class BranchInterfaceProxyBase: virtual public CommonAPI::Proxy {
- public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const BranchInterface::testBranchMethodError&, const int32_t&, const std::string&)> TestBranchMethodAsyncCallback;
-
-
-
- virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) = 0;
- virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback) = 0;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_H_
diff --git a/src/test/commonapi/tests/managed/LeafInterface.h b/src/test/commonapi/tests/managed/LeafInterface.h
deleted file mode 100644
index 389f805..0000000
--- a/src/test/commonapi/tests/managed/LeafInterface.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_H_
-#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_H_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.h>
-#include <CommonAPI/OutputStream.h>
-#include <CommonAPI/types.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class LeafInterface {
- public:
- virtual ~LeafInterface() { }
-
- static inline const char* getInterfaceId();
- static inline CommonAPI::Version getInterfaceVersion();
- enum class testLeafMethodError: int32_t {
- OK,
- NOTOK
- };
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct testLeafMethodErrorComparator;
-};
-
-const char* LeafInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.managed.LeafInterface";
- return interfaceId;
-}
-
-CommonAPI::Version LeafInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, LeafInterface::testLeafMethodError& enumValue) {
- return inputStream.readEnumValue<int32_t>(enumValue);
-}
-
-inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const LeafInterface::testLeafMethodError& enumValue) {
- return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
-}
-
-struct LeafInterface::testLeafMethodErrorComparator {
- inline bool operator()(const testLeafMethodError& lhs, const testLeafMethodError& rhs) const {
- return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
- }
-};
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
- //Hash for testLeafMethodError
- template<>
- struct hash<commonapi::tests::managed::LeafInterface::testLeafMethodError> {
- inline size_t operator()(const commonapi::tests::managed::LeafInterface::testLeafMethodError& testLeafMethodError) const {
- return static_cast<int32_t>(testLeafMethodError);
- }
- };
-}
-
-#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_H_
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
deleted file mode 100644
index 4616c17..0000000
--- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "LeafInterfaceDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createLeafInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<LeafInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerLeafInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(LeafInterface::getInterfaceId(),
- &createLeafInterfaceDBusProxy);
-}
-
-LeafInterfaceDBusProxy::LeafInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
- {
- }
-
-
-
-void LeafInterfaceDBusProxy::testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<LeafInterface::testLeafMethodError, int32_t, std::string> >::callMethodWithReply(
- *this,
- "testLeafMethod",
- "is",
- inInt, inString,
- callStatus,
- methodError
- , outInt, outString);
-}
-std::future<CommonAPI::CallStatus> LeafInterfaceDBusProxy::testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<LeafInterface::testLeafMethodError, int32_t, std::string> >::callMethodAsync(
- *this,
- "testLeafMethod",
- "is",
- inInt, inString,
- std::move(callback));
-}
-
-
-
-void LeafInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h
deleted file mode 100644
index ae3f94e..0000000
--- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_H_
-
-#include <commonapi/tests/managed/LeafInterfaceProxyBase.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class LeafInterfaceDBusProxy: virtual public LeafInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy {
- public:
- LeafInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~LeafInterfaceDBusProxy() { }
-
-
-
- virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString);
- virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
-
-
-};
-
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h
deleted file mode 100644
index 6930bda..0000000
--- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_H_
-
-#include <commonapi/tests/managed/LeafInterfaceStub.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<LeafInterfaceStub> LeafInterfaceDBusStubAdapterHelper;
-
-class LeafInterfaceDBusStubAdapterInternal: public virtual LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper {
- public:
- LeafInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
-
- ~LeafInterfaceDBusStubAdapterInternal();
-
- virtual const bool hasFreedesktopProperties();
-
-
-
-
- const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- LeafInterfaceStub,
- CommonAPI::Version
- > getLeafInterfaceInterfaceVersionStubDispatcher;
-
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LeafInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string>
- > testLeafMethodStubDispatcher;
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class LeafInterfaceDBusStubAdapter: public LeafInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<LeafInterfaceDBusStubAdapter> {
-public:
- LeafInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- LeafInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_H_
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h b/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h
deleted file mode 100644
index 7dfc1e2..0000000
--- a/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_H_
-#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_H_
-
-#include "LeafInterface.h"
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.h>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class LeafInterfaceProxyBase: virtual public CommonAPI::Proxy {
- public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const LeafInterface::testLeafMethodError&, const int32_t&, const std::string&)> TestLeafMethodAsyncCallback;
-
-
-
- virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) = 0;
- virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback) = 0;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_H_
diff --git a/src/test/commonapi/tests/managed/RootInterface.h b/src/test/commonapi/tests/managed/RootInterface.h
deleted file mode 100644
index b1e9758..0000000
--- a/src/test/commonapi/tests/managed/RootInterface.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_H_
-#define COMMONAPI_TESTS_MANAGED_Root_Interface_H_
-
-
-#include <set>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.h>
-#include <CommonAPI/OutputStream.h>
-#include <CommonAPI/types.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class RootInterface {
- public:
- virtual ~RootInterface() { }
-
- static inline const char* getInterfaceId();
- static inline CommonAPI::Version getInterfaceVersion();
- enum class testRootMethodError: int32_t {
- OK,
- NOTOK
- };
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct testRootMethodErrorComparator;
-};
-
-const char* RootInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.managed.RootInterface";
- return interfaceId;
-}
-
-CommonAPI::Version RootInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, RootInterface::testRootMethodError& enumValue) {
- return inputStream.readEnumValue<int32_t>(enumValue);
-}
-
-inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const RootInterface::testRootMethodError& enumValue) {
- return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
-}
-
-struct RootInterface::testRootMethodErrorComparator {
- inline bool operator()(const testRootMethodError& lhs, const testRootMethodError& rhs) const {
- return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
- }
-};
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
- //Hash for testRootMethodError
- template<>
- struct hash<commonapi::tests::managed::RootInterface::testRootMethodError> {
- inline size_t operator()(const commonapi::tests::managed::RootInterface::testRootMethodError& testRootMethodError) const {
- return static_cast<int32_t>(testRootMethodError);
- }
- };
-}
-
-#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_H_
diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
deleted file mode 100644
index 1c4e8c8..0000000
--- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "RootInterfaceDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createRootInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<RootInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerRootInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(RootInterface::getInterfaceId(),
- &createRootInterfaceDBusProxy);
-}
-
-RootInterfaceDBusProxy::RootInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
-, proxyManagerLeafInterface_(*this, "commonapi.tests.managed.LeafInterface", factory),
- proxyManagerBranchInterface_(*this, "commonapi.tests.managed.BranchInterface", factory)
- {
- }
-
-
-
-void RootInterfaceDBusProxy::testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<RootInterface::testRootMethodError, int32_t, std::string> >::callMethodWithReply(
- *this,
- "testRootMethod",
- "is",
- inInt, inString,
- callStatus,
- methodError
- , outInt, outString);
-}
-std::future<CommonAPI::CallStatus> RootInterfaceDBusProxy::testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
- CommonAPI::DBus::DBusSerializableArguments<RootInterface::testRootMethodError, int32_t, std::string> >::callMethodAsync(
- *this,
- "testRootMethod",
- "is",
- inInt, inString,
- std::move(callback));
-}
-
-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
diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h
deleted file mode 100644
index a97f47c..0000000
--- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_H_
-
-#include <commonapi/tests/managed/RootInterfaceProxyBase.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusProxyManager.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class RootInterfaceDBusProxy: virtual public RootInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy {
- public:
- RootInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~RootInterfaceDBusProxy() { }
-
-
-
- virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString);
- virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback);
-
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
- virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface();
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
-
-
- CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
- CommonAPI::DBus::DBusProxyManager proxyManagerBranchInterface_;
-};
-
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index e5e8f7c..0000000
--- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "RootInterfaceDBusStubAdapter.h"
-#include <commonapi/tests/managed/RootInterface.h>
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
-}
-
-INITIALIZER(registerRootInterfaceDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(),
- &createRootInterfaceDBusStubAdapter);
-}
-
-
-
-RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- RootInterfaceDBusStubAdapterHelper::deinit();
-}
-
-void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
- std::set<std::string>::iterator iter;
- std::set<std::string>::iterator iterNext;
-
- iter = registeredLeafInterfaceInstances.begin();
- while (iter != registeredLeafInterfaceInstances.end()) {
- iterNext = std::next(iter);
-
- if (deregisterManagedStubLeafInterface(*iter)) {
- iter = iterNext;
- }
- else {
- iter++;
- }
- }
- iter = registeredBranchInterfaceInstances.begin();
- while (iter != registeredBranchInterfaceInstances.end()) {
- iterNext = std::next(iter);
-
- if (deregisterManagedStubBranchInterface(*iter)) {
- iter = iterNext;
- }
- else {
- iter++;
- }
- }
-}
-
-const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
- static const std::string introspectionData =
- "<method name=\"getInterfaceVersion\">\n"
- "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
- "</method>\n"
- "<method name=\"testRootMethod\">\n"
- "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n"
- "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n"
- "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n"
- "</method>\n"
-
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- RootInterfaceStub,
- CommonAPI::Version
- > RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu");
-
-
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- RootInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<RootInterface::testRootMethodError, int32_t, std::string>
- > RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis");
-
-
-
-
-
-const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& RootInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
- bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) {
- if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) {
- std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance;
-
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
-
- CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress(
- commonApiAddress,
- interfaceName,
- connectionName,
- objectPath);
-
- if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) {
- auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface",
- instance, "commonapi.tests.managed.LeafInterface", "local");
-
- bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter);
- if (success) {
- bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter);
- if (isServiceExportSuccessful) {
- registeredLeafInterfaceInstances.insert(instance);
- return true;
- } else {
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress);
- }
- }
- }
- }
- return false;
- }
-
- bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) {
- std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance;
- if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) {
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter =
- CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress);
- if (dbusStubAdapter != nullptr) {
- dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress);
- registeredLeafInterfaceInstances.erase(instance);
- return true;
- }
- }
- return false;
- }
-
- std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() {
- return registeredLeafInterfaceInstances;
- }
-
- bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) {
- if (registeredBranchInterfaceInstances.find(instance) == registeredBranchInterfaceInstances.end()) {
- std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance;
-
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
-
- CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress(
- commonApiAddress,
- interfaceName,
- connectionName,
- objectPath);
-
- if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) {
- auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.BranchInterface",
- instance, "commonapi.tests.managed.BranchInterface", "local");
-
- bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter);
- if (success) {
- bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter);
- if (isServiceExportSuccessful) {
- registeredBranchInterfaceInstances.insert(instance);
- return true;
- } else {
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress);
- }
- }
- }
- }
- return false;
- }
-
- bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string& instance) {
- std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance;
- if (registeredBranchInterfaceInstances.find(instance) != registeredBranchInterfaceInstances.end()) {
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter =
- CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress);
- if (dbusStubAdapter != nullptr) {
- dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress);
- registeredBranchInterfaceInstances.erase(instance);
- return true;
- }
- }
- return false;
- }
-
- std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() {
- return registeredBranchInterfaceInstances;
- }
-
-RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- true),
- RootInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<RootInterfaceStub>(stub),
- true),
- stubDispatcherTable_({
- { { "testRootMethod", "is" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher }
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher });
-}
-
-const bool RootInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h
deleted file mode 100644
index e3379e9..0000000
--- a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_H_
-#define COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_H_
-
-#include "RootInterface.h"
-
-
-#include <commonapi/tests/managed/BranchInterfaceStub.h>
-#include <commonapi/tests/managed/LeafInterfaceStub.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/ProxyManager.h>
-#include <CommonAPI/Proxy.h>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class RootInterfaceProxyBase: virtual public CommonAPI::Proxy {
- public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const RootInterface::testRootMethodError&, const int32_t&, const std::string&)> TestRootMethodAsyncCallback;
-
-
-
- virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) = 0;
- virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback) = 0;
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface() = 0;
- virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface() = 0;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_H_
diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp
deleted file mode 100644
index 8866718..0000000
--- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include <commonapi/tests/managed/RootInterfaceStubDefault.h>
-
-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> clientId) {
- return interfaceVersion_;
-}
-
-RootInterfaceStubRemoteEvent* RootInterfaceStubDefault::initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter) {
- CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
- return &remoteEventHandler_;
-}
-
-
-void RootInterfaceStubDefault::testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) {
- // Call old style methods in default
- testRootMethod(inInt, inString, methodError, outInt, outString);
-}
-void RootInterfaceStubDefault::testRootMethod(int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) {
- // No operation in default
-}
-
-
-
-bool RootInterfaceStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub> stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- ss << stubAdapter_->getInstanceId() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- return stubAdapter_->registerManagedStubLeafInterface(stub, instance);
-}
-bool RootInterfaceStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) {
- return stubAdapter_->registerManagedStubLeafInterface(stub, instance);
-}
-bool RootInterfaceStubDefault::deregisterManagedStubLeafInterface(const std::string& instance) {
- return stubAdapter_->deregisterManagedStubLeafInterface(instance);
-}
-std::set<std::string>& RootInterfaceStubDefault::getLeafInterfaceInstances() {
- return stubAdapter_->getLeafInterfaceInstances();
-}
-bool RootInterfaceStubDefault::registerManagedStubBranchInterfaceAutoInstance(std::shared_ptr<BranchInterfaceStub> stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- ss << stubAdapter_->getInstanceId() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- return stubAdapter_->registerManagedStubBranchInterface(stub, instance);
-}
-bool RootInterfaceStubDefault::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) {
- return stubAdapter_->registerManagedStubBranchInterface(stub, instance);
-}
-bool RootInterfaceStubDefault::deregisterManagedStubBranchInterface(const std::string& instance) {
- return stubAdapter_->deregisterManagedStubBranchInterface(instance);
-}
-std::set<std::string>& RootInterfaceStubDefault::getBranchInterfaceInstances() {
- return stubAdapter_->getBranchInterfaceInstances();
-}
-
-RootInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(RootInterfaceStubDefault* defaultStub):
- defaultStub_(defaultStub) {
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp
deleted file mode 100644
index 25e0588..0000000
--- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "SecondRootDBusProxy.h"
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createSecondRootDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<SecondRootDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerSecondRootDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(SecondRoot::getInterfaceId(),
- &createSecondRootDBusProxy);
-}
-
-SecondRootDBusProxy::SecondRootDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
-, proxyManagerLeafInterface_(*this, "commonapi.tests.managed.LeafInterface", factory)
- {
- }
-
-
-
-
-CommonAPI::ProxyManager& SecondRootDBusProxy::getProxyManagerLeafInterface() {
- return proxyManagerLeafInterface_;
-}
-
-
-void SecondRootDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h
deleted file mode 100644
index 3d5dc51..0000000
--- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_H_
-
-#include <commonapi/tests/managed/SecondRootProxyBase.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-#include <CommonAPI/DBus/DBusProxyManager.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class SecondRootDBusProxy: virtual public SecondRootProxyBase, virtual public CommonAPI::DBus::DBusProxy {
- public:
- SecondRootDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~SecondRootDBusProxy() { }
-
-
-
-
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
-
-
- CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
-};
-
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_H_
diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
deleted file mode 100644
index d96bcf8..0000000
--- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "SecondRootDBusStubAdapter.h"
-#include <commonapi/tests/managed/SecondRoot.h>
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
-}
-
-INITIALIZER(registerSecondRootDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(),
- &createSecondRootDBusStubAdapter);
-}
-
-
-
-SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() {
- deactivateManagedInstances();
- SecondRootDBusStubAdapterHelper::deinit();
-}
-
-void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() {
- std::set<std::string>::iterator iter;
- std::set<std::string>::iterator iterNext;
-
- iter = registeredLeafInterfaceInstances.begin();
- while (iter != registeredLeafInterfaceInstances.end()) {
- iterNext = std::next(iter);
-
- if (deregisterManagedStubLeafInterface(*iter)) {
- iter = iterNext;
- }
- else {
- iter++;
- }
- }
-}
-
-const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
- static const std::string introspectionData =
- "<method name=\"getInterfaceVersion\">\n"
- "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
- "</method>\n"
-
- ""
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- SecondRootStub,
- CommonAPI::Version
- > SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu");
-
-
-
-
-
-
-
-
-const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& SecondRootDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
- bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) {
- if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) {
- std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance;
-
- std::string interfaceName;
- std::string connectionName;
- std::string objectPath;
-
- CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress(
- commonApiAddress,
- interfaceName,
- connectionName,
- objectPath);
-
- if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) {
- auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface",
- instance, "commonapi.tests.managed.LeafInterface", "local");
-
- bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter);
- if (success) {
- bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter);
- if (isServiceExportSuccessful) {
- registeredLeafInterfaceInstances.insert(instance);
- return true;
- } else {
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress);
- }
- }
- }
- }
- return false;
- }
-
- bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) {
- std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance;
- if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) {
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter =
- CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress);
- if (dbusStubAdapter != nullptr) {
- dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter);
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress);
- registeredLeafInterfaceInstances.erase(instance);
- return true;
- }
- }
- return false;
- }
-
- std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() {
- return registeredLeafInterfaceInstances;
- }
-
-SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- true),
- SecondRootDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<SecondRootStub>(stub),
- true),
- stubDispatcherTable_({
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher });
-}
-
-const bool SecondRootDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h
deleted file mode 100644
index 604b552..0000000
--- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_H_
-
-#include <commonapi/tests/managed/SecondRootStub.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<SecondRootStub> SecondRootDBusStubAdapterHelper;
-
-class SecondRootDBusStubAdapterInternal: public virtual SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper {
- public:
- SecondRootDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
-
- ~SecondRootDBusStubAdapterInternal();
-
- virtual const bool hasFreedesktopProperties();
-
-
-
- bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&);
- bool deregisterManagedStubLeafInterface(const std::string&);
- std::set<std::string>& getLeafInterfaceInstances();
-
- const SecondRootDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- SecondRootStub,
- CommonAPI::Version
- > getSecondRootInterfaceVersionStubDispatcher;
-
-
-
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- std::set<std::string> registeredLeafInterfaceInstances;
- SecondRootDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class SecondRootDBusStubAdapter: public SecondRootDBusStubAdapterInternal, public std::enable_shared_from_this<SecondRootDBusStubAdapter> {
-public:
- SecondRootDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- true),
- SecondRootDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_H_
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp
index a21a99c..ba9e0d4 100644
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp
+++ b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp
@@ -10,6 +10,7 @@
#include "DBusDynamicLoadingDefinitions.h"
+#define VERSION v1_0
class Environment: public ::testing::Environment {
public:
@@ -22,7 +23,14 @@ public:
char* environment = (char*) (environmentString_.c_str());
putenv(environment);
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
+#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());
@@ -53,16 +61,16 @@ class DBusDynamicLoadingBasicTest: public ::testing::Test {
};
TEST_F(DBusDynamicLoadingBasicTest, LoadsUnconfiguredDefaultDynamicallyLinkedLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ 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::load();
+ 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::load("DBus");
+ std::shared_ptr<CommonAPI::Runtime> dbusRuntime = CommonAPI::Runtime::get();
EXPECT_TRUE((bool)defaultRuntime);
EXPECT_TRUE((bool)dbusRuntime);
@@ -71,14 +79,14 @@ TEST_F(DBusDynamicLoadingBasicTest, LoadsSpecificDynamicallyLinkedDBusLibrary) {
}
TEST_F(DBusDynamicLoadingBasicTest, LoadsAliasedDynamicallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("MyFirstAlias");
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
EXPECT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::load("MySecondAlias");
+ 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::load("NonExisting");
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
EXPECT_FALSE((bool)runtime);
}
@@ -86,10 +94,10 @@ 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::load();
- 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();
+ 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);
@@ -105,96 +113,65 @@ TEST_F(DBusDynamicLoadingBasicTest, LoadsDBusLibraryAsSingleton) {
}
TEST_F(DBusDynamicLoadingBasicTest, RuntimeLoadsFactory) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
}
TEST_F(DBusDynamicLoadingBasicTest, RuntimeLoadsServicePublisher) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- EXPECT_TRUE((bool)servicePublisher);
}
TEST_F(DBusDynamicLoadingBasicTest, FactoryCanCreateProxies) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(testServiceAddress);
+ 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::load("DBus");
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(testServiceAddress);
+ 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::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Factory> serviceFactory = runtime->createFactory();
- ASSERT_TRUE((bool)serviceFactory);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher);
+ auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
-
- EXPECT_TRUE(servicePublisher->registerService(myStub, testServiceAddress, serviceFactory));
- EXPECT_TRUE(servicePublisher->unregisterService(testServiceAddress));
+ 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::load("Fake");
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Factory> serviceFactory = runtime->createFactory();
- ASSERT_TRUE((bool)serviceFactory);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher);
-
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
+ auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- EXPECT_FALSE(servicePublisher->registerService(myStub, testServiceAddress, serviceFactory));
- EXPECT_FALSE(servicePublisher->unregisterService(testServiceAddress));
+ 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::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(testServiceAddress);
+ auto defaultTestProxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(testServiceAddressDomain, testServiceAddressInstance);
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>();
+ auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- servicePublisher->registerService(myStub, testServiceAddress, serviceFactory);
+ runtime->registerService(testServiceAddressDomain, testServiceAddressInstance, myStub);
for (uint32_t i = 0; i < 300 && !defaultTestProxy->isAvailable(); ++i) {
usleep(1000);
@@ -203,13 +180,16 @@ TEST_F(DBusDynamicLoadingBasicTest, CreatedProxiesAndServicesCanCommunicate) {
CommonAPI::CallStatus status;
defaultTestProxy->testEmptyMethod(status);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
+ ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
- servicePublisher->unregisterService(testServiceAddress);
+ 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
index 529af6b..0af6a04 100644
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingDefinitions.h
+++ b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingDefinitions.h
@@ -10,24 +10,32 @@
#include <cstring>
#include <string>
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/utils.h>
+#include <CommonAPI/utils.hpp>
-#include <commonapi/tests/TestInterfaceProxy.h>
-#include <commonapi/tests/TestInterfaceStubDefault.h>
+#include <v1_0/commonapi/tests/TestInterfaceProxy.hpp>
+#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
-const char testServiceAddress[] = "local:commonapi.tests.TestInterface:commonapi.tests.TestInterface";
+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";
-const std::string currentBinaryFileFQN = CommonAPI::getCurrentBinaryFileFQN();
+#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";
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp
index b1d6263..20becbf 100644
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp
+++ b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp
@@ -14,7 +14,7 @@
#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusRuntime.h>
+#include <CommonAPI/DBus/DBusRuntime.hpp>
class Environment: public ::testing::Environment {
@@ -28,7 +28,14 @@ public:
char* environment = (char*) (environmentString_.c_str());
putenv(environment);
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
+#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());
@@ -186,8 +193,10 @@ TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, ErrorOnLoadingRuntimeForBro
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
index 426d8d6..9345286 100644
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp
+++ b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp
@@ -136,8 +136,10 @@ TEST_F(DBusDynamicLoadingMultipleBindingsTest, RuntimesLoadBothServicePublishers
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
index 2e402c3..b19efbe 100644
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp
+++ b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp
@@ -22,7 +22,14 @@ public:
char* environment = (char*) (environmentString_.c_str());
putenv(environment);
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
+#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());
@@ -172,8 +179,10 @@ TEST_F(DBusDynamicLoadingMultipleDefinitionTest, CreatedProxiesAndServicesCanCom
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
index 5a40126..9ec6c64 100644
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp
+++ b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp
@@ -22,7 +22,14 @@ public:
char* environment = (char*) (environmentString_.c_str());
putenv(environment);
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
+#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());
@@ -73,9 +80,10 @@ TEST_F(DBusDynamicLoadingFullyInvalidConfigTest, LoadsNoAliasedDynamicallyLinked
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.h b/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h
index e1cc96a..129be55 100644
--- a/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h
+++ b/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h
@@ -7,7 +7,7 @@
#ifndef COMMONAPI_FAKE_FAKE_RUNTIME_H_
#define COMMONAPI_FAKE_FAKE_RUNTIME_H_
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
namespace CommonAPI {
diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp b/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
deleted file mode 100644
index 64d8a56..0000000
--- a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include "LegacyInterfaceDBusProxy.h"
-
-namespace fake {
-namespace legacy {
-namespace service {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createLegacyInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) {
- return std::make_shared<LegacyInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
-}
-
-INITIALIZER(registerLegacyInterfaceDBusProxy) {
- CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(LegacyInterface::getInterfaceId(),
- &createLegacyInterfaceDBusProxy);
-}
-
-LegacyInterfaceDBusProxy::LegacyInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection):
- CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection)
- {
- }
-
-
-
-void LegacyInterfaceDBusProxy::TestMethod(const int32_t& input, CommonAPI::CallStatus& callStatus, int32_t& val1, int32_t& val2) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t>,
- CommonAPI::DBus::DBusSerializableArguments<int32_t, int32_t> >::callMethodWithReply(
- *this,
- "TestMethod",
- "i",
- input,
- callStatus
- , val1, val2);
-}
-std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::TestMethodAsync(const int32_t& input, TestMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t>,
- CommonAPI::DBus::DBusSerializableArguments<int32_t, int32_t> >::callMethodAsync(
- *this,
- "TestMethod",
- "i",
- input,
- std::move(callback));
-}
-void LegacyInterfaceDBusProxy::OtherTestMethod(CommonAPI::CallStatus& callStatus, std::string& greeting, int32_t& identifier) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<std::string, int32_t> >::callMethodWithReply(
- *this,
- "OtherTestMethod",
- "",
- callStatus
- , greeting, identifier);
-}
-std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::OtherTestMethodAsync(OtherTestMethodAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<std::string, int32_t> >::callMethodAsync(
- *this,
- "OtherTestMethod",
- "",
- std::move(callback));
-}
-void LegacyInterfaceDBusProxy::finish(CommonAPI::CallStatus& callStatus) {
- CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
- *this,
- "finish",
- "",
- callStatus
- );
-}
-std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::finishAsync(FinishAsyncCallback callback) {
- return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
- *this,
- "finish",
- "",
- std::move(callback));
-}
-
-
-
-void LegacyInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
-}
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h b/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h
deleted file mode 100644
index c3a260d..0000000
--- a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_H_
-#define FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_H_
-
-#include <fake/legacy/service/LegacyInterfaceProxyBase.h>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusProxy.h>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterfaceDBusProxy: virtual public LegacyInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy {
- public:
- LegacyInterfaceDBusProxy(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection);
-
- virtual ~LegacyInterfaceDBusProxy() { }
-
-
-
- virtual void TestMethod(const int32_t& input, CommonAPI::CallStatus& callStatus, int32_t& val1, int32_t& val2);
- virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t& input, TestMethodAsyncCallback callback);
- virtual void OtherTestMethod(CommonAPI::CallStatus& callStatus, std::string& greeting, int32_t& identifier);
- virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback callback);
- virtual void finish(CommonAPI::CallStatus& callStatus);
- virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback callback);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
- private:
-
-
-};
-
-
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-
-#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_H_
diff --git a/src/test/fake/legacy/service/LegacyInterfaceProxyBase.h b/src/test/fake/legacy/service/LegacyInterfaceProxyBase.h
deleted file mode 100644
index 71938ab..0000000
--- a/src/test/fake/legacy/service/LegacyInterfaceProxyBase.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_H_
-#define FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_H_
-
-#include "LegacyInterface.h"
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.h>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterfaceProxyBase: virtual public CommonAPI::Proxy {
- public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const int32_t&, const int32_t&)> TestMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, const std::string&, const int32_t&)> OtherTestMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> FinishAsyncCallback;
-
-
-
- virtual void TestMethod(const int32_t& input, CommonAPI::CallStatus& callStatus, int32_t& val1, int32_t& val2) = 0;
- virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t& input, TestMethodAsyncCallback callback) = 0;
- virtual void OtherTestMethod(CommonAPI::CallStatus& callStatus, std::string& greeting, int32_t& identifier) = 0;
- virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback callback) = 0;
- virtual void finish(CommonAPI::CallStatus& callStatus) = 0;
- virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback callback) = 0;
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-
-#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_H_
diff --git a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp b/src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp
deleted file mode 100644
index 184ce1e..0000000
--- a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-* If a copy of the MPL was not distributed with this file, You can obtain one at
-* http://mozilla.org/MPL/2.0/.
-*/
-#include <fake/legacy/service/LegacyInterfaceStubDefault.h>
-
-namespace fake {
-namespace legacy {
-namespace service {
-
-LegacyInterfaceStubDefault::LegacyInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(LegacyInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& LegacyInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
- return interfaceVersion_;
-}
-
-LegacyInterfaceStubRemoteEvent* LegacyInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter>& stubAdapter) {
- CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
- return &remoteEventHandler_;
-}
-
-
-void LegacyInterfaceStubDefault::TestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t input, int32_t& val1, int32_t& val2) {
- // Call old style methods in default
- TestMethod(input, val1, val2);
-}
-void LegacyInterfaceStubDefault::TestMethod(int32_t input, int32_t& val1, int32_t& val2) {
- // No operation in default
-}
-
-void LegacyInterfaceStubDefault::OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, std::string& greeting, int32_t& identifier) {
- // Call old style methods in default
- OtherTestMethod(greeting, identifier);
-}
-void LegacyInterfaceStubDefault::OtherTestMethod(std::string& greeting, int32_t& identifier) {
- // No operation in default
-}
-
-void LegacyInterfaceStubDefault::finish(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- // Call old style methods in default
- finish();
-}
-void LegacyInterfaceStubDefault::finish() {
- // No operation in default
-}
-
-
-
-
-LegacyInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LegacyInterfaceStubDefault* defaultStub):
- defaultStub_(defaultStub) {
-}
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
diff --git a/src/test/fakeLegacyService.fidl b/src/test/fakeLegacyService.fidl
index 6aaa8a8..cd0a603 100644
--- a/src/test/fakeLegacyService.fidl
+++ b/src/test/fakeLegacyService.fidl
@@ -1,3 +1,8 @@
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
package fake.legacy.service
interface LegacyInterface {
diff --git a/src/test/fakeLegacyService/fakeLegacyService.py b/src/test/fakeLegacyService/fakeLegacyService.py
index b082efd..cf5057e 100644
--- a/src/test/fakeLegacyService/fakeLegacyService.py
+++ b/src/test/fakeLegacyService/fakeLegacyService.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 BMW Group
+# Copyright (C) 2013 - 2015 BMW Group
# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
# Author: Juergen Gehring (juergen.gehring@bmw.de)
# This Source Code Form is subject to the terms of the Mozilla Public
@@ -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.connection', bus = dbus.SessionBus())
- dbus.service.Object.__init__(self, busName, '/some/legacy/path/6259504')
+ busName = dbus.service.BusName('fake.legacy.service.LegacyInterface_fake.legacy.service', bus = dbus.SessionBus())
+ dbus.service.Object.__init__(self, busName, '/fake/legacy/service')
#self.properties = {'RestartReason': 1, 'ShutdownReason': 2, 'WakeUpReason' :3, 'BootMode' :4}
self.ABus=""
self.APath=""
diff --git a/src/test/fakeLegacyService/sendToFakeLegacyService.py b/src/test/fakeLegacyService/sendToFakeLegacyService.py
index 79c1445..c098173 100644
--- a/src/test/fakeLegacyService/sendToFakeLegacyService.py
+++ b/src/test/fakeLegacyService/sendToFakeLegacyService.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 BMW Group
+# Copyright (C) 2013 - 2015 BMW Group
# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
# Author: Juergen Gehring (juergen.gehring@bmw.de)
# This Source Code Form is subject to the terms of the Mozilla Public
@@ -15,7 +15,7 @@ import dbus.service
def finish():
try:
bus = dbus.SessionBus()
- remote_object = bus.get_object('fake.legacy.service.connection','/some/legacy/path/6259504')
+ 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
@@ -30,4 +30,4 @@ def main():
return 0
-sys.exit(main()) \ No newline at end of file
+sys.exit(main())
diff --git a/src/test/leaf.fidl b/src/test/leaf.fidl
index 3cb907e..09f47c4 100644
--- a/src/test/leaf.fidl
+++ b/src/test/leaf.fidl
@@ -1,6 +1,8 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
package commonapi.tests.managed
interface LeafInterface {
diff --git a/src/test/root.fidl b/src/test/root.fidl
index 094eacf..78bfe15 100644
--- a/src/test/root.fidl
+++ b/src/test/root.fidl
@@ -1,6 +1,8 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
package commonapi.tests.managed
import commonapi.tests.managed.* from "leaf.fidl"
diff --git a/src/test/src-gen/commonapi/tests/DerivedTypeCollection.cpp b/src/test/src-gen/commonapi/tests/DerivedTypeCollection.cpp
new file mode 100644
index 0000000..fbdd309
--- /dev/null
+++ b/src/test/src-gen/commonapi/tests/DerivedTypeCollection.cpp
@@ -0,0 +1,76 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used org.franca.core 0.9.1.201412191134.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+* If a copy of the MPL was not distributed with this file, You can obtain one at
+* http://mozilla.org/MPL/2.0/.
+*/
+#include "DerivedTypeCollection.hpp"
+
+
+namespace commonapi {
+namespace tests {
+
+
+bool DerivedTypeCollection::TestStructExtended::operator==(const DerivedTypeCollection::TestStructExtended& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue() && getTestEnumExtended2() == _other.getTestEnumExtended2());
+}
+
+#ifndef WIN32
+const int32_t DerivedTypeCollection::TestEnum::E_UNKNOWN;
+const int32_t DerivedTypeCollection::TestEnum::E_OK;
+const int32_t DerivedTypeCollection::TestEnum::E_OUT_OF_RANGE;
+const int32_t DerivedTypeCollection::TestEnum::E_NOT_USED;
+#endif
+#ifndef WIN32
+const int32_t DerivedTypeCollection::TestEnumExtended2::E_NEW2;
+#endif
+#ifndef WIN32
+const int32_t DerivedTypeCollection::TestEnumMissingValue::E1;
+const int32_t DerivedTypeCollection::TestEnumMissingValue::E2;
+const int32_t DerivedTypeCollection::TestEnumMissingValue::E3;
+#endif
+#ifndef WIN32
+const int32_t DerivedTypeCollection::TestEnumExtended::E_NEW;
+#endif
+
+bool DerivedTypeCollection::TestStruct::operator==(const DerivedTypeCollection::TestStruct& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue());
+}
+
+std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct> DerivedTypeCollection::TestPolymorphicStruct::create(CommonAPI::Serial _serial) {
+ switch (_serial) {
+ case DerivedTypeCollection::TESTPOLYMORPHICSTRUCT_SERIAL:
+ return std::make_shared<DerivedTypeCollection::TestPolymorphicStruct>();
+ case DerivedTypeCollection::TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ return std::make_shared<DerivedTypeCollection::TestExtendedPolymorphicStruct>();
+ default:
+ break;
+ }
+ return std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>();
+}
+
+bool DerivedTypeCollection::TestPolymorphicStruct::operator==(const DerivedTypeCollection::TestPolymorphicStruct& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue());
+}
+
+
+bool DerivedTypeCollection::TestExtendedPolymorphicStruct::operator==(const DerivedTypeCollection::TestExtendedPolymorphicStruct& _other) const {
+ return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue() && getAdditionalValue() == _other.getAdditionalValue());
+}
+
+
+bool DerivedTypeCollection::StructWithPolymorphicMember::operator==(const DerivedTypeCollection::StructWithPolymorphicMember& _other) const {
+ return (getNumberValue() == _other.getNumberValue() && getPolymorphicMember() == _other.getPolymorphicMember());
+}
+
+
+bool DerivedTypeCollection::StructWithEnumKeyMap::operator==(const DerivedTypeCollection::StructWithEnumKeyMap& _other) const {
+ return (getTestMap() == _other.getTestMap());
+}
+
+
+} // namespace tests
+} // namespace commonapi
diff --git a/src/test/src-gen/commonapi/tests/DerivedTypeCollection.hpp b/src/test/src-gen/commonapi/tests/DerivedTypeCollection.hpp
new file mode 100644
index 0000000..2583e9b
--- /dev/null
+++ b/src/test/src-gen/commonapi/tests/DerivedTypeCollection.hpp
@@ -0,0 +1,375 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used org.franca.core 0.9.1.201412191134.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+* If a copy of the MPL was not distributed with this file, You can obtain one at
+* http://mozilla.org/MPL/2.0/.
+*/
+#ifndef COMMONAPI_TESTS_Derived_Type_Collection_HPP_
+#define COMMONAPI_TESTS_Derived_Type_Collection_HPP_
+
+
+#include <commonapi/tests/PredefinedTypeCollection.hpp>
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/Deployment.hpp>
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/Struct.hpp>
+#include <CommonAPI/Types.hpp>
+#include <cstdint>
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace commonapi {
+namespace tests {
+
+struct DerivedTypeCollection {
+ struct TestStruct : CommonAPI::Struct<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> {
+
+ TestStruct() {
+ }
+ TestStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
+ {
+ std::get<0>(values_) = _testString;
+ std::get<1>(values_) = _uintValue;
+ }
+ /**
+ * description: the name of the property
+ */
+ inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
+ inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
+ /**
+ * description: the actual value
+ */
+ inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
+ inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
+ bool operator==(const TestStruct &_other) const;
+ inline bool operator!=(const TestStruct &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ typedef std::vector<TestStruct> TestArrayTestStruct;
+ typedef std::unordered_map<uint32_t, TestArrayTestStruct> TestMap;
+ /**
+ * description: Common errors.
+ */
+
+ struct TestEnum : CommonAPI::Enumeration<int32_t> {
+ TestEnum() = default;
+ TestEnum(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ /**
+ * description: default
+ */
+ static const int32_t E_UNKNOWN = 0;
+ /**
+ * description: no error - positive reply
+ */
+ static const int32_t E_OK = 1;
+ /**
+ * description: value out of range
+ */
+ static const int32_t E_OUT_OF_RANGE = 2;
+ /**
+ * description: not used
+ */
+ static const int32_t E_NOT_USED = 3;
+ };
+
+ struct TestEnumExtended : TestEnum {
+ TestEnumExtended() = default;
+ TestEnumExtended(const int32_t &_value)
+ : TestEnum(_value) {}
+ /**
+ * description: new error
+ */
+ static const int32_t E_NEW = 4;
+ };
+
+ struct TestEnumExtended2 : TestEnumExtended {
+ TestEnumExtended2() = default;
+ TestEnumExtended2(const int32_t &_value)
+ : TestEnumExtended(_value) {}
+ /**
+ * description: new error
+ */
+ static const int32_t E_NEW2 = 5;
+ };
+ struct TestStructExtended : CommonAPI::Struct<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t, TestEnumExtended2> {
+
+ TestStructExtended() {
+ }
+ TestStructExtended(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const TestEnumExtended2 &_testEnumExtended2)
+ {
+ std::get<0>(values_) = _testString;
+ std::get<1>(values_) = _uintValue;
+ std::get<2>(values_) = _testEnumExtended2;
+ }
+ /**
+ * description: the name of the property
+ */
+ inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
+ inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
+ /**
+ * description: the actual value
+ */
+ inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
+ inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
+ inline const TestEnumExtended2 &getTestEnumExtended2() const { return std::get<2>(values_); }
+ inline void setTestEnumExtended2(const TestEnumExtended2 &_value) { std::get<2>(values_) = _value; }
+ bool operator==(const TestStructExtended &_other) const;
+ inline bool operator!=(const TestStructExtended &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ typedef std::unordered_map<TestEnum, std::string, CommonAPI::EnumHasher<TestEnum>> TestEnumMap;
+
+ struct TestEnumMissingValue : CommonAPI::Enumeration<int32_t> {
+ TestEnumMissingValue() = default;
+ TestEnumMissingValue(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ /**
+ * description: default
+ */
+ static const int32_t E1 = 0;
+ static const int32_t E2 = 1;
+ static const int32_t E3 = 2;
+ };
+ typedef std::vector<uint64_t> TestArrayUInt64;
+ static const CommonAPI::Serial TESTPOLYMORPHICSTRUCT_SERIAL = 0x8F51A326;
+ static const CommonAPI::Serial TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL = 0xA49310F2;
+
+ struct TestPolymorphicStruct : CommonAPI::PolymorphicStruct {
+ static std::shared_ptr<TestPolymorphicStruct> create(CommonAPI::Serial _serial);
+ const CommonAPI::Serial getSerial() const { return TESTPOLYMORPHICSTRUCT_SERIAL; }
+
+ TestPolymorphicStruct() {
+ }
+ TestPolymorphicStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
+ {
+ std::get<0>(values_) = _testString;
+ std::get<1>(values_) = _uintValue;
+ }
+ template<class _Input>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
+ _input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
+ _input.template readValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<_Input>(_input, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Input, class _Deployment>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
+ _input.template readValue<>(std::get<0>(values_), std::get<0>(_depl->values_));
+ _input.template readValue<>(std::get<1>(values_), std::get<1>(_depl->values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<>(_input, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Output>
+ void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
+ _output.writeType(std::get<0>(values_));
+ _output.writeType(std::get<1>(values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template writeType<_Output>(_output);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Output>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
+ _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
+ _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<_Output>(_output, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+
+ template<class _Output, class _Deployment>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
+ _output.template writeValue<>(std::get<0>(values_), _depl, std::get<0>(_depl->values_));
+ _output.template writeValue<>(std::get<1>(values_), _depl, std::get<1>(_depl->values_));
+ switch (getSerial()) {
+ case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<>(_output, _depl);
+ break;
+ default:
+ break;
+ }
+ }
+ /**
+ * description: the name of the property
+ */
+ inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
+ inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
+ /**
+ * description: the actual value
+ */
+ inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
+ inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
+
+ std::tuple<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> values_;
+ bool operator==(const TestPolymorphicStruct &_other) const;
+ inline bool operator!=(const TestPolymorphicStruct &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ struct TestExtendedPolymorphicStruct : TestPolymorphicStruct {
+ const CommonAPI::Serial getSerial() const { return TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL; }
+
+ TestExtendedPolymorphicStruct() {
+ }
+ TestExtendedPolymorphicStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const uint32_t &_additionalValue)
+ : TestPolymorphicStruct(_testString, _uintValue)
+ {
+ std::get<0>(values_) = _additionalValue;
+ }
+ template<class _Input>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
+ _input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
+ }
+
+ template<class _Input, class _Deployment>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
+ _input.template readValue<>(std::get<0>(values_), std::get<2>(_depl->values_));
+ }
+
+ template<class _Output>
+ void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
+ _output.writeType(std::get<0>(values_));
+ }
+
+ template<class _Output>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_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_));
+ }
+ inline const uint32_t &getAdditionalValue() const { return std::get<0>(values_); }
+ inline void setAdditionalValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
+
+ std::tuple<uint32_t> values_;
+ bool operator==(const TestExtendedPolymorphicStruct &_other) const;
+ inline bool operator!=(const TestExtendedPolymorphicStruct &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ typedef std::unordered_map<uint8_t, std::shared_ptr<TestPolymorphicStruct>> MapIntToPolymorphic;
+ struct StructWithPolymorphicMember : CommonAPI::Struct<uint32_t, std::shared_ptr<TestPolymorphicStruct>> {
+
+ StructWithPolymorphicMember() {
+ }
+ StructWithPolymorphicMember(const uint32_t &_numberValue, const std::shared_ptr<TestPolymorphicStruct> &_polymorphicMember)
+ {
+ std::get<0>(values_) = _numberValue;
+ std::get<1>(values_) = _polymorphicMember;
+ }
+ inline const uint32_t &getNumberValue() const { return std::get<0>(values_); }
+ inline void setNumberValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
+ inline const std::shared_ptr<TestPolymorphicStruct> &getPolymorphicMember() const { return std::get<1>(values_); }
+ inline void setPolymorphicMember(const std::shared_ptr<TestPolymorphicStruct> &_value) { std::get<1>(values_) = _value; }
+ bool operator==(const StructWithPolymorphicMember &_other) const;
+ inline bool operator!=(const StructWithPolymorphicMember &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+ struct StructWithEnumKeyMap : CommonAPI::Struct<TestEnumMap> {
+
+ StructWithEnumKeyMap() {
+ }
+ StructWithEnumKeyMap(const TestEnumMap &_testMap)
+ {
+ std::get<0>(values_) = _testMap;
+ }
+ inline const TestEnumMap &getTestMap() const { return std::get<0>(values_); }
+ inline void setTestMap(const TestEnumMap &_value) { std::get<0>(values_) = _value; }
+ bool operator==(const StructWithEnumKeyMap &_other) const;
+ inline bool operator!=(const StructWithEnumKeyMap &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
+
+
+
+static inline const char* getTypeCollectionName() {
+ static const char* typeCollectionName = "commonapi.tests.DerivedTypeCollection";
+ return typeCollectionName;
+}
+
+
+}; // struct DerivedTypeCollection
+
+} // namespace tests
+} // namespace commonapi
+
+namespace CommonAPI {
+}
+
+
+namespace std {
+ //Hash for TestEnum
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnum> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnum& testEnum) const {
+ return static_cast<int32_t>(testEnum);
+ }
+ };
+ //Hash for TestEnumExtended2
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2) const {
+ return static_cast<int32_t>(testEnumExtended2);
+ }
+ };
+ //Hash for TestEnumMissingValue
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue& testEnumMissingValue) const {
+ return static_cast<int32_t>(testEnumMissingValue);
+ }
+ };
+ //Hash for TestEnumExtended
+ template<>
+ struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
+ inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended& testEnumExtended) const {
+ return static_cast<int32_t>(testEnumExtended);
+ }
+ };
+}
+
+#endif // COMMONAPI_TESTS_Derived_Type_Collection_HPP_
diff --git a/src/test/src-gen/commonapi/tests/PredefinedTypeCollection.hpp b/src/test/src-gen/commonapi/tests/PredefinedTypeCollection.hpp
new file mode 100644
index 0000000..b69d0a6
--- /dev/null
+++ b/src/test/src-gen/commonapi/tests/PredefinedTypeCollection.hpp
@@ -0,0 +1,64 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used org.franca.core 0.9.1.201412191134.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+* If a copy of the MPL was not distributed with this file, You can obtain one at
+* http://mozilla.org/MPL/2.0/.
+*/
+#ifndef COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
+#define COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
+
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/ByteBuffer.hpp>
+#include <CommonAPI/Types.hpp>
+#include <cstdint>
+#include <string>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace commonapi {
+namespace tests {
+
+struct PredefinedTypeCollection {
+ typedef uint8_t TestUInt8;
+ typedef uint16_t TestUInt16;
+ typedef uint32_t TestUInt32;
+ typedef uint64_t TestUInt64;
+ typedef int8_t TestInt8;
+ typedef int16_t TestInt16;
+ typedef int32_t TestInt32;
+ typedef int64_t TestInt64;
+ typedef bool TestBoolean;
+ typedef CommonAPI::ByteBuffer TestByteBuffer;
+ typedef double TestDouble;
+ typedef float TestFloat;
+ typedef std::string TestString;
+
+
+
+static inline const char* getTypeCollectionName() {
+ static const char* typeCollectionName = "commonapi.tests.PredefinedTypeCollection";
+ return typeCollectionName;
+}
+
+
+}; // struct PredefinedTypeCollection
+
+} // namespace tests
+} // namespace commonapi
+
+namespace CommonAPI {
+}
+
+
+namespace std {
+}
+
+#endif // COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
diff --git a/src/test/commonapi/tests/ExtendedInterface.h b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterface.hpp
index 4d99e5e..07e4b4b 100644
--- a/src/test/commonapi/tests/ExtendedInterface.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterface.hpp
@@ -1,41 +1,42 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Extended_Interface_H_
-#define COMMONAPI_TESTS_Extended_Interface_H_
+#ifndef COMMONAPI_TESTS_EXTENDED_INTERFACE_HPP_
+#define COMMONAPI_TESTS_EXTENDED_INTERFACE_HPP_
-#include <commonapi/tests/TestInterface.h>
+#include <v1_0/commonapi/tests/TestInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/types.h>
+#include <CommonAPI/Types.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
-class ExtendedInterface: public TestInterface {
- public:
+class ExtendedInterface
+: virtual public TestInterface {
+public:
virtual ~ExtendedInterface() { }
- static inline const char* getInterfaceId();
+ static inline const char* getInterface();
static inline CommonAPI::Version getInterfaceVersion();
};
-const char* ExtendedInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.ExtendedInterface";
- return interfaceId;
+const char* ExtendedInterface::getInterface() {
+ return ("commonapi.tests.ExtendedInterface");
}
CommonAPI::Version ExtendedInterface::getInterfaceVersion() {
@@ -45,16 +46,9 @@ CommonAPI::Version ExtendedInterface::getInterfaceVersion() {
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
}
-#endif // COMMONAPI_TESTS_Extended_Interface_H_
+#endif // COMMONAPI_TESTS_EXTENDED_INTERFACE_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..8290e55
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
@@ -0,0 +1,69 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "TestIntMethodExtended",
+ "u",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt,
+ _status
+ );
+ }
+ std::future<CommonAPI::CallStatus> ExtendedInterfaceDBusProxy::TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
+ *this,
+ "TestIntMethodExtended",
+ "u",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt,
+ std::move(_callback),
+ std::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/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..1112a85
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp
@@ -0,0 +1,61 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_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>
+
+#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>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+class ExtendedInterfaceDBusProxy
+ : virtual public ExtendedInterfaceProxyBase,
+ virtual public TestInterfaceDBusProxy {
+public:
+ ExtendedInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~ExtendedInterfaceDBusProxy() { }
+
+
+
+ virtual void TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+
+
+
+};
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
index bbfa2b8..6cc2a36 100644
--- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
@@ -1,36 +1,31 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "ExtendedInterfaceDBusStubAdapter.h"
-#include <commonapi/tests/ExtendedInterface.h>
+#include <v1_0/commonapi/tests/ExtendedInterface.hpp>
+#include <v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp>
+namespace v1_0 {
namespace commonapi {
namespace tests {
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<ExtendedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<ExtendedInterfaceDBusStubAdapter>(_address, _connection, _stub);
}
INITIALIZER(registerExtendedInterfaceDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(ExtendedInterface::getInterfaceId(),
- &createExtendedInterfaceDBusStubAdapter);
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ ExtendedInterface::getInterface(), &createExtendedInterfaceDBusStubAdapter);
}
-
-
ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInternal() {
deactivateManagedInstances();
ExtendedInterfaceDBusStubAdapterHelper::deinit();
@@ -44,7 +39,7 @@ const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectio
static const std::string introspectionData =
std::string(TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) +
"<method name=\"TestIntMethodExtended\">\n"
- "<arg name=\"inInt\" type=\"u\" direction=\"in\" />\n"
+ "<arg name=\"_inInt\" type=\"u\" direction=\"in\" />\n"
"</method>\n"
;
@@ -74,11 +69,11 @@ CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(&ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)");
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
&ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
@@ -88,11 +83,11 @@ CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(&ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute, "at");
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
&ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
@@ -106,54 +101,54 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
std::tuple<uint32_t>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, "", std::tuple<uint32_t>());
#ifdef WIN32
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
std::tuple<>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(&ExtendedInterfaceStub::testEmptyMethod, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(&ExtendedInterfaceStub::testEmptyMethod, "", std::tuple<>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testVoidPredefinedTypeMethod, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testVoidPredefinedTypeMethod, "", std::tuple<uint32_t, std::string>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<uint32_t, std::string>
- > ExtendedInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testPredefinedTypeMethod, "us");
+ > ExtendedInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testPredefinedTypeMethod, "us", std::tuple<uint32_t, std::string, uint32_t, std::string>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testVoidDerivedTypeMethod, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testVoidDerivedTypeMethod, "", std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>
- > ExtendedInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}");
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>
+ > ExtendedInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}", std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>,
+ std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(&ExtendedInterfaceStub::TestArrayOfPolymorphicStructMethod, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(&ExtendedInterfaceStub::TestArrayOfPolymorphicStructMethod, "", std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::MapIntToPolymorphic>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(&ExtendedInterfaceStub::TestMapOfPolymorphicStructMethod, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(&ExtendedInterfaceStub::TestMapOfPolymorphicStructMethod, "", std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(&ExtendedInterfaceStub::TestStructWithPolymorphicMemberMethod, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(&ExtendedInterfaceStub::TestStructWithPolymorphicMemberMethod, "", std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(&ExtendedInterfaceStub::TestStructWithEnumKeyMapMember, "");
+ > ExtendedInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(&ExtendedInterfaceStub::TestStructWithEnumKeyMapMember, "", std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>());
#endif
@@ -196,39 +191,13 @@ const CommonAPI::DBus::StubAttributeTable& ExtendedInterfaceDBusStubAdapterInter
}
ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- ExtendedInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<ExtendedInterfaceStub>(stub),
- false),
- TestInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub),
- stubDispatcherTable_({
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
+ ExtendedInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<ExtendedInterfaceStub>(_stub), false),
+ TestInterfaceDBusStubAdapterInternal(_address, _connection, _stub),
+ stubDispatcherTable_({
{ { "TestIntMethodExtended", "u" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testIntMethodExtendedStubDispatcher }
#ifdef WIN32
,
@@ -284,3 +253,4 @@ const bool ExtendedInterfaceDBusStubAdapterInternal::hasFreedesktopProperties()
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp
index 5c43471..41c986f 100644
--- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp
@@ -1,44 +1,44 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Extended_Interface_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_H_
+#ifndef COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
+#define COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <commonapi/tests/ExtendedInterfaceStub.h>
-#include <commonapi/tests/TestInterfaceDBusStubAdapter.h>
+#include <v1_0/commonapi/tests/ExtendedInterfaceStub.hpp>
+#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
typedef CommonAPI::DBus::DBusStubAdapterHelper<ExtendedInterfaceStub> ExtendedInterfaceDBusStubAdapterHelper;
-class ExtendedInterfaceDBusStubAdapterInternal: public virtual ExtendedInterfaceStubAdapter, public ExtendedInterfaceDBusStubAdapterHelper, public TestInterfaceDBusStubAdapterInternal {
- public:
+class ExtendedInterfaceDBusStubAdapterInternal
+ : public virtual ExtendedInterfaceStubAdapter,
+ public ExtendedInterfaceDBusStubAdapterHelper,
+ public TestInterfaceDBusStubAdapterInternal
+{
+public:
ExtendedInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
~ExtendedInterfaceDBusStubAdapterInternal();
@@ -51,23 +51,11 @@ class ExtendedInterfaceDBusStubAdapterInternal: public virtual ExtendedInterface
const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
void deactivateManagedInstances();
-
- virtual const std::string getAddress() const {
+
+ virtual const CommonAPI::Address &getAddress() const {
return DBusStubAdapter::getAddress();
}
- virtual const std::string& getDomain() const {
- return DBusStubAdapter::getDomain();
- }
-
- virtual const std::string& getServiceId() const {
- return DBusStubAdapter::getServiceId();
- }
-
- virtual const std::string& getInstanceId() const {
- return DBusStubAdapter::getInstanceId();
- }
-
virtual void init(std::shared_ptr<DBusStubAdapter> instance) {
return ExtendedInterfaceDBusStubAdapterHelper::init(instance);
}
@@ -101,19 +89,19 @@ static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
> setTestPredefinedTypeAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> getTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> setTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> getTestDerivedArrayAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
ExtendedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> setTestDerivedArrayAttributeAttributeStubDispatcher;
#endif
@@ -141,32 +129,32 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testPredefinedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
std::tuple<>
> testVoidDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>
> testDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>,
+ std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
std::tuple<>
> testArrayOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::MapIntToPolymorphic>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>
> testMapOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>
> testStructWithPolymorphicMemberMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
ExtendedInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>
> testStructWithEnumKeyMapMemberStubDispatcher;
#endif
@@ -209,35 +197,27 @@ static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
};
-class ExtendedInterfaceDBusStubAdapter: public ExtendedInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<ExtendedInterfaceDBusStubAdapter> {
+class ExtendedInterfaceDBusStubAdapter
+ : public ExtendedInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<ExtendedInterfaceDBusStubAdapter> {
public:
ExtendedInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- ExtendedInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ false),
+ ExtendedInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
};
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_H_
+#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxy.h b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceProxy.hpp
index de00deb..6c4a1e5 100644
--- a/src/test/commonapi/tests/ExtendedInterfaceProxy.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceProxy.hpp
@@ -1,18 +1,18 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Extended_Interface_PROXY_H_
-#define COMMONAPI_TESTS_Extended_Interface_PROXY_H_
+#ifndef COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
+#define COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
-#include "ExtendedInterfaceProxyBase.h"
+#include <v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp>
-#include "TestInterfaceProxy.h"
+#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -21,13 +21,16 @@
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
template <typename ... _AttributeExtensions>
-class ExtendedInterfaceProxy: virtual public ExtendedInterface, virtual public ExtendedInterfaceProxyBase
-, virtual public TestInterfaceProxy<_AttributeExtensions...>
-, public _AttributeExtensions... {
+class ExtendedInterfaceProxy
+ : virtual public ExtendedInterface,
+ virtual public ExtendedInterfaceProxyBase,
+ virtual public TestInterfaceProxy<_AttributeExtensions...>,
+ public _AttributeExtensions... {
public:
ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~ExtendedInterfaceProxy();
@@ -48,7 +51,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus);
+ virtual void TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestIntMethodExtended with asynchronous semantics.
*
@@ -59,28 +62,13 @@ 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);
+ virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -108,11 +96,7 @@ public:
std::shared_ptr<ExtendedInterfaceProxyBase> delegate_;
};
-#ifdef WIN32
- typedef ExtendedInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> ExtendedInterfaceProxyDefault;
-#else
- typedef ExtendedInterfaceProxy<> ExtendedInterfaceProxyDefault;
-#endif
+typedef ExtendedInterfaceProxy<> ExtendedInterfaceProxyDefault;
//
@@ -130,36 +114,21 @@ ExtendedInterfaceProxy<_AttributeExtensions...>::~ExtendedInterfaceProxy() {
}
template <typename ... _AttributeExtensions>
-void ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus) {
- delegate_->TestIntMethodExtended(inInt, callStatus);
+void ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->TestIntMethodExtended(_inInt, _status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback) {
- return delegate_->TestIntMethodExtendedAsync(inInt, callback);
+std::future<CommonAPI::CallStatus> ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->TestIntMethodExtendedAsync(_inInt, _callback, _info);
}
template <typename ... _AttributeExtensions>
-std::string ExtendedInterfaceProxy<_AttributeExtensions...>::getAddress() const {
+const CommonAPI::Address &ExtendedInterfaceProxy<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
-const std::string& ExtendedInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& ExtendedInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& ExtendedInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
bool ExtendedInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -182,6 +151,7 @@ CommonAPI::InterfaceVersionAttribute& ExtendedInterfaceProxy<_AttributeExtension
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_H_
+#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp
new file mode 100644
index 0000000..5ab90c0
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp
@@ -0,0 +1,50 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_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>
+
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <vector>
+
+#include <CommonAPI/Proxy.hpp>
+#include <functional>
+#include <future>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+class ExtendedInterfaceProxyBase
+ : virtual public TestInterfaceProxyBase {
+public:
+
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestIntMethodExtendedAsyncCallback;
+
+
+
+ virtual void TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr) = 0;
+ virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr) = 0;
+};
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_HPP_
diff --git a/src/test/commonapi/tests/ExtendedInterfaceStub.h b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStub.hpp
index 7e253ac..96ec358 100644
--- a/src/test/commonapi/tests/ExtendedInterfaceStub.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStub.hpp
@@ -1,20 +1,22 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Extended_Interface_STUB_H_
-#define COMMONAPI_TESTS_Extended_Interface_STUB_H_
+#ifndef COMMONAPI_TESTS_Extended_Interface_STUB_HPP_
+#define COMMONAPI_TESTS_Extended_Interface_STUB_HPP_
+#include <functional>
-#include <commonapi/tests/TestInterfaceStub.h>
-#include "ExtendedInterface.h"
+#include <v1_0/commonapi/tests/TestInterfaceStub.hpp>
+
+#include <v1_0/commonapi/tests/ExtendedInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -22,10 +24,11 @@
#include <vector>
-#include <CommonAPI/Stub.h>
+#include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
@@ -35,7 +38,10 @@ namespace tests {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
-class ExtendedInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public ExtendedInterface, public virtual TestInterfaceStubAdapter {
+class ExtendedInterfaceStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public ExtendedInterface,
+ public virtual TestInterfaceStubAdapter {
public:
@@ -48,7 +54,6 @@ protected:
*/
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for ExtendedInterface.
@@ -61,27 +66,33 @@ protected:
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class ExtendedInterfaceStubRemoteEvent: public virtual TestInterfaceStubRemoteEvent {
- public:
+class ExtendedInterfaceStubRemoteEvent
+: public virtual TestInterfaceStubRemoteEvent
+{
+public:
virtual ~ExtendedInterfaceStubRemoteEvent() { }
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service ExtendedInterface to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class ExtendedInterfaceStub: public virtual CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>, public virtual TestInterfaceStub {
+class ExtendedInterfaceStub
+ : public virtual CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>,
+ public virtual TestInterfaceStub
+{
public:
- virtual ~ExtendedInterfaceStub() { }
+ typedef std::function<void ()> TestIntMethodExtendedReply_t;
+
+ virtual ~ExtendedInterfaceStub() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
/// This is the method that will be called on remote calls on the method TestIntMethodExtended.
- virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt) = 0;
+ virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _inInt, TestIntMethodExtendedReply_t _reply) = 0;
using CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::initStubAdapter;
typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
@@ -92,5 +103,6 @@ public:
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Extended_Interface_STUB_H_
+#endif // COMMONAPI_TESTS_Extended_Interface_STUB_HPP_
diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.cpp
index 468a5e7..ad918f2 100644
--- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.cpp
@@ -1,14 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 <commonapi/tests/ExtendedInterfaceStubDefault.h>
+#include <v1_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp>
+#include <assert.h>
+namespace v1_0 {
namespace commonapi {
namespace tests {
@@ -17,32 +19,29 @@ ExtendedInterfaceStubDefault::ExtendedInterfaceStubDefault():
interfaceVersion_(ExtendedInterface::getInterfaceVersion()) {
}
-const CommonAPI::Version& ExtendedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
+const CommonAPI::Version& ExtendedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
return interfaceVersion_;
}
-ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter) {
- TestInterfaceStubDefault::initStubAdapter(stubAdapter);
- CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
+ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter> &_adapter) {
+ TestInterfaceStubDefault::initStubAdapter(_adapter);
+ CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
return &remoteEventHandler_;
}
-void ExtendedInterfaceStubDefault::TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt) {
- // Call old style methods in default
- TestIntMethodExtended(inInt);
-}
-void ExtendedInterfaceStubDefault::TestIntMethodExtended(uint32_t inInt) {
- // No operation in default
+void ExtendedInterfaceStubDefault::TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _inInt, TestIntMethodExtendedReply_t _reply) {
+ _reply();
}
-ExtendedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(ExtendedInterfaceStubDefault* defaultStub):
- TestInterfaceStubDefault::RemoteEventHandler(defaultStub),
- defaultStub_(defaultStub) {
+ExtendedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(ExtendedInterfaceStubDefault *_defaultStub)
+ : TestInterfaceStubDefault::RemoteEventHandler(_defaultStub),
+ defaultStub_(_defaultStub) {
}
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp
index 7117532..30156c9 100644
--- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp
@@ -1,20 +1,21 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Extended_Interface_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_H_
+#ifndef COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_HPP_
+#define COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_HPP_
-#include <commonapi/tests/TestInterfaceStubDefault.h>
+#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
-#include <commonapi/tests/ExtendedInterfaceStub.h>
+#include <v1_0/commonapi/tests/ExtendedInterfaceStub.hpp>
#include <sstream>
+namespace v1_0 {
namespace commonapi {
namespace tests {
@@ -28,29 +29,29 @@ namespace tests {
* that would be defined for this service, and/or if you do not need any non-default
* behaviour.
*/
-class ExtendedInterfaceStubDefault : public virtual ExtendedInterfaceStub, public virtual TestInterfaceStubDefault {
+class ExtendedInterfaceStubDefault
+ : public virtual ExtendedInterfaceStub,
+ public virtual TestInterfaceStubDefault {
public:
ExtendedInterfaceStubDefault();
- ExtendedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter);
+ ExtendedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter> &_adapter);
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt);
- virtual void TestIntMethodExtended(uint32_t inInt);
-
+ virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _inInt, TestIntMethodExtendedReply_t _reply);
protected:
class RemoteEventHandler: public virtual ExtendedInterfaceStubRemoteEvent, public virtual TestInterfaceStubDefault::RemoteEventHandler {
- public:
- RemoteEventHandler(ExtendedInterfaceStubDefault* defaultStub);
+ public:
+ RemoteEventHandler(ExtendedInterfaceStubDefault *_defaultStub);
- private:
- ExtendedInterfaceStubDefault* defaultStub_;
+ private:
+ ExtendedInterfaceStubDefault *defaultStub_;
};
private:
ExtendedInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
@@ -61,5 +62,6 @@ private:
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_H_
+#endif // COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..79e680c
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
@@ -0,0 +1,51 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestFreedesktopDerivedInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
+ return std::make_shared<TestFreedesktopDerivedInterfaceDBusProxy>(_address, _connection);
+}
+
+INITIALIZER(registerTestFreedesktopDerivedInterfaceDBusProxy) {
+ CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
+ TestFreedesktopDerivedInterface::getInterface(),
+ &createTestFreedesktopDerivedInterfaceDBusProxy);
+}
+
+TestFreedesktopDerivedInterfaceDBusProxy::TestFreedesktopDerivedInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
+ : CommonAPI::DBus::DBusProxy(_address, _connection),
+ TestFreedesktopInterfaceDBusProxy(_address, _connection)
+, testAttributedFromDerivedInterface_(*this, getAddress().getInterface(), "TestAttributedFromDerivedInterface")
+{
+}
+
+ TestFreedesktopDerivedInterfaceDBusProxy::TestAttributedFromDerivedInterfaceAttribute& TestFreedesktopDerivedInterfaceDBusProxy::getTestAttributedFromDerivedInterfaceAttribute() {
+ return testAttributedFromDerivedInterface_;
+ }
+
+
+
+
+ void TestFreedesktopDerivedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
+ ownVersionMajor = 1;
+ ownVersionMinor = 0;
+ }
+
+ } // namespace tests
+ } // namespace commonapi
+ } // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..bf46a6b
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp
@@ -0,0 +1,66 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_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>
+
+#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/DBusAttribute.hpp>
+#include <CommonAPI/DBus/DBusFreedesktopAttribute.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+class TestFreedesktopDerivedInterfaceDBusProxy
+ : virtual public TestFreedesktopDerivedInterfaceProxyBase,
+ virtual public TestFreedesktopInterfaceDBusProxy {
+public:
+ TestFreedesktopDerivedInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~TestFreedesktopDerivedInterfaceDBusProxy() { }
+
+ virtual TestAttributedFromDerivedInterfaceAttribute& getTestAttributedFromDerivedInterfaceAttribute();
+
+
+
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+ typedef CommonAPI::Variant<
+ uint32_t
+ > FreedesktopVariant_t;
+
+ CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestAttributedFromDerivedInterfaceAttribute>, FreedesktopVariant_t> testAttributedFromDerivedInterface_;
+
+
+};
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
index 71ac6fe..fdf7019 100644
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
@@ -1,36 +1,31 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "TestFreedesktopDerivedInterfaceDBusStubAdapter.h"
-#include <commonapi/tests/TestFreedesktopDerivedInterface.h>
+#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
+#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp>
+namespace v1_0 {
namespace commonapi {
namespace tests {
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestFreedesktopDerivedInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<TestFreedesktopDerivedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<TestFreedesktopDerivedInterfaceDBusStubAdapter>(_address, _connection, _stub);
}
INITIALIZER(registerTestFreedesktopDerivedInterfaceDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestFreedesktopDerivedInterface::getInterfaceId(),
- &createTestFreedesktopDerivedInterfaceDBusStubAdapter);
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ TestFreedesktopDerivedInterface::getInterface(), &createTestFreedesktopDerivedInterfaceDBusStubAdapter);
}
-
-
TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::~TestFreedesktopDerivedInterfaceDBusStubAdapterInternal() {
deactivateManagedInstances();
TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::deinit();
@@ -88,11 +83,11 @@ CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher(&TestFreedesktopDerivedInterfaceStub::getTestReadonlyAttributeAttribute);
CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(&TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute);
CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
&TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
@@ -101,11 +96,11 @@ CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
);
CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(&TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute);
CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
&TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
@@ -140,39 +135,13 @@ const CommonAPI::DBus::StubAttributeTable& TestFreedesktopDerivedInterfaceDBusSt
}
TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- TestFreedesktopDerivedInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceStub>(stub),
- false),
- TestFreedesktopInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub),
- stubDispatcherTable_({
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
+ TestFreedesktopDerivedInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceStub>(_stub), false),
+ TestFreedesktopInterfaceDBusStubAdapterInternal(_address, _connection, _stub),
+ stubDispatcherTable_({
#ifdef WIN32
#endif
}),
@@ -243,3 +212,4 @@ const bool TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::hasFreedeskto
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.h b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp
index c22afff..daecd30 100644
--- a/src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp
@@ -1,44 +1,45 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_H_
+#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
+#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <commonapi/tests/TestFreedesktopDerivedInterfaceStub.h>
-#include <commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.h>
+#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp>
+#include <v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
typedef CommonAPI::DBus::DBusStubAdapterHelper<TestFreedesktopDerivedInterfaceStub> TestFreedesktopDerivedInterfaceDBusStubAdapterHelper;
-class TestFreedesktopDerivedInterfaceDBusStubAdapterInternal: public virtual TestFreedesktopDerivedInterfaceStubAdapter, public TestFreedesktopDerivedInterfaceDBusStubAdapterHelper, public TestFreedesktopInterfaceDBusStubAdapterInternal {
- public:
+class TestFreedesktopDerivedInterfaceDBusStubAdapterInternal
+ : public virtual TestFreedesktopDerivedInterfaceStubAdapter,
+ public TestFreedesktopDerivedInterfaceDBusStubAdapterHelper,
+ public TestFreedesktopInterfaceDBusStubAdapterInternal
+{
+public:
TestFreedesktopDerivedInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
~TestFreedesktopDerivedInterfaceDBusStubAdapterInternal();
@@ -52,23 +53,11 @@ class TestFreedesktopDerivedInterfaceDBusStubAdapterInternal: public virtual Tes
const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
void deactivateManagedInstances();
-
- virtual const std::string getAddress() const {
+
+ virtual const CommonAPI::Address &getAddress() const {
return DBusStubAdapter::getAddress();
}
- virtual const std::string& getDomain() const {
- return DBusStubAdapter::getDomain();
- }
-
- virtual const std::string& getServiceId() const {
- return DBusStubAdapter::getServiceId();
- }
-
- virtual const std::string& getInstanceId() const {
- return DBusStubAdapter::getInstanceId();
- }
-
virtual void init(std::shared_ptr<DBusStubAdapter> instance) {
return TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::init(instance);
}
@@ -114,19 +103,19 @@ static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
> getTestReadonlyAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> getTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> setTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> getTestDerivedArrayAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopDerivedInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> setTestDerivedArrayAttributeAttributeStubDispatcher;
#endif
@@ -146,35 +135,27 @@ static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
};
-class TestFreedesktopDerivedInterfaceDBusStubAdapter: public TestFreedesktopDerivedInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<TestFreedesktopDerivedInterfaceDBusStubAdapter> {
+class TestFreedesktopDerivedInterfaceDBusStubAdapter
+ : public TestFreedesktopDerivedInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<TestFreedesktopDerivedInterfaceDBusStubAdapter> {
public:
TestFreedesktopDerivedInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- TestFreedesktopDerivedInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ false),
+ TestFreedesktopDerivedInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
};
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_H_
+#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..8305c98
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
@@ -0,0 +1,62 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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, getAddress().getInterface(), "TestPredefinedTypeAttribute"),
+ testReadonlyAttribute_(*this, getAddress().getInterface(), "TestReadonlyAttribute"),
+ testDerivedStructAttribute_(*this, getAddress().getInterface(), "TestDerivedStructAttribute"),
+ testDerivedArrayAttribute_(*this, getAddress().getInterface(), "TestDerivedArrayAttribute")
+{
+}
+
+ 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/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..c34ced8
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp
@@ -0,0 +1,74 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Freedesktop_Interface_DBUS_PROXY_HPP_
+#define COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_HPP_
+
+#include <v1_0/commonapi/tests/TestFreedesktopInterfaceProxyBase.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/DBusAttribute.hpp>
+#include <CommonAPI/DBus/DBusFreedesktopAttribute.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+class TestFreedesktopInterfaceDBusProxy
+ : virtual public TestFreedesktopInterfaceProxyBase,
+ virtual public CommonAPI::DBus::DBusProxy {
+public:
+ TestFreedesktopInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~TestFreedesktopInterfaceDBusProxy() { }
+
+ virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute();
+ virtual TestReadonlyAttributeAttribute& getTestReadonlyAttributeAttribute();
+ virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute();
+ virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute();
+
+
+
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+ typedef CommonAPI::Variant<
+ uint32_t,
+ uint32_t,
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
+ > FreedesktopVariant_t;
+
+ CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestPredefinedTypeAttributeAttribute>, FreedesktopVariant_t> testPredefinedTypeAttribute_;
+ CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopReadonlyAttribute<TestReadonlyAttributeAttribute>, FreedesktopVariant_t> testReadonlyAttribute_;
+ CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestDerivedStructAttributeAttribute>, FreedesktopVariant_t> testDerivedStructAttribute_;
+ CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestDerivedArrayAttributeAttribute>, FreedesktopVariant_t> testDerivedArrayAttribute_;
+
+
+};
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
index 22317d2..9189b8b 100644
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
@@ -1,36 +1,31 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "TestFreedesktopInterfaceDBusStubAdapter.h"
-#include <commonapi/tests/TestFreedesktopInterface.h>
+#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 std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<TestFreedesktopInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
+ 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::DBusFactory::registerAdapterFactoryMethod(TestFreedesktopInterface::getInterfaceId(),
- &createTestFreedesktopInterfaceDBusStubAdapter);
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ TestFreedesktopInterface::getInterface(), &createTestFreedesktopInterfaceDBusStubAdapter);
}
-
-
TestFreedesktopInterfaceDBusStubAdapterInternal::~TestFreedesktopInterfaceDBusStubAdapterInternal() {
deactivateManagedInstances();
TestFreedesktopInterfaceDBusStubAdapterHelper::deinit();
@@ -78,11 +73,11 @@ CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
> TestFreedesktopInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher(&TestFreedesktopInterfaceStub::getTestReadonlyAttributeAttribute);
CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(&TestFreedesktopInterfaceStub::getTestDerivedStructAttributeAttribute);
CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
&TestFreedesktopInterfaceStub::getTestDerivedStructAttributeAttribute,
&TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
@@ -91,11 +86,11 @@ CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
);
CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(&TestFreedesktopInterfaceStub::getTestDerivedArrayAttributeAttribute);
CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
&TestFreedesktopInterfaceStub::getTestDerivedArrayAttributeAttribute,
&TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
@@ -122,16 +117,16 @@ void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestReadonlyAttributeA
value
);
}
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) {
- CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>>
+void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value) {
+ CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestStructExtended>>
::sendPropertiesChangedSignal(
*this,
"TestDerivedStructAttribute",
value
);
}
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) {
- CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>>
+void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value) {
+ CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestArrayUInt64>>
::sendPropertiesChangedSignal(
*this,
"TestDerivedArrayAttribute",
@@ -150,31 +145,12 @@ const CommonAPI::DBus::StubAttributeTable& TestFreedesktopInterfaceDBusStubAdapt
}
TestFreedesktopInterfaceDBusStubAdapterInternal::TestFreedesktopInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- TestFreedesktopInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<TestFreedesktopInterfaceStub>(stub),
- false),
- stubDispatcherTable_({
+ 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_({
{
@@ -217,3 +193,4 @@ const bool TestFreedesktopInterfaceDBusStubAdapterInternal::hasFreedesktopProper
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.h b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp
index 23c94bb..7695ff3 100644
--- a/src/test/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp
@@ -1,43 +1,43 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_Freedesktop_Interface_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_H_
+#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
+#define COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <commonapi/tests/TestFreedesktopInterfaceStub.h>
+#include <v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
typedef CommonAPI::DBus::DBusStubAdapterHelper<TestFreedesktopInterfaceStub> TestFreedesktopInterfaceDBusStubAdapterHelper;
-class TestFreedesktopInterfaceDBusStubAdapterInternal: public virtual TestFreedesktopInterfaceStubAdapter, public TestFreedesktopInterfaceDBusStubAdapterHelper {
- public:
+class TestFreedesktopInterfaceDBusStubAdapterInternal
+ : public virtual TestFreedesktopInterfaceStubAdapter,
+ public TestFreedesktopInterfaceDBusStubAdapterHelper
+{
+public:
TestFreedesktopInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
~TestFreedesktopInterfaceDBusStubAdapterInternal();
@@ -45,8 +45,8 @@ class TestFreedesktopInterfaceDBusStubAdapterInternal: public virtual TestFreede
void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value);
void fireTestReadonlyAttributeAttributeChanged(const uint32_t& value);
- void fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value);
- void fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value);
+ void fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value);
+ void fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value);
@@ -54,7 +54,7 @@ class TestFreedesktopInterfaceDBusStubAdapterInternal: public virtual TestFreede
const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
void deactivateManagedInstances();
-
+
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
@@ -75,19 +75,19 @@ static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
> getTestReadonlyAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> getTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> setTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> getTestDerivedArrayAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
TestFreedesktopInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> setTestDerivedArrayAttributeAttributeStubDispatcher;
@@ -103,35 +103,27 @@ static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
};
-class TestFreedesktopInterfaceDBusStubAdapter: public TestFreedesktopInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<TestFreedesktopInterfaceDBusStubAdapter> {
+class TestFreedesktopInterfaceDBusStubAdapter
+ : public TestFreedesktopInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<TestFreedesktopInterfaceDBusStubAdapter> {
public:
TestFreedesktopInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- TestFreedesktopInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ false),
+ TestFreedesktopInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
};
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_H_
+#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/commonapi/tests/TestInterface.h b/src/test/src-gen/v1_0/commonapi/tests/TestInterface.hpp
index 71c065d..fae3886 100644
--- a/src/test/commonapi/tests/TestInterface.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterface.hpp
@@ -1,14 +1,14 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_H_
-#define COMMONAPI_TESTS_Test_Interface_H_
+#ifndef COMMONAPI_TESTS_TEST_INTERFACE_HPP_
+#define COMMONAPI_TESTS_TEST_INTERFACE_HPP_
@@ -17,24 +17,24 @@
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/types.h>
+#include <CommonAPI/Types.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
class TestInterface {
- public:
+public:
virtual ~TestInterface() { }
- static inline const char* getInterfaceId();
+ static inline const char* getInterface();
static inline CommonAPI::Version getInterfaceVersion();
};
-const char* TestInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.TestInterface";
- return interfaceId;
+const char* TestInterface::getInterface() {
+ return ("commonapi.tests.TestInterface");
}
CommonAPI::Version TestInterface::getInterfaceVersion() {
@@ -44,16 +44,9 @@ CommonAPI::Version TestInterface::getInterfaceVersion() {
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
}
-#endif // COMMONAPI_TESTS_Test_Interface_H_
+#endif // COMMONAPI_TESTS_TEST_INTERFACE_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..0854131
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp
@@ -0,0 +1,266 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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"),
+ testDerivedStructAttribute_(*this, "onTestDerivedStructAttributeAttributeChanged", "setTestDerivedStructAttributeAttribute", "(sqi)", "getTestDerivedStructAttributeAttribute"),
+ testDerivedArrayAttribute_(*this, "onTestDerivedArrayAttributeAttributeChanged", "setTestDerivedArrayAttributeAttribute", "at", "getTestDerivedArrayAttributeAttribute")
+, testPredefinedTypeBroadcast_(*this, "TestPredefinedTypeBroadcast", "us", std::tuple<uint32_t, std::string>()),
+ testSelectiveBroadcastSelective_(*this, "TestSelectiveBroadcast", "", std::tuple<>()),
+ testBroadcastWithOutArgsSelective_(*this, "TestBroadcastWithOutArgs", "us", std::tuple<uint32_t, std::string>())
+{
+}
+
+ 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 &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "testEmptyMethod",
+ "",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _status
+ );
+ }
+ 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),
+ std::move(_callback),
+ std::tuple<>());
+ }
+ void TestInterfaceDBusProxy::testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "testVoidPredefinedTypeMethod",
+ "us",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _uint32Value, _stringValue,
+ _status
+ );
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
+ *this,
+ "testVoidPredefinedTypeMethod",
+ "us",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _uint32Value, _stringValue,
+ std::move(_callback),
+ std::tuple<>());
+ }
+ void TestInterfaceDBusProxy::testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_status, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string> >::callMethodWithReply(
+ *this,
+ "testPredefinedTypeMethod",
+ "us",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _uint32InValue, _stringInValue,
+ _status
+ , _uint32OutValue, _stringOutValue);
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string> >::callMethodAsync(
+ *this,
+ "testPredefinedTypeMethod",
+ "us",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _uint32InValue, _stringInValue,
+ std::move(_callback),
+ std::tuple<uint32_t, std::string>());
+ }
+ void TestInterfaceDBusProxy::testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "testVoidDerivedTypeMethod",
+ "ia{ua(sq)}",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _testEnumExtended2Value, _testMapValue,
+ _status
+ );
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testVoidDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, TestVoidDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
+ *this,
+ "testVoidDerivedTypeMethod",
+ "ia{ua(sq)}",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _testEnumExtended2Value, _testMapValue,
+ std::move(_callback),
+ std::tuple<>());
+ }
+ void TestInterfaceDBusProxy::testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_status, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap> >::callMethodWithReply(
+ *this,
+ "testDerivedTypeMethod",
+ "ia{ua(sq)}",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _testEnumExtended2InValue, _testMapInValue,
+ _status
+ , _testEnumExtended2OutValue, _testMapOutValue);
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, TestDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap> >::callMethodAsync(
+ *this,
+ "testDerivedTypeMethod",
+ "ia{ua(sq)}",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _testEnumExtended2InValue, _testMapInValue,
+ std::move(_callback),
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>());
+ }
+ void TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "TestArrayOfPolymorphicStructMethod",
+ "a(uv)",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inArray,
+ _status
+ );
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
+ *this,
+ "TestArrayOfPolymorphicStructMethod",
+ "a(uv)",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inArray,
+ std::move(_callback),
+ std::tuple<>());
+ }
+ void TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "TestMapOfPolymorphicStructMethod",
+ "a{y(uv)}",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inMap,
+ _status
+ );
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
+ *this,
+ "TestMapOfPolymorphicStructMethod",
+ "a{y(uv)}",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inMap,
+ std::move(_callback),
+ std::tuple<>());
+ }
+ void TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "TestStructWithPolymorphicMemberMethod",
+ "(u(uv))",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inStruct,
+ _status
+ );
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
+ *this,
+ "TestStructWithPolymorphicMemberMethod",
+ "(u(uv))",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inStruct,
+ std::move(_callback),
+ std::tuple<>());
+ }
+ void TestInterfaceDBusProxy::TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "TestStructWithEnumKeyMapMember",
+ "(a{is})",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inStruct,
+ _status
+ );
+ }
+ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync(
+ *this,
+ "TestStructWithEnumKeyMapMember",
+ "(a{is})",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inStruct,
+ std::move(_callback),
+ std::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/v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..52f30b3
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp
@@ -0,0 +1,92 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_DBUS_PROXY_HPP_
+#define COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
+
+#include <v1_0/commonapi/tests/TestInterfaceProxyBase.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/DBusAttribute.hpp>
+#include <CommonAPI/DBus/DBusEvent.hpp>
+#include <CommonAPI/Types.hpp>
+#include <CommonAPI/DBus/DBusSelectiveEvent.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+class TestInterfaceDBusProxy
+ : virtual public TestInterfaceProxyBase,
+ virtual public CommonAPI::DBus::DBusProxy {
+public:
+ TestInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~TestInterfaceDBusProxy() { }
+
+ virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute();
+ virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute();
+ virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute();
+
+ virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent();
+ virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent();
+ virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent();
+
+ virtual void testEmptyMethod(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_status, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testVoidDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, TestVoidDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_status, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, TestDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+
+ CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_;
+ CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedStructAttributeAttribute>> testDerivedStructAttribute_;
+ CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedArrayAttributeAttribute>> testDerivedArrayAttribute_;
+
+ CommonAPI::DBus::DBusEvent<TestPredefinedTypeBroadcastEvent, uint32_t, std::string> testPredefinedTypeBroadcast_;
+ CommonAPI::DBus::DBusSelectiveEvent<TestSelectiveBroadcastSelectiveEvent> testSelectiveBroadcastSelective_;
+ CommonAPI::DBus::DBusSelectiveEvent<TestBroadcastWithOutArgsSelectiveEvent, uint32_t, std::string> testBroadcastWithOutArgsSelective_;
+
+};
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
index 9cd1cf9..c2e343a 100644
--- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
@@ -1,36 +1,31 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "TestInterfaceDBusStubAdapter.h"
-#include <commonapi/tests/TestInterface.h>
+#include <v1_0/commonapi/tests/TestInterface.hpp>
+#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
+namespace v1_0 {
namespace commonapi {
namespace tests {
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<TestInterfaceDBusStubAdapter>(_address, _connection, _stub);
}
INITIALIZER(registerTestInterfaceDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(),
- &createTestInterfaceDBusStubAdapter);
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ TestInterface::getInterface(), &createTestInterfaceDBusStubAdapter);
}
-
-
TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() {
deactivateManagedInstances();
TestInterfaceDBusStubAdapterHelper::deinit();
@@ -88,36 +83,36 @@ const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml
"<method name=\"testEmptyMethod\">\n"
"</method>\n"
"<method name=\"testVoidPredefinedTypeMethod\">\n"
- "<arg name=\"uint32Value\" type=\"u\" direction=\"in\" />\n"
- "<arg name=\"stringValue\" type=\"s\" direction=\"in\" />\n"
+ "<arg name=\"_uint32Value\" type=\"u\" direction=\"in\" />\n"
+ "<arg name=\"_stringValue\" type=\"s\" direction=\"in\" />\n"
"</method>\n"
"<method name=\"testPredefinedTypeMethod\">\n"
- "<arg name=\"uint32InValue\" type=\"u\" direction=\"in\" />\n"
- "<arg name=\"stringInValue\" type=\"s\" direction=\"in\" />\n"
- "<arg name=\"uint32OutValue\" type=\"u\" direction=\"out\" />\n"
- "<arg name=\"stringOutValue\" type=\"s\" direction=\"out\" />\n"
+ "<arg name=\"_uint32InValue\" type=\"u\" direction=\"in\" />\n"
+ "<arg name=\"_stringInValue\" type=\"s\" direction=\"in\" />\n"
+ "<arg name=\"_uint32OutValue\" type=\"u\" direction=\"out\" />\n"
+ "<arg name=\"_stringOutValue\" type=\"s\" direction=\"out\" />\n"
"</method>\n"
"<method name=\"testVoidDerivedTypeMethod\">\n"
- "<arg name=\"testEnumExtended2Value\" type=\"i\" direction=\"in\" />\n"
- "<arg name=\"testMapValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n"
+ "<arg name=\"_testEnumExtended2Value\" type=\"i\" direction=\"in\" />\n"
+ "<arg name=\"_testMapValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n"
"</method>\n"
"<method name=\"testDerivedTypeMethod\">\n"
- "<arg name=\"testEnumExtended2InValue\" type=\"i\" direction=\"in\" />\n"
- "<arg name=\"testMapInValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n"
- "<arg name=\"testEnumExtended2OutValue\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"testMapOutValue\" type=\"a{ua(sq)}\" direction=\"out\" />\n"
+ "<arg name=\"_testEnumExtended2InValue\" type=\"i\" direction=\"in\" />\n"
+ "<arg name=\"_testMapInValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n"
+ "<arg name=\"_testEnumExtended2OutValue\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_testMapOutValue\" type=\"a{ua(sq)}\" direction=\"out\" />\n"
"</method>\n"
"<method name=\"TestArrayOfPolymorphicStructMethod\">\n"
- "<arg name=\"inArray\" type=\"a(uv)\" direction=\"in\" />\n"
+ "<arg name=\"_inArray\" type=\"a(uv)\" direction=\"in\" />\n"
"</method>\n"
"<method name=\"TestMapOfPolymorphicStructMethod\">\n"
- "<arg name=\"inMap\" type=\"a{y(uv)}\" direction=\"in\" />\n"
+ "<arg name=\"_inMap\" type=\"a{y(uv)}\" direction=\"in\" />\n"
"</method>\n"
"<method name=\"TestStructWithPolymorphicMemberMethod\">\n"
- "<arg name=\"inStruct\" type=\"(u(uv))\" direction=\"in\" />\n"
+ "<arg name=\"_inStruct\" type=\"(u(uv))\" direction=\"in\" />\n"
"</method>\n"
"<method name=\"TestStructWithEnumKeyMapMember\">\n"
- "<arg name=\"inStruct\" type=\"(a{is})\" direction=\"in\" />\n"
+ "<arg name=\"_inStruct\" type=\"(a{is})\" direction=\"in\" />\n"
"</method>\n"
;
@@ -145,11 +140,11 @@ CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)");
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
&TestInterfaceStub::getTestDerivedStructAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
@@ -159,11 +154,11 @@ CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at");
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
&TestInterfaceStub::getTestDerivedArrayAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
@@ -177,47 +172,47 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
std::tuple<>,
std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(&TestInterfaceStub::testEmptyMethod, "");
+ > TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(&TestInterfaceStub::testEmptyMethod, "", std::tuple<>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, "");
+ > TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, "", std::tuple<uint32_t, std::string>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<uint32_t, std::string>
- > TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us");
+ > TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us", std::tuple<uint32_t, std::string, uint32_t, std::string>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, "");
+ > TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, "", std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>
- > TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}");
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>
+ > TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}", std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>,
+ std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestArrayOfPolymorphicStructMethod, "");
+ > TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestArrayOfPolymorphicStructMethod, "", std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::MapIntToPolymorphic>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestMapOfPolymorphicStructMethod, "");
+ > TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestMapOfPolymorphicStructMethod, "", std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(&TestInterfaceStub::TestStructWithPolymorphicMemberMethod, "");
+ > TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(&TestInterfaceStub::TestStructWithPolymorphicMemberMethod, "", std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, "");
+ > TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, "", std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>());
void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) {
@@ -229,8 +224,8 @@ void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttrib
value
);
}
-void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>>
+void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value) {
+ CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestStructExtended>>
::sendSignal(
*this,
"onTestDerivedStructAttributeAttributeChanged",
@@ -238,8 +233,8 @@ void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttribu
value
);
}
-void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>>
+void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value) {
+ CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<::commonapi::tests::DerivedTypeCollection::TestArrayUInt64>>
::sendSignal(
*this,
"onTestDerivedArrayAttributeAttributeChanged",
@@ -271,14 +266,14 @@ CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
std::tuple<>
> TestInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, "");
-void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId);
+void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> _client) {
+ std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClient = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(_client);
- if(dbusClientId)
+ if(dbusClient)
{
CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>>
::sendSignal(
- dbusClientId->getDBusId(),
+ dbusClient->getDBusId(),
*this,
"TestSelectiveBroadcast",
""
@@ -286,28 +281,24 @@ void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(c
}
}
-void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) {
- std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList;
- actualReceiverList = receivers;
+void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
+ std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList = _receivers;
- if(receivers == NULL)
+ if (!_receivers)
actualReceiverList = subscribersForTestSelectiveBroadcastSelective_;
- for (auto clientIdIterator = actualReceiverList->cbegin();
- clientIdIterator != actualReceiverList->cend();
- clientIdIterator++) {
- if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) {
+ for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) {
+ if (!_receivers || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) {
fireTestSelectiveBroadcastSelective(*clientIdIterator);
}
}
}
void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) {
- auto stub = stub_.lock();
- bool ok = stub->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId);
+ bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId);
if (ok) {
subscribersForTestSelectiveBroadcastSelective_->insert(clientId);
- stub->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED);
+ stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED);
success = true;
} else {
success = false;
@@ -317,8 +308,7 @@ void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSel
void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) {
subscribersForTestSelectiveBroadcastSelective_->erase(clientId);
- auto stub = stub_.lock();
- stub->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED);
+ stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED);
}
std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() {
@@ -339,44 +329,40 @@ CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
std::tuple<>
> TestInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, "");
-void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) {
- std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId);
+void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> _client, const uint32_t &_uint32Value, const std::string &_stringValue) {
+ std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClient = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(_client);
- if(dbusClientId)
+ if(dbusClient)
{
CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>>
::sendSignal(
- dbusClientId->getDBusId(),
+ dbusClient->getDBusId(),
*this,
"TestBroadcastWithOutArgs",
"us",
- uint32Value, stringValue
+ _uint32Value, _stringValue
);
}
}
-void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) {
- std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList;
- actualReceiverList = receivers;
+void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
+ std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList = _receivers;
- if(receivers == NULL)
+ if (!_receivers)
actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_;
- for (auto clientIdIterator = actualReceiverList->cbegin();
- clientIdIterator != actualReceiverList->cend();
- clientIdIterator++) {
- if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) {
- fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue);
+ for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) {
+ if (!_receivers || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) {
+ fireTestBroadcastWithOutArgsSelective(*clientIdIterator, _uint32Value, _stringValue);
}
}
}
void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) {
- auto stub = stub_.lock();
- bool ok = stub->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId);
+ bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId);
if (ok) {
subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId);
- stub->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED);
+ stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED);
success = true;
} else {
success = false;
@@ -386,8 +372,7 @@ void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsS
void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) {
subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId);
- auto stub = stub_.lock();
- stub->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED);
+ stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED);
}
std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() {
@@ -405,31 +390,12 @@ const CommonAPI::DBus::StubAttributeTable& TestInterfaceDBusStubAdapterInternal:
}
TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- TestInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<TestInterfaceStub>(stub),
- false),
- stubDispatcherTable_({
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
+ TestInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<TestInterfaceStub>(_stub), false),
+ stubDispatcherTable_({
{ { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher }
, { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher },
{ { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher }
@@ -467,3 +433,4 @@ const bool TestInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp
index 44c87e9..8d42c65 100644
--- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp
@@ -1,60 +1,59 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_H_
+#ifndef COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
+#define COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <commonapi/tests/TestInterfaceStub.h>
+#include <v1_0/commonapi/tests/TestInterfaceStub.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
typedef CommonAPI::DBus::DBusStubAdapterHelper<TestInterfaceStub> TestInterfaceDBusStubAdapterHelper;
-class TestInterfaceDBusStubAdapterInternal: public virtual TestInterfaceStubAdapter, public TestInterfaceDBusStubAdapterHelper {
- public:
+class TestInterfaceDBusStubAdapterInternal
+ : public virtual TestInterfaceStubAdapter,
+ public TestInterfaceDBusStubAdapterHelper
+{
+public:
TestInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
~TestInterfaceDBusStubAdapterInternal();
virtual const bool hasFreedesktopProperties();
void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value);
- void fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value);
- void fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value);
+ void fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value);
+ void fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value);
void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue);
- void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId);
- void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL);
+ void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> _client);
+ void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
void subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success);
void unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId);
std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective();
- void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue);
- void sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL);
+ void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> _client, const uint32_t &_uint32Value, const std::string &_stringValue);
+ void sendTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success);
void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId);
std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective();
@@ -64,7 +63,7 @@ class TestInterfaceDBusStubAdapterInternal: public virtual TestInterfaceStubAdap
const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
void deactivateManagedInstances();
-
+
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
TestInterfaceStub,
@@ -81,19 +80,19 @@ static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
> setTestPredefinedTypeAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> getTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestStructExtended
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended
> setTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> getTestDerivedArrayAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
TestInterfaceStub,
- DerivedTypeCollection::TestArrayUInt64
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64
> setTestDerivedArrayAttributeAttributeStubDispatcher;
@@ -114,32 +113,32 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testPredefinedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
std::tuple<>
> testVoidDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
- std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>
> testDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>,
+ std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
std::tuple<>
> testArrayOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::MapIntToPolymorphic>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>
> testMapOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>
> testStructWithPolymorphicMemberMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
TestInterfaceStub,
- std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>,
+ std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>
> testStructWithEnumKeyMapMemberStubDispatcher;
@@ -180,35 +179,27 @@ static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
};
-class TestInterfaceDBusStubAdapter: public TestInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<TestInterfaceDBusStubAdapter> {
+class TestInterfaceDBusStubAdapter
+ : public TestInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<TestInterfaceDBusStubAdapter> {
public:
TestInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- TestInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ false),
+ TestInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
};
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_H_
+#endif // COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/commonapi/tests/TestInterfaceProxy.h b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceProxy.hpp
index 60b5691..94da6c8 100644
--- a/src/test/commonapi/tests/TestInterfaceProxy.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceProxy.hpp
@@ -1,33 +1,36 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_PROXY_H_
-#define COMMONAPI_TESTS_Test_Interface_PROXY_H_
+#ifndef COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
+#define COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
-#include "TestInterfaceProxyBase.h"
+#include <v1_0/commonapi/tests/TestInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/AttributeExtension.h>
-#include <CommonAPI/Factory.h>
+#include <CommonAPI/AttributeExtension.hpp>
+#include <CommonAPI/Factory.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
template <typename ... _AttributeExtensions>
-class TestInterfaceProxy: virtual public TestInterface, virtual public TestInterfaceProxyBase
-, public _AttributeExtensions... {
+class TestInterfaceProxy
+ : virtual public TestInterface,
+ virtual public TestInterfaceProxyBase,
+ public _AttributeExtensions... {
public:
TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~TestInterfaceProxy();
@@ -80,7 +83,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testEmptyMethod(CommonAPI::CallStatus& callStatus);
+ virtual void testEmptyMethod(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testEmptyMethod with asynchronous semantics.
*
@@ -91,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);
+ virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testVoidPredefinedTypeMethod with synchronous semantics.
*
@@ -100,7 +103,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testVoidPredefinedTypeMethod(const uint32_t& uint32Value, const std::string& stringValue, CommonAPI::CallStatus& callStatus);
+ virtual void testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testVoidPredefinedTypeMethod with asynchronous semantics.
*
@@ -111,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);
+ virtual std::future<CommonAPI::CallStatus> testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testPredefinedTypeMethod with synchronous semantics.
*
@@ -121,7 +124,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testPredefinedTypeMethod(const uint32_t& uint32InValue, const std::string& stringInValue, CommonAPI::CallStatus& callStatus, uint32_t& uint32OutValue, std::string& stringOutValue);
+ virtual void testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_status, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testPredefinedTypeMethod with asynchronous semantics.
*
@@ -132,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);
+ virtual std::future<CommonAPI::CallStatus> testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testVoidDerivedTypeMethod with synchronous semantics.
*
@@ -141,7 +144,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testVoidDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, CommonAPI::CallStatus& callStatus);
+ virtual void testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testVoidDerivedTypeMethod with asynchronous semantics.
*
@@ -152,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 DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, TestVoidDerivedTypeMethodAsyncCallback 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);
/**
* Calls testDerivedTypeMethod with synchronous semantics.
*
@@ -162,7 +165,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, CommonAPI::CallStatus& callStatus, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue);
+ virtual void testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_status, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testDerivedTypeMethod with asynchronous semantics.
*
@@ -173,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 DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, TestDerivedTypeMethodAsyncCallback 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);
/**
* Calls TestArrayOfPolymorphicStructMethod with synchronous semantics.
*
@@ -182,7 +185,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, CommonAPI::CallStatus& callStatus);
+ virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestArrayOfPolymorphicStructMethod with asynchronous semantics.
*
@@ -193,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<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, TestArrayOfPolymorphicStructMethodAsyncCallback 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);
/**
* Calls TestMapOfPolymorphicStructMethod with synchronous semantics.
*
@@ -202,7 +205,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void TestMapOfPolymorphicStructMethod(const DerivedTypeCollection::MapIntToPolymorphic& inMap, CommonAPI::CallStatus& callStatus);
+ virtual void TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestMapOfPolymorphicStructMethod with asynchronous semantics.
*
@@ -213,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 DerivedTypeCollection::MapIntToPolymorphic& inMap, TestMapOfPolymorphicStructMethodAsyncCallback callback);
+ virtual std::future<CommonAPI::CallStatus> TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestStructWithPolymorphicMemberMethod with synchronous semantics.
*
@@ -222,7 +225,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void TestStructWithPolymorphicMemberMethod(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, CommonAPI::CallStatus& callStatus);
+ virtual void TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestStructWithPolymorphicMemberMethod with asynchronous semantics.
*
@@ -233,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 DerivedTypeCollection::StructWithPolymorphicMember& inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback callback);
+ virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestStructWithEnumKeyMapMember with synchronous semantics.
*
@@ -242,7 +245,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void TestStructWithEnumKeyMapMember(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, CommonAPI::CallStatus& callStatus);
+ virtual void TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestStructWithEnumKeyMapMember with asynchronous semantics.
*
@@ -253,28 +256,13 @@ 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 DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback);
+ virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -302,11 +290,7 @@ public:
std::shared_ptr<TestInterfaceProxyBase> delegate_;
};
-#ifdef WIN32
- typedef TestInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> TestInterfaceProxyDefault;
-#else
- typedef TestInterfaceProxy<> TestInterfaceProxyDefault;
-#endif
+typedef TestInterfaceProxy<> TestInterfaceProxyDefault;
namespace TestInterfaceExtensions {
template <template <typename > class _ExtensionType>
@@ -391,108 +375,93 @@ TestInterfaceProxy<_AttributeExtensions...>::~TestInterfaceProxy() {
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testEmptyMethod(CommonAPI::CallStatus& callStatus) {
- delegate_->testEmptyMethod(callStatus);
+void TestInterfaceProxy<_AttributeExtensions...>::testEmptyMethod(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->testEmptyMethod(_status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testEmptyMethodAsync(TestEmptyMethodAsyncCallback callback) {
- return delegate_->testEmptyMethodAsync(callback);
+std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->testEmptyMethodAsync(_callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testVoidPredefinedTypeMethod(const uint32_t& uint32Value, const std::string& stringValue, CommonAPI::CallStatus& callStatus) {
- delegate_->testVoidPredefinedTypeMethod(uint32Value, stringValue, callStatus);
+void TestInterfaceProxy<_AttributeExtensions...>::testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->testVoidPredefinedTypeMethod(_uint32Value, _stringValue, _status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testVoidPredefinedTypeMethodAsync(const uint32_t& uint32Value, const std::string& stringValue, TestVoidPredefinedTypeMethodAsyncCallback callback) {
- return delegate_->testVoidPredefinedTypeMethodAsync(uint32Value, stringValue, callback);
+std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->testVoidPredefinedTypeMethodAsync(_uint32Value, _stringValue, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testPredefinedTypeMethod(const uint32_t& uint32InValue, const std::string& stringInValue, CommonAPI::CallStatus& callStatus, uint32_t& uint32OutValue, std::string& stringOutValue) {
- delegate_->testPredefinedTypeMethod(uint32InValue, stringInValue, callStatus, uint32OutValue, stringOutValue);
+void TestInterfaceProxy<_AttributeExtensions...>::testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_status, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info) {
+ delegate_->testPredefinedTypeMethod(_uint32InValue, _stringInValue, _status, _uint32OutValue, _stringOutValue, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testPredefinedTypeMethodAsync(const uint32_t& uint32InValue, const std::string& stringInValue, TestPredefinedTypeMethodAsyncCallback callback) {
- return delegate_->testPredefinedTypeMethodAsync(uint32InValue, stringInValue, callback);
+std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->testPredefinedTypeMethodAsync(_uint32InValue, _stringInValue, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testVoidDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, CommonAPI::CallStatus& callStatus) {
- delegate_->testVoidDerivedTypeMethod(testEnumExtended2Value, testMapValue, callStatus);
+void TestInterfaceProxy<_AttributeExtensions...>::testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->testVoidDerivedTypeMethod(_testEnumExtended2Value, _testMapValue, _status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testVoidDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, TestVoidDerivedTypeMethodAsyncCallback callback) {
- return delegate_->testVoidDerivedTypeMethodAsync(testEnumExtended2Value, testMapValue, callback);
+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) {
+ return delegate_->testVoidDerivedTypeMethodAsync(_testEnumExtended2Value, _testMapValue, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, CommonAPI::CallStatus& callStatus, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) {
- delegate_->testDerivedTypeMethod(testEnumExtended2InValue, testMapInValue, callStatus, testEnumExtended2OutValue, testMapOutValue);
+void TestInterfaceProxy<_AttributeExtensions...>::testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_status, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info) {
+ delegate_->testDerivedTypeMethod(_testEnumExtended2InValue, _testMapInValue, _status, _testEnumExtended2OutValue, _testMapOutValue, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, TestDerivedTypeMethodAsyncCallback callback) {
- return delegate_->testDerivedTypeMethodAsync(testEnumExtended2InValue, testMapInValue, callback);
+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) {
+ return delegate_->testDerivedTypeMethodAsync(_testEnumExtended2InValue, _testMapInValue, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, CommonAPI::CallStatus& callStatus) {
- delegate_->TestArrayOfPolymorphicStructMethod(inArray, callStatus);
+void TestInterfaceProxy<_AttributeExtensions...>::TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->TestArrayOfPolymorphicStructMethod(_inArray, _status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>& inArray, TestArrayOfPolymorphicStructMethodAsyncCallback callback) {
- return delegate_->TestArrayOfPolymorphicStructMethodAsync(inArray, callback);
+std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->TestArrayOfPolymorphicStructMethodAsync(_inArray, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestMapOfPolymorphicStructMethod(const DerivedTypeCollection::MapIntToPolymorphic& inMap, CommonAPI::CallStatus& callStatus) {
- delegate_->TestMapOfPolymorphicStructMethod(inMap, callStatus);
+void TestInterfaceProxy<_AttributeExtensions...>::TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->TestMapOfPolymorphicStructMethod(_inMap, _status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestMapOfPolymorphicStructMethodAsync(const DerivedTypeCollection::MapIntToPolymorphic& inMap, TestMapOfPolymorphicStructMethodAsyncCallback callback) {
- return delegate_->TestMapOfPolymorphicStructMethodAsync(inMap, callback);
+std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->TestMapOfPolymorphicStructMethodAsync(_inMap, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestStructWithPolymorphicMemberMethod(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, CommonAPI::CallStatus& callStatus) {
- delegate_->TestStructWithPolymorphicMemberMethod(inStruct, callStatus);
+void TestInterfaceProxy<_AttributeExtensions...>::TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->TestStructWithPolymorphicMemberMethod(_inStruct, _status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestStructWithPolymorphicMemberMethodAsync(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback callback) {
- return delegate_->TestStructWithPolymorphicMemberMethodAsync(inStruct, callback);
+std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->TestStructWithPolymorphicMemberMethodAsync(_inStruct, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestStructWithEnumKeyMapMember(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, CommonAPI::CallStatus& callStatus) {
- delegate_->TestStructWithEnumKeyMapMember(inStruct, callStatus);
+void TestInterfaceProxy<_AttributeExtensions...>::TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->TestStructWithEnumKeyMapMember(_inStruct, _status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback) {
- return delegate_->TestStructWithEnumKeyMapMemberAsync(inStruct, callback);
+std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->TestStructWithEnumKeyMapMemberAsync(_inStruct, _callback, _info);
}
template <typename ... _AttributeExtensions>
-std::string TestInterfaceProxy<_AttributeExtensions...>::getAddress() const {
+const CommonAPI::Address &TestInterfaceProxy<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
-const std::string& TestInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& TestInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
bool TestInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -515,17 +484,18 @@ CommonAPI::InterfaceVersionAttribute& TestInterfaceProxy<_AttributeExtensions...
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
namespace CommonAPI {
template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyFactoryHelper<commonapi::tests::TestInterfaceProxy,
+struct DefaultAttributeProxyHelper<::v1_0::commonapi::tests::TestInterfaceProxy,
_AttributeExtension> {
- typedef typename commonapi::tests::TestInterfaceProxy<
- commonapi::tests::TestInterfaceExtensions::TestPredefinedTypeAttributeAttributeExtension<_AttributeExtension>,
- commonapi::tests::TestInterfaceExtensions::TestDerivedStructAttributeAttributeExtension<_AttributeExtension>,
- commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<_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>
> class_t;
};
}
-#endif // COMMONAPI_TESTS_Test_Interface_PROXY_H_
+#endif // COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceProxyBase.hpp b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceProxyBase.hpp
new file mode 100644
index 0000000..8ede5a7
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceProxyBase.hpp
@@ -0,0 +1,98 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_PROXY_BASE_HPP_
+#define COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
+
+#include <v1_0/commonapi/tests/TestInterface.hpp>
+
+
+#include <commonapi/tests/DerivedTypeCollection.hpp>
+#include <commonapi/tests/PredefinedTypeCollection.hpp>
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/Deployment.hpp>
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/Struct.hpp>
+#include <cstdint>
+#include <unordered_map>
+#include <vector>
+
+#include <CommonAPI/Attribute.hpp>
+#include <CommonAPI/Event.hpp>
+#include <CommonAPI/SelectiveEvent.hpp>
+#include <CommonAPI/Proxy.hpp>
+#include <functional>
+#include <future>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+class TestInterfaceProxyBase
+ : virtual public CommonAPI::Proxy {
+public:
+ typedef CommonAPI::ObservableAttribute<uint32_t> TestPredefinedTypeAttributeAttribute;
+ typedef CommonAPI::ObservableAttribute<::commonapi::tests::DerivedTypeCollection::TestStructExtended> TestDerivedStructAttributeAttribute;
+ typedef CommonAPI::ObservableAttribute<::commonapi::tests::DerivedTypeCollection::TestArrayUInt64> TestDerivedArrayAttributeAttribute;
+ typedef CommonAPI::Event<
+ uint32_t, std::string
+ > TestPredefinedTypeBroadcastEvent;
+ typedef CommonAPI::SelectiveEvent<> TestSelectiveBroadcastSelectiveEvent;
+ typedef CommonAPI::SelectiveEvent<uint32_t, std::string> TestBroadcastWithOutArgsSelectiveEvent;
+
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestEmptyMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestVoidPredefinedTypeMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&, const uint32_t&, const std::string&)> TestPredefinedTypeMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestVoidDerivedTypeMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&, const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2&, const ::commonapi::tests::DerivedTypeCollection::TestMap&)> TestDerivedTypeMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestArrayOfPolymorphicStructMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestMapOfPolymorphicStructMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestStructWithPolymorphicMemberMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&)> TestStructWithEnumKeyMapMemberAsyncCallback;
+
+ virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() = 0;
+ virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() = 0;
+ virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() = 0;
+
+ virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent() = 0;
+ virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent() = 0;
+ virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent() = 0;
+
+ virtual void testEmptyMethod(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr) = 0;
+ virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr) = 0;
+ virtual void testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_status, 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 void testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_status, 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 void testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_status, 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 void testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_status, ::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 void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_status, 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 void TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_status, 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 void TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_status, 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 void TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_status, 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;
+};
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
diff --git a/src/test/commonapi/tests/TestInterfaceStub.h b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStub.hpp
index d45ad3b..af3f02e 100644
--- a/src/test/commonapi/tests/TestInterfaceStub.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStub.hpp
@@ -1,38 +1,42 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_STUB_H_
-#define COMMONAPI_TESTS_Test_Interface_STUB_H_
+#ifndef COMMONAPI_TESTS_Test_Interface_STUB_HPP_
+#define COMMONAPI_TESTS_Test_Interface_STUB_HPP_
+#include <functional>
-#include <commonapi/tests/DerivedTypeCollection.h>
-#include <commonapi/tests/PredefinedTypeCollection.h>
-#include "TestInterface.h"
+#include <commonapi/tests/DerivedTypeCollection.hpp>
+#include <commonapi/tests/PredefinedTypeCollection.hpp>
+
+#include <v1_0/commonapi/tests/TestInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/InputStream.h>
-#include <CommonAPI/OutputStream.h>
-#include <CommonAPI/SerializableStruct.h>
+#include <CommonAPI/Deployment.hpp>
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/Struct.hpp>
#include <cstdint>
#include <unordered_map>
#include <unordered_set>
#include <vector>
-#include <CommonAPI/Stub.h>
+#include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
@@ -42,26 +46,28 @@ namespace tests {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
-class TestInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public TestInterface {
+class TestInterfaceStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public TestInterface {
public:
///Notifies all remote listeners about a change of value of the attribute TestPredefinedTypeAttribute.
virtual void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& TestPredefinedTypeAttribute) = 0;
///Notifies all remote listeners about a change of value of the attribute TestDerivedStructAttribute.
- virtual void fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& TestDerivedStructAttribute) = 0;
+ virtual void fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestDerivedStructAttribute) = 0;
///Notifies all remote listeners about a change of value of the attribute TestDerivedArrayAttribute.
- virtual void fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& TestDerivedArrayAttribute) = 0;
+ virtual void fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestDerivedArrayAttribute) = 0;
/**
* Sends a broadcast event for TestPredefinedTypeBroadcast. Should not be called directly.
* Instead, the "fire<broadcastName>Event" methods of the stub should be used.
*/
- virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) = 0;
+ virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue) = 0;
/**
* Sends a selective broadcast event for TestSelectiveBroadcast. Should not be called directly.
* Instead, the "fire<broadcastName>Event" methods of the stub should be used.
*/
- virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
- virtual void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0;
+ virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
+ virtual void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
virtual void subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) = 0;
virtual void unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective() = 0;
@@ -69,8 +75,8 @@ class TestInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public Te
* Sends a selective broadcast event for TestBroadcastWithOutArgs. Should not be called directly.
* Instead, the "fire<broadcastName>Event" methods of the stub should be used.
*/
- virtual void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) = 0;
- virtual void sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0;
+ virtual void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> _client, const uint32_t &_uint32Value, const std::string &_stringValue) = 0;
+ virtual void sendTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
virtual void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) = 0;
virtual void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective() = 0;
@@ -86,7 +92,6 @@ protected:
std::shared_ptr<CommonAPI::ClientIdList> subscribersForTestBroadcastWithOutArgsSelective_;
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for TestInterface.
@@ -99,90 +104,99 @@ protected:
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class TestInterfaceStubRemoteEvent {
- public:
+class TestInterfaceStubRemoteEvent
+{
+public:
virtual ~TestInterfaceStubRemoteEvent() { }
/// Verification callback for remote set requests on the attribute TestPredefinedTypeAttribute
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t TestPredefinedTypeAttribute) = 0;
+ virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t TestPredefinedTypeAttribute) = 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> clientId, DerivedTypeCollection::TestStructExtended TestDerivedStructAttribute) = 0;
+ virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended TestDerivedStructAttribute) = 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> clientId, DerivedTypeCollection::TestArrayUInt64 TestDerivedArrayAttribute) = 0;
+ virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 TestDerivedArrayAttribute) = 0;
/// Action callback for remote set requests on the attribute TestDerivedArrayAttribute
virtual void onRemoteTestDerivedArrayAttributeAttributeChanged() = 0;
-
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service TestInterface to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class TestInterfaceStub: public virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent> {
+class TestInterfaceStub
+ : public virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>
+{
public:
- virtual ~TestInterfaceStub() { }
+ typedef std::function<void ()> testEmptyMethodReply_t;
+ typedef std::function<void ()> testVoidPredefinedTypeMethodReply_t;
+ typedef std::function<void (uint32_t _uint32OutValue, std::string _stringOutValue)> testPredefinedTypeMethodReply_t;
+ typedef std::function<void ()> testVoidDerivedTypeMethodReply_t;
+ typedef std::function<void (::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapOutValue)> testDerivedTypeMethodReply_t;
+ typedef std::function<void ()> TestArrayOfPolymorphicStructMethodReply_t;
+ typedef std::function<void ()> TestMapOfPolymorphicStructMethodReply_t;
+ typedef std::function<void ()> TestStructWithPolymorphicMemberMethodReply_t;
+ typedef std::function<void ()> TestStructWithEnumKeyMapMemberReply_t;
+
+ virtual ~TestInterfaceStub() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
/// Provides getter access to the attribute TestPredefinedTypeAttribute
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual const uint32_t &getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
/// Provides getter access to the attribute TestDerivedStructAttribute
- virtual const DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
/// Provides getter access to the attribute TestDerivedArrayAttribute
- virtual const DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
/// This is the method that will be called on remote calls on the method testEmptyMethod.
- virtual void testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual void testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> _client, testEmptyMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method testVoidPredefinedTypeMethod.
- virtual void testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32Value, std::string stringValue) = 0;
+ virtual void testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32Value, std::string _stringValue, testVoidPredefinedTypeMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method testPredefinedTypeMethod.
- virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue) = 0;
+ virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32InValue, std::string _stringInValue, testPredefinedTypeMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method testVoidDerivedTypeMethod.
- virtual void testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue) = 0;
+ virtual void testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2Value, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapValue, testVoidDerivedTypeMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method testDerivedTypeMethod.
- virtual void testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) = 0;
+ virtual void testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2InValue, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapInValue, testDerivedTypeMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method TestArrayOfPolymorphicStructMethod.
- virtual void TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>> inArray) = 0;
+ virtual void TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> _inArray, TestArrayOfPolymorphicStructMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method TestMapOfPolymorphicStructMethod.
- virtual void TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::MapIntToPolymorphic inMap) = 0;
+ virtual void TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic _inMap, TestMapOfPolymorphicStructMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method TestStructWithPolymorphicMemberMethod.
- virtual void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::StructWithPolymorphicMember inStruct) = 0;
+ virtual void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember _inStruct, TestStructWithPolymorphicMemberMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method TestStructWithEnumKeyMapMember.
- virtual void TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::StructWithEnumKeyMap inStruct) = 0;
+ virtual void TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap _inStruct, TestStructWithEnumKeyMapMemberReply_t _reply) = 0;
/// Sends a broadcast event for TestPredefinedTypeBroadcast.
- virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) = 0;
+ virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue) = 0;
/**
* Sends a selective broadcast event for TestSelectiveBroadcast to the given ClientIds.
* The ClientIds must all be out of the set of subscribed clients.
* If no ClientIds are given, the selective broadcast is sent to all subscribed clients.
*/
- virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0;
+ virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
/// retreives the list of all subscribed clients for TestSelectiveBroadcast
virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective() = 0;
/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) = 0;
+ virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) = 0;
/// Hook method for reacting accepting or denying new subscriptions
- virtual bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
/**
* Sends a selective broadcast event for TestBroadcastWithOutArgs to the given ClientIds.
* The ClientIds must all be out of the set of subscribed clients.
* If no ClientIds are given, the selective broadcast is sent to all subscribed clients.
*/
- virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0;
+ virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
/// retreives the list of all subscribed clients for TestBroadcastWithOutArgs
virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective() = 0;
/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) = 0;
+ virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) = 0;
/// Hook method for reacting accepting or denying new subscriptions
- virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
using CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::initStubAdapter;
typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
@@ -193,5 +207,6 @@ public:
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_Test_Interface_STUB_H_
+#endif // COMMONAPI_TESTS_Test_Interface_STUB_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.cpp
new file mode 100644
index 0000000..0b9532b
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.cpp
@@ -0,0 +1,268 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 <assert.h>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+TestInterfaceStubDefault::TestInterfaceStubDefault():
+ remoteEventHandler_(this),
+ interfaceVersion_(TestInterface::getInterfaceVersion()) {
+}
+
+const CommonAPI::Version& TestInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ return interfaceVersion_;
+}
+
+TestInterfaceStubRemoteEvent* TestInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter> &_adapter) {
+ CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
+ return &remoteEventHandler_;
+}
+
+const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute() {
+ return testPredefinedTypeAttributeAttributeValue_;
+}
+
+const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
+ return getTestPredefinedTypeAttributeAttribute();
+}
+
+void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(uint32_t _value) {
+ const bool valueChanged = trySetTestPredefinedTypeAttributeAttribute(std::move(_value));
+ if (valueChanged && stubAdapter_ != NULL) {
+ stubAdapter_->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
+ }
+}
+
+bool TestInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
+ if (!validateTestPredefinedTypeAttributeAttributeRequestedValue(_value))
+ return false;
+
+ const bool valueChanged = (testPredefinedTypeAttributeAttributeValue_ != _value);
+ testPredefinedTypeAttributeAttributeValue_ = std::move(_value);
+ return valueChanged;
+}
+
+bool TestInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value) {
+ return true;
+}
+
+void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ setTestPredefinedTypeAttributeAttribute(_value);
+}
+
+void TestInterfaceStubDefault::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
+ // No operation in default
+}
+
+void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
+ assert(defaultStub_ !=NULL);
+ defaultStub_->onRemoteTestPredefinedTypeAttributeAttributeChanged();
+}
+
+bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
+ assert(defaultStub_ !=NULL);
+ return defaultStub_->trySetTestPredefinedTypeAttributeAttribute(std::move(_value));
+}
+
+bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ return onRemoteSetTestPredefinedTypeAttributeAttribute(_value);
+}
+
+const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTestDerivedStructAttributeAttribute() {
+ return testDerivedStructAttributeAttributeValue_;
+}
+
+const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
+ return getTestDerivedStructAttributeAttribute();
+}
+
+void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ const bool valueChanged = trySetTestDerivedStructAttributeAttribute(std::move(_value));
+ if (valueChanged && stubAdapter_ != NULL) {
+ stubAdapter_->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
+ }
+}
+
+bool TestInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ if (!validateTestDerivedStructAttributeAttributeRequestedValue(_value))
+ return false;
+
+ const bool valueChanged = (testDerivedStructAttributeAttributeValue_ != _value);
+ testDerivedStructAttributeAttributeValue_ = std::move(_value);
+ return valueChanged;
+}
+
+bool TestInterfaceStubDefault::validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value) {
+ return true;
+}
+
+void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ setTestDerivedStructAttributeAttribute(_value);
+}
+
+void TestInterfaceStubDefault::onRemoteTestDerivedStructAttributeAttributeChanged() {
+ // No operation in default
+}
+
+void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedStructAttributeAttributeChanged() {
+ assert(defaultStub_ !=NULL);
+ defaultStub_->onRemoteTestDerivedStructAttributeAttributeChanged();
+}
+
+bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ assert(defaultStub_ !=NULL);
+ return defaultStub_->trySetTestDerivedStructAttributeAttribute(std::move(_value));
+}
+
+bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ return onRemoteSetTestDerivedStructAttributeAttribute(_value);
+}
+
+const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestDerivedArrayAttributeAttribute() {
+ return testDerivedArrayAttributeAttributeValue_;
+}
+
+const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
+ return getTestDerivedArrayAttributeAttribute();
+}
+
+void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ const bool valueChanged = trySetTestDerivedArrayAttributeAttribute(std::move(_value));
+ if (valueChanged && stubAdapter_ != NULL) {
+ stubAdapter_->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
+ }
+}
+
+bool TestInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ if (!validateTestDerivedArrayAttributeAttributeRequestedValue(_value))
+ return false;
+
+ const bool valueChanged = (testDerivedArrayAttributeAttributeValue_ != _value);
+ testDerivedArrayAttributeAttributeValue_ = std::move(_value);
+ return valueChanged;
+}
+
+bool TestInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value) {
+ return true;
+}
+
+void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ setTestDerivedArrayAttributeAttribute(_value);
+}
+
+void TestInterfaceStubDefault::onRemoteTestDerivedArrayAttributeAttributeChanged() {
+ // No operation in default
+}
+
+void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedArrayAttributeAttributeChanged() {
+ assert(defaultStub_ !=NULL);
+ defaultStub_->onRemoteTestDerivedArrayAttributeAttributeChanged();
+}
+
+bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ assert(defaultStub_ !=NULL);
+ return defaultStub_->trySetTestDerivedArrayAttributeAttribute(std::move(_value));
+}
+
+bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ return onRemoteSetTestDerivedArrayAttributeAttribute(_value);
+}
+
+
+void TestInterfaceStubDefault::testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> _client, testEmptyMethodReply_t _reply) {
+ _reply();
+}
+
+void TestInterfaceStubDefault::testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32Value, std::string _stringValue, testVoidPredefinedTypeMethodReply_t _reply) {
+ _reply();
+}
+
+void TestInterfaceStubDefault::testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32InValue, std::string _stringInValue, testPredefinedTypeMethodReply_t _reply) {
+ uint32_t uint32OutValue;
+ 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) {
+ _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;
+ ::commonapi::tests::DerivedTypeCollection::TestMap testMapOutValue;
+ _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) {
+ _reply();
+}
+
+void TestInterfaceStubDefault::TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic _inMap, TestMapOfPolymorphicStructMethodReply_t _reply) {
+ _reply();
+}
+
+void TestInterfaceStubDefault::TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember _inStruct, TestStructWithPolymorphicMemberMethodReply_t _reply) {
+ _reply();
+}
+
+void TestInterfaceStubDefault::TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap _inStruct, TestStructWithEnumKeyMapMemberReply_t _reply) {
+ _reply();
+}
+
+
+void TestInterfaceStubDefault::fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue) {
+ assert(stubAdapter_ !=NULL);
+ stubAdapter_->fireTestPredefinedTypeBroadcastEvent(_uint32Value, _stringValue);
+}
+void TestInterfaceStubDefault::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
+ assert(stubAdapter_ !=NULL);
+ stubAdapter_->sendTestSelectiveBroadcastSelective(_receivers);
+}
+void TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) {
+ // No operation in default
+}
+bool TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) {
+ // Accept in default
+ return true;
+}
+std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestSelectiveBroadcastSelective() {
+ assert(stubAdapter_ !=NULL);
+ return(stubAdapter_->getSubscribersForTestSelectiveBroadcastSelective());
+}
+
+void TestInterfaceStubDefault::fireTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
+ assert(stubAdapter_ !=NULL);
+ stubAdapter_->sendTestBroadcastWithOutArgsSelective(_uint32Value, _stringValue, _receivers);
+}
+void TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) {
+ // No operation in default
+}
+bool TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) {
+ // Accept in default
+ return true;
+}
+std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestBroadcastWithOutArgsSelective() {
+ assert(stubAdapter_ !=NULL);
+ return(stubAdapter_->getSubscribersForTestBroadcastWithOutArgsSelective());
+}
+
+
+
+TestInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestInterfaceStubDefault *_defaultStub)
+ :
+ defaultStub_(_defaultStub) {
+}
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.hpp b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.hpp
new file mode 100644
index 0000000..7f00d78
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/TestInterfaceStubDefault.hpp
@@ -0,0 +1,122 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_STUB_DEFAULT_HPP_
+#define COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_HPP_
+
+
+#include <v1_0/commonapi/tests/TestInterfaceStub.hpp>
+#include <sstream>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+
+/**
+ * Provides a default implementation for TestInterfaceStubRemoteEvent and
+ * TestInterfaceStub. Method callbacks have an empty implementation,
+ * remote set calls on attributes will always change the value of the attribute
+ * to the one received.
+ *
+ * Override this stub if you only want to provide a subset of the functionality
+ * that would be defined for this service, and/or if you do not need any non-default
+ * behaviour.
+ */
+class TestInterfaceStubDefault
+ : public virtual TestInterfaceStub {
+public:
+ TestInterfaceStubDefault();
+
+ TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter> &_adapter);
+
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
+
+ virtual const uint32_t& getTestPredefinedTypeAttributeAttribute();
+ virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
+ virtual void setTestPredefinedTypeAttributeAttribute(uint32_t _value);
+ virtual void setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
+ virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute();
+ virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
+ virtual void setTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
+ virtual void setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
+ virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute();
+ virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
+ virtual void setTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
+ virtual void setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
+
+ virtual void testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> _client, testEmptyMethodReply_t _reply);
+ virtual void testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32Value, std::string _stringValue, testVoidPredefinedTypeMethodReply_t _reply);
+ virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32InValue, std::string _stringInValue, testPredefinedTypeMethodReply_t _reply);
+ virtual void testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2Value, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapValue, testVoidDerivedTypeMethodReply_t _reply);
+ virtual void testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2InValue, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapInValue, testDerivedTypeMethodReply_t _reply);
+ virtual void TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> _inArray, TestArrayOfPolymorphicStructMethodReply_t _reply);
+ virtual void TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic _inMap, TestMapOfPolymorphicStructMethodReply_t _reply);
+ virtual void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember _inStruct, TestStructWithPolymorphicMemberMethodReply_t _reply);
+ virtual void TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap _inStruct, TestStructWithEnumKeyMapMemberReply_t _reply);
+
+virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue);
+virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
+virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective();
+/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
+virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event);
+/// Hook method for reacting accepting or denying new subscriptions
+virtual bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client);
+virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
+virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective();
+/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
+virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event);
+/// Hook method for reacting accepting or denying new subscriptions
+virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client);
+
+
+protected:
+ virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t _value);
+ virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value);
+ virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
+ virtual bool trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
+ virtual bool validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value);
+ virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
+ virtual bool trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
+ virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value);
+ virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
+ class RemoteEventHandler: public virtual TestInterfaceStubRemoteEvent {
+ public:
+ RemoteEventHandler(TestInterfaceStubDefault *_defaultStub);
+
+ virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t _value);
+ virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
+ virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
+
+ virtual bool onRemoteSetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
+ virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
+ virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
+
+ virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
+ virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
+ virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
+
+
+ private:
+ TestInterfaceStubDefault *defaultStub_;
+ };
+private:
+ TestInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
+
+ uint32_t testPredefinedTypeAttributeAttributeValue_;
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_;
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_;
+
+ CommonAPI::Version interfaceVersion_;
+};
+
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.cpp
new file mode 100644
index 0000000..fa8200d
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.cpp
@@ -0,0 +1,26 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "BranchInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+#ifndef WIN32
+const int32_t BranchInterface::testBranchMethodError::OK;
+const int32_t BranchInterface::testBranchMethodError::NOTOK;
+#endif
+
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.hpp
new file mode 100644
index 0000000..fc1c1ab
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterface.hpp
@@ -0,0 +1,64 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_BRANCH_INTERFACE_HPP_
+#define COMMONAPI_TESTS_MANAGED_BRANCH_INTERFACE_HPP_
+
+
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/Types.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class BranchInterface {
+public:
+ virtual ~BranchInterface() { }
+
+ static inline const char* getInterface();
+ static inline CommonAPI::Version getInterfaceVersion();
+
+ struct testBranchMethodError : CommonAPI::Enumeration<int32_t> {
+ testBranchMethodError() = default;
+ testBranchMethodError(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ static const int32_t OK = 0;
+ static const int32_t NOTOK = 1;
+ };
+};
+
+const char* BranchInterface::getInterface() {
+ return ("commonapi.tests.managed.BranchInterface");
+}
+
+CommonAPI::Version BranchInterface::getInterfaceVersion() {
+ return CommonAPI::Version(1, 0);
+}
+
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+namespace CommonAPI {
+}
+
+#endif // COMMONAPI_TESTS_MANAGED_BRANCH_INTERFACE_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..9bf65e2
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
@@ -0,0 +1,71 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 &_status, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<BranchInterface::testBranchMethodError, int32_t, std::string> >::callMethodWithReply(
+ *this,
+ "testBranchMethod",
+ "is",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt, _inString,
+ _status,
+ _error
+ , _outInt, _outString);
+ }
+ std::future<CommonAPI::CallStatus> BranchInterfaceDBusProxy::testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<BranchInterface::testBranchMethodError, int32_t, std::string> >::callMethodAsync(
+ *this,
+ "testBranchMethod",
+ "is",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt, _inString,
+ std::move(_callback),
+ std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string>());
+ }
+
+
+ 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/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..2331979
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp
@@ -0,0 +1,62 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
+
+#include <v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.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>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class BranchInterfaceDBusProxy
+ : virtual public BranchInterfaceProxyBase,
+ virtual public CommonAPI::DBus::DBusProxy {
+public:
+ BranchInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~BranchInterfaceDBusProxy() { }
+
+
+
+ virtual void testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+
+
+
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
index d6ef6c8..29ac294 100644
--- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
@@ -1,37 +1,32 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "BranchInterfaceDBusStubAdapter.h"
-#include <commonapi/tests/managed/BranchInterface.h>
+#include <v1_0/commonapi/tests/managed/BranchInterface.hpp>
+#include <v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<BranchInterfaceDBusStubAdapter>(_address, _connection, _stub);
}
INITIALIZER(registerBranchInterfaceDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(),
- &createBranchInterfaceDBusStubAdapter);
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ BranchInterface::getInterface(), &createBranchInterfaceDBusStubAdapter);
}
-
-
BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal() {
deactivateManagedInstances();
BranchInterfaceDBusStubAdapterHelper::deinit();
@@ -47,11 +42,11 @@ const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionX
"<arg name=\"value\" type=\"uu\" direction=\"out\" />"
"</method>\n"
"<method name=\"testBranchMethod\">\n"
- "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n"
- "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n"
- "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n"
+ "<arg name=\"_inInt\" type=\"i\" direction=\"in\" />\n"
+ "<arg name=\"_inString\" type=\"s\" direction=\"in\" />\n"
+ "<arg name=\"_error\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_outInt\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_outString\" type=\"s\" direction=\"out\" />\n"
"</method>\n"
;
@@ -69,7 +64,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
BranchInterfaceStub,
std::tuple<int32_t, std::string>,
std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string>
- > BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis");
+ > BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis", std::tuple<int32_t, std::string, BranchInterface::testBranchMethodError, int32_t, std::string>());
@@ -84,31 +79,12 @@ const CommonAPI::DBus::StubAttributeTable& BranchInterfaceDBusStubAdapterInterna
}
BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- BranchInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<BranchInterfaceStub>(stub),
- false),
- stubDispatcherTable_({
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
+ BranchInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<BranchInterfaceStub>(_stub), false),
+ stubDispatcherTable_({
{ { "testBranchMethod", "is" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher }
}),
stubAttributeTable_() {
@@ -123,3 +99,4 @@ const bool BranchInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp
new file mode 100644
index 0000000..8fee9be
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp
@@ -0,0 +1,103 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_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>
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+typedef CommonAPI::DBus::DBusStubAdapterHelper<BranchInterfaceStub> BranchInterfaceDBusStubAdapterHelper;
+
+class BranchInterfaceDBusStubAdapterInternal
+ : public virtual BranchInterfaceStubAdapter,
+ public BranchInterfaceDBusStubAdapterHelper
+{
+public:
+ BranchInterfaceDBusStubAdapterInternal(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
+
+ ~BranchInterfaceDBusStubAdapterInternal();
+
+ virtual const bool hasFreedesktopProperties();
+
+
+
+
+ const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
+ const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
+
+ void deactivateManagedInstances();
+
+
+static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
+ BranchInterfaceStub,
+ CommonAPI::Version
+ > getBranchInterfaceInterfaceVersionStubDispatcher;
+
+
+
+static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
+ BranchInterfaceStub,
+ std::tuple<int32_t, std::string>,
+ std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string>
+ > testBranchMethodStubDispatcher;
+
+
+
+
+ protected:
+ virtual const char* getMethodsDBusIntrospectionXmlData() const;
+
+ private:
+ BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
+ CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
+};
+
+class BranchInterfaceDBusStubAdapter
+ : public BranchInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<BranchInterfaceDBusStubAdapter> {
+public:
+ BranchInterfaceDBusStubAdapter(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ false),
+ BranchInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceProxy.hpp
index d91a5e8..beabc44 100644
--- a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceProxy.hpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Branch_Interface_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
-#include "BranchInterfaceProxyBase.h"
+#include <v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,13 +20,16 @@
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
template <typename ... _AttributeExtensions>
-class BranchInterfaceProxy: virtual public BranchInterface, virtual public BranchInterfaceProxyBase
-, public _AttributeExtensions... {
+class BranchInterfaceProxy
+ : virtual public BranchInterface,
+ virtual public BranchInterfaceProxyBase,
+ public _AttributeExtensions... {
public:
BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~BranchInterfaceProxy();
@@ -45,7 +48,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString);
+ virtual void testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testBranchMethod with asynchronous semantics.
*
@@ -56,28 +59,13 @@ 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);
+ virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -105,11 +93,7 @@ public:
std::shared_ptr<BranchInterfaceProxyBase> delegate_;
};
-#ifdef WIN32
- typedef BranchInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> BranchInterfaceProxyDefault;
-#else
- typedef BranchInterfaceProxy<> BranchInterfaceProxyDefault;
-#endif
+typedef BranchInterfaceProxy<> BranchInterfaceProxyDefault;
//
@@ -126,36 +110,21 @@ BranchInterfaceProxy<_AttributeExtensions...>::~BranchInterfaceProxy() {
}
template <typename ... _AttributeExtensions>
-void BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) {
- delegate_->testBranchMethod(inInt, inString, callStatus, methodError, outInt, outString);
+void BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
+ delegate_->testBranchMethod(_inInt, _inString, _status, _error, _outInt, _outString, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback) {
- return delegate_->testBranchMethodAsync(inInt, inString, callback);
+std::future<CommonAPI::CallStatus> BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->testBranchMethodAsync(_inInt, _inString, _callback, _info);
}
template <typename ... _AttributeExtensions>
-std::string BranchInterfaceProxy<_AttributeExtensions...>::getAddress() const {
+const CommonAPI::Address &BranchInterfaceProxy<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
-const std::string& BranchInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& BranchInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& BranchInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
bool BranchInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -179,6 +148,7 @@ CommonAPI::InterfaceVersionAttribute& BranchInterfaceProxy<_AttributeExtensions.
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_H_
+#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp
new file mode 100644
index 0000000..c0bb966
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp
@@ -0,0 +1,51 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Branch_Interface_PROXY_BASE_HPP_
+#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
+
+#include <v1_0/commonapi/tests/managed/BranchInterface.hpp>
+
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <vector>
+
+#include <CommonAPI/Proxy.hpp>
+#include <functional>
+#include <future>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class BranchInterfaceProxyBase
+ : virtual public CommonAPI::Proxy {
+public:
+
+ typedef std::function<void(const CommonAPI::CallStatus&, const BranchInterface::testBranchMethodError&, const int32_t&, const std::string&)> TestBranchMethodAsyncCallback;
+
+
+
+ virtual void testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, 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;
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStub.h b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp
index e94b775..fdec075 100644
--- a/src/test/commonapi/tests/managed/BranchInterfaceStub.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp
@@ -1,19 +1,21 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Branch_Interface_STUB_H_
-#define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_HPP_
+#define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_HPP_
+#include <functional>
-#include "BranchInterface.h"
+
+#include <v1_0/commonapi/tests/managed/BranchInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -21,10 +23,11 @@
#include <vector>
-#include <CommonAPI/Stub.h>
+#include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -35,7 +38,9 @@ namespace managed {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
-class BranchInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public BranchInterface {
+class BranchInterfaceStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public BranchInterface {
public:
@@ -48,7 +53,6 @@ protected:
*/
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for BranchInterface.
@@ -61,27 +65,31 @@ protected:
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class BranchInterfaceStubRemoteEvent {
- public:
+class BranchInterfaceStubRemoteEvent
+{
+public:
virtual ~BranchInterfaceStubRemoteEvent() { }
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service BranchInterface to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class BranchInterfaceStub: public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> {
+class BranchInterfaceStub
+ : public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>
+{
public:
- virtual ~BranchInterfaceStub() { }
+ typedef std::function<void (BranchInterface::testBranchMethodError _error, int32_t _outInt, std::string _outString)> testBranchMethodReply_t;
+
+ virtual ~BranchInterfaceStub() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
/// This is the method that will be called on remote calls on the method testBranchMethod.
- virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) = 0;
+ virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testBranchMethodReply_t _reply) = 0;
using CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::initStubAdapter;
typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
@@ -93,5 +101,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_H_
+#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_HPP_
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
index a539485..2a16da2 100644
--- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
@@ -1,14 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 <commonapi/tests/managed/BranchInterfaceStubDefault.h>
+#include <v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp>
+#include <assert.h>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -18,31 +20,32 @@ BranchInterfaceStubDefault::BranchInterfaceStubDefault():
interfaceVersion_(BranchInterface::getInterfaceVersion()) {
}
-const CommonAPI::Version& BranchInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
+const CommonAPI::Version& BranchInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
return interfaceVersion_;
}
-BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter) {
- CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
+BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter> &_adapter) {
+ CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
return &remoteEventHandler_;
}
-void BranchInterfaceStubDefault::testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) {
- // Call old style methods in default
- testBranchMethod(inInt, inString, methodError, outInt, outString);
-}
-void BranchInterfaceStubDefault::testBranchMethod(int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) {
- // No operation in default
+void BranchInterfaceStubDefault::testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testBranchMethodReply_t _reply) {
+ BranchInterface::testBranchMethodError error;
+ int32_t outInt;
+ std::string outString;
+ _reply(error, outInt, outString);
}
-BranchInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(BranchInterfaceStubDefault* defaultStub):
- defaultStub_(defaultStub) {
+BranchInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(BranchInterfaceStubDefault *_defaultStub)
+ :
+ defaultStub_(_defaultStub) {
}
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp
index bb1459b..0d0eab2 100644
--- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp
@@ -1,19 +1,20 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Branch_Interface_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_HPP_
+#define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_HPP_
-#include <commonapi/tests/managed/BranchInterfaceStub.h>
+#include <v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp>
#include <sstream>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -28,29 +29,28 @@ namespace managed {
* that would be defined for this service, and/or if you do not need any non-default
* behaviour.
*/
-class BranchInterfaceStubDefault : public virtual BranchInterfaceStub {
+class BranchInterfaceStubDefault
+ : public virtual BranchInterfaceStub {
public:
BranchInterfaceStubDefault();
- BranchInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter);
+ BranchInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter> &_adapter);
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString);
- virtual void testBranchMethod(int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString);
-
+ virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testBranchMethodReply_t _reply);
protected:
class RemoteEventHandler: public virtual BranchInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(BranchInterfaceStubDefault* defaultStub);
+ public:
+ RemoteEventHandler(BranchInterfaceStubDefault *_defaultStub);
- private:
- BranchInterfaceStubDefault* defaultStub_;
+ private:
+ BranchInterfaceStubDefault *defaultStub_;
};
private:
BranchInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
@@ -62,5 +62,6 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_H_
+#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.cpp
new file mode 100644
index 0000000..ed3c7e0
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.cpp
@@ -0,0 +1,26 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "LeafInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+#ifndef WIN32
+const int32_t LeafInterface::testLeafMethodError::OK;
+const int32_t LeafInterface::testLeafMethodError::NOTOK;
+#endif
+
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.hpp
new file mode 100644
index 0000000..07cc9ff
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterface.hpp
@@ -0,0 +1,64 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_LEAF_INTERFACE_HPP_
+#define COMMONAPI_TESTS_MANAGED_LEAF_INTERFACE_HPP_
+
+
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/Types.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class LeafInterface {
+public:
+ virtual ~LeafInterface() { }
+
+ static inline const char* getInterface();
+ static inline CommonAPI::Version getInterfaceVersion();
+
+ struct testLeafMethodError : CommonAPI::Enumeration<int32_t> {
+ testLeafMethodError() = default;
+ testLeafMethodError(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ static const int32_t OK = 0;
+ static const int32_t NOTOK = 1;
+ };
+};
+
+const char* LeafInterface::getInterface() {
+ return ("commonapi.tests.managed.LeafInterface");
+}
+
+CommonAPI::Version LeafInterface::getInterfaceVersion() {
+ return CommonAPI::Version(1, 0);
+}
+
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+namespace CommonAPI {
+}
+
+#endif // COMMONAPI_TESTS_MANAGED_LEAF_INTERFACE_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..6fb9572
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
@@ -0,0 +1,71 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 &_status, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<LeafInterface::testLeafMethodError, int32_t, std::string> >::callMethodWithReply(
+ *this,
+ "testLeafMethod",
+ "is",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt, _inString,
+ _status,
+ _error
+ , _outInt, _outString);
+ }
+ std::future<CommonAPI::CallStatus> LeafInterfaceDBusProxy::testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<LeafInterface::testLeafMethodError, int32_t, std::string> >::callMethodAsync(
+ *this,
+ "testLeafMethod",
+ "is",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt, _inString,
+ std::move(_callback),
+ std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string>());
+ }
+
+
+ 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/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..0534681
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp
@@ -0,0 +1,62 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
+
+#include <v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.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>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class LeafInterfaceDBusProxy
+ : virtual public LeafInterfaceProxyBase,
+ virtual public CommonAPI::DBus::DBusProxy {
+public:
+ LeafInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~LeafInterfaceDBusProxy() { }
+
+
+
+ virtual void testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+
+
+
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
index 1224eeb..3fb6774 100644
--- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
@@ -1,37 +1,32 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "LeafInterfaceDBusStubAdapter.h"
-#include <commonapi/tests/managed/LeafInterface.h>
+#include <v1_0/commonapi/tests/managed/LeafInterface.hpp>
+#include <v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<LeafInterfaceDBusStubAdapter>(_address, _connection, _stub);
}
INITIALIZER(registerLeafInterfaceDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(),
- &createLeafInterfaceDBusStubAdapter);
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ LeafInterface::getInterface(), &createLeafInterfaceDBusStubAdapter);
}
-
-
LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() {
deactivateManagedInstances();
LeafInterfaceDBusStubAdapterHelper::deinit();
@@ -47,11 +42,11 @@ const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml
"<arg name=\"value\" type=\"uu\" direction=\"out\" />"
"</method>\n"
"<method name=\"testLeafMethod\">\n"
- "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n"
- "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n"
- "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n"
+ "<arg name=\"_inInt\" type=\"i\" direction=\"in\" />\n"
+ "<arg name=\"_inString\" type=\"s\" direction=\"in\" />\n"
+ "<arg name=\"_error\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_outInt\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_outString\" type=\"s\" direction=\"out\" />\n"
"</method>\n"
;
@@ -69,7 +64,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
LeafInterfaceStub,
std::tuple<int32_t, std::string>,
std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string>
- > LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis");
+ > LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis", std::tuple<int32_t, std::string, LeafInterface::testLeafMethodError, int32_t, std::string>());
@@ -84,31 +79,12 @@ const CommonAPI::DBus::StubAttributeTable& LeafInterfaceDBusStubAdapterInternal:
}
LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- LeafInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<LeafInterfaceStub>(stub),
- false),
- stubDispatcherTable_({
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
+ LeafInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<LeafInterfaceStub>(_stub), false),
+ stubDispatcherTable_({
{ { "testLeafMethod", "is" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher }
}),
stubAttributeTable_() {
@@ -123,3 +99,4 @@ const bool LeafInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp
new file mode 100644
index 0000000..a6fd68c
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp
@@ -0,0 +1,103 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_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>
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+typedef CommonAPI::DBus::DBusStubAdapterHelper<LeafInterfaceStub> LeafInterfaceDBusStubAdapterHelper;
+
+class LeafInterfaceDBusStubAdapterInternal
+ : public virtual LeafInterfaceStubAdapter,
+ public LeafInterfaceDBusStubAdapterHelper
+{
+public:
+ LeafInterfaceDBusStubAdapterInternal(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
+
+ ~LeafInterfaceDBusStubAdapterInternal();
+
+ virtual const bool hasFreedesktopProperties();
+
+
+
+
+ const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
+ const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
+
+ void deactivateManagedInstances();
+
+
+static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
+ LeafInterfaceStub,
+ CommonAPI::Version
+ > getLeafInterfaceInterfaceVersionStubDispatcher;
+
+
+
+static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
+ LeafInterfaceStub,
+ std::tuple<int32_t, std::string>,
+ std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string>
+ > testLeafMethodStubDispatcher;
+
+
+
+
+ protected:
+ virtual const char* getMethodsDBusIntrospectionXmlData() const;
+
+ private:
+ LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
+ CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
+};
+
+class LeafInterfaceDBusStubAdapter
+ : public LeafInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<LeafInterfaceDBusStubAdapter> {
+public:
+ LeafInterfaceDBusStubAdapter(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ false),
+ LeafInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceProxy.hpp
index 4aa88a5..3f4fcd9 100644
--- a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceProxy.hpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Leaf_Interface_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
-#include "LeafInterfaceProxyBase.h"
+#include <v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,13 +20,16 @@
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
template <typename ... _AttributeExtensions>
-class LeafInterfaceProxy: virtual public LeafInterface, virtual public LeafInterfaceProxyBase
-, public _AttributeExtensions... {
+class LeafInterfaceProxy
+ : virtual public LeafInterface,
+ virtual public LeafInterfaceProxyBase,
+ public _AttributeExtensions... {
public:
LeafInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~LeafInterfaceProxy();
@@ -45,7 +48,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString);
+ virtual void testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testLeafMethod with asynchronous semantics.
*
@@ -56,28 +59,13 @@ 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);
+ virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -105,11 +93,7 @@ public:
std::shared_ptr<LeafInterfaceProxyBase> delegate_;
};
-#ifdef WIN32
- typedef LeafInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> LeafInterfaceProxyDefault;
-#else
- typedef LeafInterfaceProxy<> LeafInterfaceProxyDefault;
-#endif
+typedef LeafInterfaceProxy<> LeafInterfaceProxyDefault;
//
@@ -126,36 +110,21 @@ LeafInterfaceProxy<_AttributeExtensions...>::~LeafInterfaceProxy() {
}
template <typename ... _AttributeExtensions>
-void LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) {
- delegate_->testLeafMethod(inInt, inString, callStatus, methodError, outInt, outString);
+void LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
+ delegate_->testLeafMethod(_inInt, _inString, _status, _error, _outInt, _outString, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback) {
- return delegate_->testLeafMethodAsync(inInt, inString, callback);
+std::future<CommonAPI::CallStatus> LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->testLeafMethodAsync(_inInt, _inString, _callback, _info);
}
template <typename ... _AttributeExtensions>
-std::string LeafInterfaceProxy<_AttributeExtensions...>::getAddress() const {
+const CommonAPI::Address &LeafInterfaceProxy<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
-const std::string& LeafInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& LeafInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& LeafInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
bool LeafInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -179,6 +148,7 @@ CommonAPI::InterfaceVersionAttribute& LeafInterfaceProxy<_AttributeExtensions...
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_H_
+#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp
new file mode 100644
index 0000000..4babc5d
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp
@@ -0,0 +1,51 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
+#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
+
+#include <v1_0/commonapi/tests/managed/LeafInterface.hpp>
+
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <vector>
+
+#include <CommonAPI/Proxy.hpp>
+#include <functional>
+#include <future>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class LeafInterfaceProxyBase
+ : virtual public CommonAPI::Proxy {
+public:
+
+ typedef std::function<void(const CommonAPI::CallStatus&, const LeafInterface::testLeafMethodError&, const int32_t&, const std::string&)> TestLeafMethodAsyncCallback;
+
+
+
+ virtual void testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, 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;
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp
index e93cdf0..e2d5854 100644
--- a/src/test/commonapi/tests/managed/LeafInterfaceStub.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp
@@ -1,19 +1,21 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Leaf_Interface_STUB_H_
-#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_HPP_
+#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_HPP_
+#include <functional>
-#include "LeafInterface.h"
+
+#include <v1_0/commonapi/tests/managed/LeafInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -21,10 +23,11 @@
#include <vector>
-#include <CommonAPI/Stub.h>
+#include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -35,7 +38,9 @@ namespace managed {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
-class LeafInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public LeafInterface {
+class LeafInterfaceStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public LeafInterface {
public:
@@ -48,7 +53,6 @@ protected:
*/
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for LeafInterface.
@@ -61,27 +65,31 @@ protected:
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class LeafInterfaceStubRemoteEvent {
- public:
+class LeafInterfaceStubRemoteEvent
+{
+public:
virtual ~LeafInterfaceStubRemoteEvent() { }
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service LeafInterface to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class LeafInterfaceStub: public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> {
+class LeafInterfaceStub
+ : public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>
+{
public:
- virtual ~LeafInterfaceStub() { }
+ typedef std::function<void (LeafInterface::testLeafMethodError _error, int32_t _outInt, std::string _outString)> testLeafMethodReply_t;
+
+ virtual ~LeafInterfaceStub() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
/// This is the method that will be called on remote calls on the method testLeafMethod.
- virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) = 0;
+ virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testLeafMethodReply_t _reply) = 0;
using CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::initStubAdapter;
typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
@@ -93,5 +101,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_H_
+#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_HPP_
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
index dd8ab62..6808e59 100644
--- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
@@ -1,14 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 <commonapi/tests/managed/LeafInterfaceStubDefault.h>
+#include <v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp>
+#include <assert.h>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -18,31 +20,32 @@ LeafInterfaceStubDefault::LeafInterfaceStubDefault():
interfaceVersion_(LeafInterface::getInterfaceVersion()) {
}
-const CommonAPI::Version& LeafInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
+const CommonAPI::Version& LeafInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
return interfaceVersion_;
}
-LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter) {
- CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter;
+LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter> &_adapter) {
+ CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
return &remoteEventHandler_;
}
-void LeafInterfaceStubDefault::testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) {
- // Call old style methods in default
- testLeafMethod(inInt, inString, methodError, outInt, outString);
-}
-void LeafInterfaceStubDefault::testLeafMethod(int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) {
- // No operation in default
+void LeafInterfaceStubDefault::testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testLeafMethodReply_t _reply) {
+ LeafInterface::testLeafMethodError error;
+ int32_t outInt;
+ std::string outString;
+ _reply(error, outInt, outString);
}
-LeafInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LeafInterfaceStubDefault* defaultStub):
- defaultStub_(defaultStub) {
+LeafInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LeafInterfaceStubDefault *_defaultStub)
+ :
+ defaultStub_(_defaultStub) {
}
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp
index c0bd5b1..a188eff 100644
--- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp
@@ -1,19 +1,20 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Leaf_Interface_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_HPP_
+#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_HPP_
-#include <commonapi/tests/managed/LeafInterfaceStub.h>
+#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
#include <sstream>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -28,29 +29,28 @@ namespace managed {
* that would be defined for this service, and/or if you do not need any non-default
* behaviour.
*/
-class LeafInterfaceStubDefault : public virtual LeafInterfaceStub {
+class LeafInterfaceStubDefault
+ : public virtual LeafInterfaceStub {
public:
LeafInterfaceStubDefault();
- LeafInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter);
+ LeafInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter> &_adapter);
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString);
- virtual void testLeafMethod(int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString);
-
+ virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testLeafMethodReply_t _reply);
protected:
class RemoteEventHandler: public virtual LeafInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(LeafInterfaceStubDefault* defaultStub);
+ public:
+ RemoteEventHandler(LeafInterfaceStubDefault *_defaultStub);
- private:
- LeafInterfaceStubDefault* defaultStub_;
+ private:
+ LeafInterfaceStubDefault *defaultStub_;
};
private:
LeafInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
@@ -62,5 +62,6 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_H_
+#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.cpp
new file mode 100644
index 0000000..4625cdc
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.cpp
@@ -0,0 +1,26 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "RootInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+#ifndef WIN32
+const int32_t RootInterface::testRootMethodError::OK;
+const int32_t RootInterface::testRootMethodError::NOTOK;
+#endif
+
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.hpp
new file mode 100644
index 0000000..5542224
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterface.hpp
@@ -0,0 +1,65 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_ROOT_INTERFACE_HPP_
+#define COMMONAPI_TESTS_MANAGED_ROOT_INTERFACE_HPP_
+
+
+#include <set>
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/Types.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class RootInterface {
+public:
+ virtual ~RootInterface() { }
+
+ static inline const char* getInterface();
+ static inline CommonAPI::Version getInterfaceVersion();
+
+ struct testRootMethodError : CommonAPI::Enumeration<int32_t> {
+ testRootMethodError() = default;
+ testRootMethodError(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ static const int32_t OK = 0;
+ static const int32_t NOTOK = 1;
+ };
+};
+
+const char* RootInterface::getInterface() {
+ return ("commonapi.tests.managed.RootInterface");
+}
+
+CommonAPI::Version RootInterface::getInterfaceVersion() {
+ return CommonAPI::Version(1, 0);
+}
+
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+namespace CommonAPI {
+}
+
+#endif // COMMONAPI_TESTS_MANAGED_ROOT_INTERFACE_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..d9fa380
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
@@ -0,0 +1,79 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 &_status, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<RootInterface::testRootMethodError, int32_t, std::string> >::callMethodWithReply(
+ *this,
+ "testRootMethod",
+ "is",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt, _inString,
+ _status,
+ _error
+ , _outInt, _outString);
+ }
+ std::future<CommonAPI::CallStatus> RootInterfaceDBusProxy::testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>,
+ CommonAPI::DBus::DBusSerializableArguments<RootInterface::testRootMethodError, int32_t, std::string> >::callMethodAsync(
+ *this,
+ "testRootMethod",
+ "is",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _inInt, _inString,
+ std::move(_callback),
+ std::tuple<RootInterface::testRootMethodError, int32_t, std::string>());
+ }
+
+ 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/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..9e59989
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp
@@ -0,0 +1,67 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Root_Interface_DBUS_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
+
+#include <v1_0/commonapi/tests/managed/RootInterfaceProxyBase.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/DBusProxyManager.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class RootInterfaceDBusProxy
+ : virtual public RootInterfaceProxyBase,
+ virtual public CommonAPI::DBus::DBusProxy {
+public:
+ RootInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~RootInterfaceDBusProxy() { }
+
+
+
+ virtual void testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+
+ virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
+ virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface();
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+
+
+
+ CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
+ CommonAPI::DBus::DBusProxyManager proxyManagerBranchInterface_;
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
new file mode 100644
index 0000000..eb46efa
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
@@ -0,0 +1,222 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<RootInterfaceDBusStubAdapter>(_address, _connection, _stub);
+}
+
+INITIALIZER(registerRootInterfaceDBusStubAdapter) {
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ RootInterface::getInterface(), &createRootInterfaceDBusStubAdapter);
+}
+
+RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() {
+ deactivateManagedInstances();
+ RootInterfaceDBusStubAdapterHelper::deinit();
+}
+
+void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
+ std::set<std::string>::iterator iter;
+ std::set<std::string>::iterator iterNext;
+
+ iter = registeredLeafInterfaceInstances.begin();
+ while (iter != registeredLeafInterfaceInstances.end()) {
+ iterNext = std::next(iter);
+
+ if (deregisterManagedStubLeafInterface(*iter)) {
+ iter = iterNext;
+ }
+ else {
+ iter++;
+ }
+ }
+ iter = registeredBranchInterfaceInstances.begin();
+ while (iter != registeredBranchInterfaceInstances.end()) {
+ iterNext = std::next(iter);
+
+ if (deregisterManagedStubBranchInterface(*iter)) {
+ iter = iterNext;
+ }
+ else {
+ iter++;
+ }
+ }
+}
+
+const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
+ static const std::string introspectionData =
+ "<method name=\"getInterfaceVersion\">\n"
+ "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
+ "</method>\n"
+ "<method name=\"testRootMethod\">\n"
+ "<arg name=\"_inInt\" type=\"i\" direction=\"in\" />\n"
+ "<arg name=\"_inString\" type=\"s\" direction=\"in\" />\n"
+ "<arg name=\"_error\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_outInt\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_outString\" type=\"s\" direction=\"out\" />\n"
+ "</method>\n"
+
+ ;
+ return introspectionData.c_str();
+}
+
+CommonAPI::DBus::DBusGetAttributeStubDispatcher<
+ RootInterfaceStub,
+ CommonAPI::Version
+ > RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu");
+
+
+
+CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
+ RootInterfaceStub,
+ std::tuple<int32_t, std::string>,
+ std::tuple<RootInterface::testRootMethodError, int32_t, std::string>
+ > RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis", std::tuple<int32_t, std::string, RootInterface::testRootMethodError, int32_t, std::string>());
+
+
+
+
+
+const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
+ return stubDispatcherTable_;
+}
+
+const CommonAPI::DBus::StubAttributeTable& RootInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
+ return stubAttributeTable_;
+}
+bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
+ if (registeredLeafInterfaceInstances.find(_instance) == registeredLeafInterfaceInstances.end()) {
+ std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
+ CommonAPI::DBus::DBusAddress itsDBusAddress;
+ CommonAPI::DBus::DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
+
+ std::string objectPath(itsDBusAddress.getObjectPath());
+ std::string adapterObjectPath(getDBusAddress().getObjectPath());
+
+ if (objectPath.compare(0, adapterObjectPath.length(), adapterObjectPath) == 0) {
+ std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
+
+ auto stubAdapter = itsFactory->createDBusStubAdapter(_stub, "commonapi.tests.managed.LeafInterface", itsDBusAddress, connection_);
+ bool isRegistered = itsFactory->registerManagedService(stubAdapter);
+ if (isRegistered) {
+ bool isExported = connection_->getDBusObjectManager()->exportManagedDBusStubAdapter(adapterObjectPath, stubAdapter);
+ if (isExported) {
+ registeredLeafInterfaceInstances.insert(_instance);
+ return true;
+ } else {
+ itsFactory->unregisterManagedService(itsAddress);
+ }
+ }
+ }
+ }
+ return false;
+}
+
+bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string &_instance) {
+ std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
+ if (registeredLeafInterfaceInstances.find(_instance) != registeredLeafInterfaceInstances.end()) {
+ std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
+ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> stubAdapter
+ = itsFactory->getRegisteredService(itsAddress);
+ if (stubAdapter) {
+ connection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(
+ getDBusAddress().getObjectPath(), stubAdapter);
+ itsFactory->unregisterManagedService(itsAddress);
+ registeredLeafInterfaceInstances.erase(_instance);
+ return true;
+ }
+ }
+ return false;
+}
+
+std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() {
+ return registeredLeafInterfaceInstances;
+}
+bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> _stub, const std::string &_instance) {
+ if (registeredBranchInterfaceInstances.find(_instance) == registeredBranchInterfaceInstances.end()) {
+ std::string itsAddress = "local:commonapi.tests.managed.BranchInterface:" + _instance;
+ CommonAPI::DBus::DBusAddress itsDBusAddress;
+ CommonAPI::DBus::DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
+
+ std::string objectPath(itsDBusAddress.getObjectPath());
+ std::string adapterObjectPath(getDBusAddress().getObjectPath());
+
+ if (objectPath.compare(0, adapterObjectPath.length(), adapterObjectPath) == 0) {
+ std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
+
+ auto stubAdapter = itsFactory->createDBusStubAdapter(_stub, "commonapi.tests.managed.BranchInterface", itsDBusAddress, connection_);
+ bool isRegistered = itsFactory->registerManagedService(stubAdapter);
+ if (isRegistered) {
+ bool isExported = connection_->getDBusObjectManager()->exportManagedDBusStubAdapter(adapterObjectPath, stubAdapter);
+ if (isExported) {
+ registeredBranchInterfaceInstances.insert(_instance);
+ return true;
+ } else {
+ itsFactory->unregisterManagedService(itsAddress);
+ }
+ }
+ }
+ }
+ return false;
+}
+
+bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string &_instance) {
+ std::string itsAddress = "local:commonapi.tests.managed.BranchInterface:" + _instance;
+ if (registeredBranchInterfaceInstances.find(_instance) != registeredBranchInterfaceInstances.end()) {
+ std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
+ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> stubAdapter
+ = itsFactory->getRegisteredService(itsAddress);
+ if (stubAdapter) {
+ connection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(
+ getDBusAddress().getObjectPath(), stubAdapter);
+ itsFactory->unregisterManagedService(itsAddress);
+ registeredBranchInterfaceInstances.erase(_instance);
+ return true;
+ }
+ }
+ return false;
+}
+
+std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() {
+ return registeredBranchInterfaceInstances;
+}
+
+RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,true),
+ RootInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<RootInterfaceStub>(_stub), true),
+ stubDispatcherTable_({
+ { { "testRootMethod", "is" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher }
+ }),
+ stubAttributeTable_() {
+
+ stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher });
+}
+
+const bool RootInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+ return false;
+}
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp
index 95b8e7e..21121b9 100644
--- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp
@@ -1,44 +1,45 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_H_
-#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
+#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <commonapi/tests/managed/RootInterfaceStub.h>
+#include <v1_0/commonapi/tests/managed/RootInterfaceStub.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#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>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
typedef CommonAPI::DBus::DBusStubAdapterHelper<RootInterfaceStub> RootInterfaceDBusStubAdapterHelper;
-class RootInterfaceDBusStubAdapterInternal: public virtual RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper {
- public:
+class RootInterfaceDBusStubAdapterInternal
+ : public virtual RootInterfaceStubAdapter,
+ public RootInterfaceDBusStubAdapterHelper
+{
+public:
RootInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
~RootInterfaceDBusStubAdapterInternal();
@@ -57,7 +58,7 @@ class RootInterfaceDBusStubAdapterInternal: public virtual RootInterfaceStubAdap
const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
void deactivateManagedInstances();
-
+
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
RootInterfaceStub,
@@ -85,36 +86,28 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
};
-class RootInterfaceDBusStubAdapter: public RootInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<RootInterfaceDBusStubAdapter> {
+class RootInterfaceDBusStubAdapter
+ : public RootInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<RootInterfaceDBusStubAdapter> {
public:
RootInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- true),
- RootInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ true),
+ RootInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
};
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_H_
+#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxy.h b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceProxy.hpp
index 7f01728..1c824b2 100644
--- a/src/test/commonapi/tests/managed/RootInterfaceProxy.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceProxy.hpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Root_Interface_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
-#include "RootInterfaceProxyBase.h"
+#include <v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,13 +20,16 @@
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
template <typename ... _AttributeExtensions>
-class RootInterfaceProxy: virtual public RootInterface, virtual public RootInterfaceProxyBase
-, public _AttributeExtensions... {
+class RootInterfaceProxy
+ : virtual public RootInterface,
+ virtual public RootInterfaceProxyBase,
+ public _AttributeExtensions... {
public:
RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~RootInterfaceProxy();
@@ -45,7 +48,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString);
+ virtual void testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testRootMethod with asynchronous semantics.
*
@@ -56,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);
+ virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface();
@@ -64,22 +67,7 @@ public:
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -107,11 +95,7 @@ public:
std::shared_ptr<RootInterfaceProxyBase> delegate_;
};
-#ifdef WIN32
- typedef RootInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> RootInterfaceProxyDefault;
-#else
- typedef RootInterfaceProxy<> RootInterfaceProxyDefault;
-#endif
+typedef RootInterfaceProxy<> RootInterfaceProxyDefault;
//
@@ -128,36 +112,21 @@ RootInterfaceProxy<_AttributeExtensions...>::~RootInterfaceProxy() {
}
template <typename ... _AttributeExtensions>
-void RootInterfaceProxy<_AttributeExtensions...>::testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) {
- delegate_->testRootMethod(inInt, inString, callStatus, methodError, outInt, outString);
+void RootInterfaceProxy<_AttributeExtensions...>::testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
+ delegate_->testRootMethod(_inInt, _inString, _status, _error, _outInt, _outString, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> RootInterfaceProxy<_AttributeExtensions...>::testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback) {
- return delegate_->testRootMethodAsync(inInt, inString, callback);
+std::future<CommonAPI::CallStatus> RootInterfaceProxy<_AttributeExtensions...>::testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->testRootMethodAsync(_inInt, _inString, _callback, _info);
}
template <typename ... _AttributeExtensions>
-std::string RootInterfaceProxy<_AttributeExtensions...>::getAddress() const {
+const CommonAPI::Address &RootInterfaceProxy<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
-const std::string& RootInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& RootInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& RootInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
bool RootInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -189,6 +158,7 @@ CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyMa
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_H_
+#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp
new file mode 100644
index 0000000..6eb0cfc
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp
@@ -0,0 +1,56 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_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_0/commonapi/tests/managed/BranchInterfaceStub.hpp>
+#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <vector>
+
+#include <CommonAPI/ProxyManager.hpp>
+#include <CommonAPI/Proxy.hpp>
+#include <functional>
+#include <future>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class RootInterfaceProxyBase
+ : virtual public CommonAPI::Proxy {
+public:
+
+ typedef std::function<void(const CommonAPI::CallStatus&, const RootInterface::testRootMethodError&, const int32_t&, const std::string&)> TestRootMethodAsyncCallback;
+
+
+
+ virtual void testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_status, 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 CommonAPI::ProxyManager& getProxyManagerLeafInterface() = 0;
+ virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface() = 0;
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_HPP_
diff --git a/src/test/commonapi/tests/managed/RootInterfaceStub.h b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStub.hpp
index de224f6..f1d2349 100644
--- a/src/test/commonapi/tests/managed/RootInterfaceStub.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStub.hpp
@@ -1,21 +1,23 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Root_Interface_STUB_H_
-#define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_HPP_
+#define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_HPP_
+#include <functional>
-#include <commonapi/tests/managed/BranchInterfaceStub.h>
-#include <commonapi/tests/managed/LeafInterfaceStub.h>
-#include "RootInterface.h"
+#include <v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp>
+#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+
+#include <v1_0/commonapi/tests/managed/RootInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -23,10 +25,11 @@
#include <vector>
-#include <CommonAPI/Stub.h>
+#include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -37,7 +40,9 @@ namespace managed {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
-class RootInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public RootInterface {
+class RootInterfaceStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public RootInterface {
public:
@@ -56,7 +61,6 @@ protected:
*/
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for RootInterface.
@@ -69,27 +73,31 @@ protected:
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class RootInterfaceStubRemoteEvent {
- public:
+class RootInterfaceStubRemoteEvent
+{
+public:
virtual ~RootInterfaceStubRemoteEvent() { }
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service RootInterface to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class RootInterfaceStub: public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> {
+class RootInterfaceStub
+ : public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>
+{
public:
- virtual ~RootInterfaceStub() { }
+ typedef std::function<void (RootInterface::testRootMethodError _error, int32_t _outInt, std::string _outString)> testRootMethodReply_t;
+
+ virtual ~RootInterfaceStub() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
/// This is the method that will be called on remote calls on the method testRootMethod.
- virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) = 0;
+ 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 deregisterManagedStubLeafInterface(const std::string&) = 0;
@@ -107,5 +115,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_H_
+#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp
new file mode 100644
index 0000000..59bcd88
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp
@@ -0,0 +1,92 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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;
+ std::string outString;
+ _reply(error, outInt, outString);
+}
+
+
+
+bool RootInterfaceStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub> _stub) {
+ autoInstanceCounter_++;
+ std::stringstream ss;
+ ss << stubAdapter_->getAddress().getInstance() << ".i" << autoInstanceCounter_;
+ std::string instance = ss.str();
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->registerManagedStubLeafInterface(_stub, instance);
+}
+bool RootInterfaceStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->registerManagedStubLeafInterface(_stub, _instance);
+}
+bool RootInterfaceStubDefault::deregisterManagedStubLeafInterface(const std::string &_instance) {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->deregisterManagedStubLeafInterface(_instance);
+}
+std::set<std::string>& RootInterfaceStubDefault::getLeafInterfaceInstances() {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->getLeafInterfaceInstances();
+}
+bool RootInterfaceStubDefault::registerManagedStubBranchInterfaceAutoInstance(std::shared_ptr<BranchInterfaceStub> _stub) {
+ autoInstanceCounter_++;
+ std::stringstream ss;
+ ss << stubAdapter_->getAddress().getInstance() << ".i" << autoInstanceCounter_;
+ std::string instance = ss.str();
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->registerManagedStubBranchInterface(_stub, instance);
+}
+bool RootInterfaceStubDefault::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> _stub, const std::string &_instance) {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->registerManagedStubBranchInterface(_stub, _instance);
+}
+bool RootInterfaceStubDefault::deregisterManagedStubBranchInterface(const std::string &_instance) {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->deregisterManagedStubBranchInterface(_instance);
+}
+std::set<std::string>& RootInterfaceStubDefault::getBranchInterfaceInstances() {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->getBranchInterfaceInstances();
+}
+
+RootInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(RootInterfaceStubDefault *_defaultStub)
+ :
+ defaultStub_(_defaultStub) {
+}
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp
index a68bde3..e5935a6 100644
--- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp
@@ -1,19 +1,20 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Root_Interface_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_HPP_
+#define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_HPP_
-#include <commonapi/tests/managed/RootInterfaceStub.h>
+#include <v1_0/commonapi/tests/managed/RootInterfaceStub.hpp>
#include <sstream>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -28,18 +29,17 @@ namespace managed {
* that would be defined for this service, and/or if you do not need any non-default
* behaviour.
*/
-class RootInterfaceStubDefault : public virtual RootInterfaceStub {
+class RootInterfaceStubDefault
+ : public virtual RootInterfaceStub {
public:
RootInterfaceStubDefault();
- RootInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter);
+ RootInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter> &_adapter);
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString);
- virtual void testRootMethod(int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString);
-
+ 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>);
@@ -53,12 +53,12 @@ public:
protected:
class RemoteEventHandler: public virtual RootInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(RootInterfaceStubDefault* defaultStub);
+ public:
+ RemoteEventHandler(RootInterfaceStubDefault *_defaultStub);
- private:
- RootInterfaceStubDefault* defaultStub_;
+ private:
+ RootInterfaceStubDefault *defaultStub_;
};
private:
RootInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
@@ -71,5 +71,6 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_H_
+#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT
diff --git a/src/test/commonapi/tests/managed/SecondRoot.h b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRoot.hpp
index 8111d91..4884f4a 100644
--- a/src/test/commonapi/tests/managed/SecondRoot.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRoot.hpp
@@ -1,14 +1,14 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Second_Root_H_
-#define COMMONAPI_TESTS_MANAGED_Second_Root_H_
+#ifndef COMMONAPI_TESTS_MANAGED_SECOND_ROOT_HPP_
+#define COMMONAPI_TESTS_MANAGED_SECOND_ROOT_HPP_
#include <set>
@@ -18,25 +18,25 @@
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/types.h>
+#include <CommonAPI/Types.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
class SecondRoot {
- public:
+public:
virtual ~SecondRoot() { }
- static inline const char* getInterfaceId();
+ static inline const char* getInterface();
static inline CommonAPI::Version getInterfaceVersion();
};
-const char* SecondRoot::getInterfaceId() {
- static const char* interfaceId = "commonapi.tests.managed.SecondRoot";
- return interfaceId;
+const char* SecondRoot::getInterface() {
+ return ("commonapi.tests.managed.SecondRoot");
}
CommonAPI::Version SecondRoot::getInterfaceVersion() {
@@ -47,16 +47,9 @@ CommonAPI::Version SecondRoot::getInterfaceVersion() {
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
}
-#endif // COMMONAPI_TESTS_MANAGED_Second_Root_H_
+#endif // COMMONAPI_TESTS_MANAGED_SECOND_ROOT_HPP_
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.cpp
new file mode 100644
index 0000000..87b1a66
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.cpp
@@ -0,0 +1,52 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+std::shared_ptr<CommonAPI::DBus::DBusProxy> createSecondRootDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
+ return std::make_shared<SecondRootDBusProxy>(_address, _connection);
+}
+
+INITIALIZER(registerSecondRootDBusProxy) {
+ CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
+ SecondRoot::getInterface(),
+ &createSecondRootDBusProxy);
+}
+
+SecondRootDBusProxy::SecondRootDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
+ : CommonAPI::DBus::DBusProxy(_address, _connection)
+, proxyManagerLeafInterface_(*this, "commonapi.tests.managed.LeafInterface")
+{
+}
+
+
+
+
+ CommonAPI::ProxyManager& SecondRootDBusProxy::getProxyManagerLeafInterface() {
+ return proxyManagerLeafInterface_;
+ }
+
+ void SecondRootDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
+ ownVersionMajor = 1;
+ ownVersionMinor = 0;
+ }
+
+ } // namespace managed
+ } // namespace tests
+ } // namespace commonapi
+ } // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.hpp
new file mode 100644
index 0000000..6ef5d20
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusProxy.hpp
@@ -0,0 +1,63 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Second_Root_DBUS_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
+
+#include <v1_0/commonapi/tests/managed/SecondRootProxyBase.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/DBusProxyManager.hpp>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+class SecondRootDBusProxy
+ : virtual public SecondRootProxyBase,
+ virtual public CommonAPI::DBus::DBusProxy {
+public:
+ SecondRootDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~SecondRootDBusProxy() { }
+
+
+
+
+ virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+
+
+
+ CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
+
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
new file mode 100644
index 0000000..33dd268
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
@@ -0,0 +1,151 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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>
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<SecondRootDBusStubAdapter>(_address, _connection, _stub);
+}
+
+INITIALIZER(registerSecondRootDBusStubAdapter) {
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ SecondRoot::getInterface(), &createSecondRootDBusStubAdapter);
+}
+
+SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() {
+ deactivateManagedInstances();
+ SecondRootDBusStubAdapterHelper::deinit();
+}
+
+void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() {
+ std::set<std::string>::iterator iter;
+ std::set<std::string>::iterator iterNext;
+
+ iter = registeredLeafInterfaceInstances.begin();
+ while (iter != registeredLeafInterfaceInstances.end()) {
+ iterNext = std::next(iter);
+
+ if (deregisterManagedStubLeafInterface(*iter)) {
+ iter = iterNext;
+ }
+ else {
+ iter++;
+ }
+ }
+}
+
+const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
+ static const std::string introspectionData =
+ "<method name=\"getInterfaceVersion\">\n"
+ "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
+ "</method>\n"
+
+ ""
+ ;
+ return introspectionData.c_str();
+}
+
+CommonAPI::DBus::DBusGetAttributeStubDispatcher<
+ SecondRootStub,
+ CommonAPI::Version
+ > SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu");
+
+
+
+
+
+
+
+
+const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() {
+ return stubDispatcherTable_;
+}
+
+const CommonAPI::DBus::StubAttributeTable& SecondRootDBusStubAdapterInternal::getStubAttributeTable() {
+ return stubAttributeTable_;
+}
+bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
+ if (registeredLeafInterfaceInstances.find(_instance) == registeredLeafInterfaceInstances.end()) {
+ std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
+ CommonAPI::DBus::DBusAddress itsDBusAddress;
+ CommonAPI::DBus::DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
+
+ std::string objectPath(itsDBusAddress.getObjectPath());
+ std::string adapterObjectPath(getDBusAddress().getObjectPath());
+
+ if (objectPath.compare(0, adapterObjectPath.length(), adapterObjectPath) == 0) {
+ std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
+
+ auto stubAdapter = itsFactory->createDBusStubAdapter(_stub, "commonapi.tests.managed.LeafInterface", itsDBusAddress, connection_);
+ bool isRegistered = itsFactory->registerManagedService(stubAdapter);
+ if (isRegistered) {
+ bool isExported = connection_->getDBusObjectManager()->exportManagedDBusStubAdapter(adapterObjectPath, stubAdapter);
+ if (isExported) {
+ registeredLeafInterfaceInstances.insert(_instance);
+ return true;
+ } else {
+ itsFactory->unregisterManagedService(itsAddress);
+ }
+ }
+ }
+ }
+ return false;
+}
+
+bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string &_instance) {
+ std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
+ if (registeredLeafInterfaceInstances.find(_instance) != registeredLeafInterfaceInstances.end()) {
+ std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
+ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> stubAdapter
+ = itsFactory->getRegisteredService(itsAddress);
+ if (stubAdapter) {
+ connection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(
+ getDBusAddress().getObjectPath(), stubAdapter);
+ itsFactory->unregisterManagedService(itsAddress);
+ registeredLeafInterfaceInstances.erase(_instance);
+ return true;
+ }
+ }
+ return false;
+}
+
+std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() {
+ return registeredLeafInterfaceInstances;
+}
+
+SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,true),
+ SecondRootDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<SecondRootStub>(_stub), true),
+ stubDispatcherTable_({
+ }),
+ stubAttributeTable_() {
+
+ stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher });
+}
+
+const bool SecondRootDBusStubAdapterInternal::hasFreedesktopProperties() {
+ return false;
+}
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp
new file mode 100644
index 0000000..fb1714e
--- /dev/null
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp
@@ -0,0 +1,104 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_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>
+
+#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>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace commonapi {
+namespace tests {
+namespace managed {
+
+typedef CommonAPI::DBus::DBusStubAdapterHelper<SecondRootStub> SecondRootDBusStubAdapterHelper;
+
+class SecondRootDBusStubAdapterInternal
+ : public virtual SecondRootStubAdapter,
+ public SecondRootDBusStubAdapterHelper
+{
+public:
+ SecondRootDBusStubAdapterInternal(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
+
+ ~SecondRootDBusStubAdapterInternal();
+
+ virtual const bool hasFreedesktopProperties();
+
+
+
+ bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&);
+ bool deregisterManagedStubLeafInterface(const std::string&);
+ std::set<std::string>& getLeafInterfaceInstances();
+
+ const SecondRootDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
+ const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
+
+ void deactivateManagedInstances();
+
+
+static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
+ SecondRootStub,
+ CommonAPI::Version
+ > getSecondRootInterfaceVersionStubDispatcher;
+
+
+
+
+
+
+
+ protected:
+ virtual const char* getMethodsDBusIntrospectionXmlData() const;
+
+ private:
+ std::set<std::string> registeredLeafInterfaceInstances;
+ SecondRootDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
+ CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
+};
+
+class SecondRootDBusStubAdapter
+ : public SecondRootDBusStubAdapterInternal,
+ public std::enable_shared_from_this<SecondRootDBusStubAdapter> {
+public:
+ SecondRootDBusStubAdapter(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ true),
+ SecondRootDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
+};
+
+} // namespace managed
+} // namespace tests
+} // namespace commonapi
+} // namespace v1_0
+
+#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/commonapi/tests/managed/SecondRootProxy.h b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootProxy.hpp
index 27eb126..0047b37 100644
--- a/src/test/commonapi/tests/managed/SecondRootProxy.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootProxy.hpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Second_Root_PROXY_H_
-#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
+#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
-#include "SecondRootProxyBase.h"
+#include <v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,13 +20,16 @@
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
template <typename ... _AttributeExtensions>
-class SecondRootProxy: virtual public SecondRoot, virtual public SecondRootProxyBase
-, public _AttributeExtensions... {
+class SecondRootProxy
+ : virtual public SecondRoot,
+ virtual public SecondRootProxyBase,
+ public _AttributeExtensions... {
public:
SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~SecondRootProxy();
@@ -42,22 +45,7 @@ public:
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -85,11 +73,7 @@ public:
std::shared_ptr<SecondRootProxyBase> delegate_;
};
-#ifdef WIN32
- typedef SecondRootProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> SecondRootProxyDefault;
-#else
- typedef SecondRootProxy<> SecondRootProxyDefault;
-#endif
+typedef SecondRootProxy<> SecondRootProxyDefault;
//
@@ -107,26 +91,11 @@ SecondRootProxy<_AttributeExtensions...>::~SecondRootProxy() {
template <typename ... _AttributeExtensions>
-std::string SecondRootProxy<_AttributeExtensions...>::getAddress() const {
+const CommonAPI::Address &SecondRootProxy<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
-const std::string& SecondRootProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& SecondRootProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& SecondRootProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
bool SecondRootProxy<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -154,6 +123,7 @@ CommonAPI::ProxyManager& SecondRootProxy<_AttributeExtensions...>::getProxyManag
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_H_
+#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
diff --git a/src/test/commonapi/tests/managed/SecondRootProxyBase.h b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp
index c922dfd..dbcc3f1 100644
--- a/src/test/commonapi/tests/managed/SecondRootProxyBase.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp
@@ -1,36 +1,38 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Second_Root_PROXY_BASE_H_
-#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
+#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
-#include "SecondRoot.h"
+#include <v1_0/commonapi/tests/managed/SecondRoot.hpp>
-#include <commonapi/tests/managed/LeafInterfaceStub.h>
+#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/ProxyManager.h>
-#include <CommonAPI/Proxy.h>
+#include <CommonAPI/ProxyManager.hpp>
+#include <CommonAPI/Proxy.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
-class SecondRootProxyBase: virtual public CommonAPI::Proxy {
- public:
+class SecondRootProxyBase
+ : virtual public CommonAPI::Proxy {
+public:
@@ -41,5 +43,6 @@ class SecondRootProxyBase: virtual public CommonAPI::Proxy {
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_H_
+#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
diff --git a/src/test/commonapi/tests/managed/SecondRootStub.h b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStub.hpp
index 3eeb974..d23acf6 100644
--- a/src/test/commonapi/tests/managed/SecondRootStub.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStub.hpp
@@ -1,30 +1,33 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Second_Root_STUB_H_
-#define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_STUB_HPP_
+#define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_HPP_
+#include <functional>
-#include <commonapi/tests/managed/LeafInterfaceStub.h>
-#include "SecondRoot.h"
+#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+
+#include <v1_0/commonapi/tests/managed/SecondRoot.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/Stub.h>
+#include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -35,7 +38,9 @@ namespace managed {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
-class SecondRootStubAdapter: virtual public CommonAPI::StubAdapter, public SecondRoot {
+class SecondRootStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public SecondRoot {
public:
@@ -51,7 +56,6 @@ protected:
*/
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for SecondRoot.
@@ -64,22 +68,25 @@ protected:
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class SecondRootStubRemoteEvent {
- public:
+class SecondRootStubRemoteEvent
+{
+public:
virtual ~SecondRootStubRemoteEvent() { }
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service SecondRoot to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class SecondRootStub: public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> {
+class SecondRootStub
+ : public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>
+{
public:
- virtual ~SecondRootStub() { }
+
+ virtual ~SecondRootStub() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
@@ -97,5 +104,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Second_Root_STUB_H_
+#endif // COMMONAPI_TESTS_MANAGED_Second_Root_STUB_HPP_
diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStubDefault.cpp
index 5199fdb..f1b7b0b 100644
--- a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStubDefault.cpp
@@ -1,14 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 <commonapi/tests/managed/SecondRootStubDefault.h>
+#include <v1_0/commonapi/tests/managed/SecondRootStubDefault.hpp>
+#include <assert.h>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -19,39 +21,45 @@ SecondRootStubDefault::SecondRootStubDefault():
interfaceVersion_(SecondRoot::getInterfaceVersion()) {
}
-const CommonAPI::Version& SecondRootStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
+const CommonAPI::Version& SecondRootStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
return interfaceVersion_;
}
-SecondRootStubRemoteEvent* SecondRootStubDefault::initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter) {
- CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_ = stubAdapter;
+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) {
+bool SecondRootStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub> _stub) {
autoInstanceCounter_++;
std::stringstream ss;
- ss << stubAdapter_->getInstanceId() << ".i" << autoInstanceCounter_;
+ ss << stubAdapter_->getAddress().getInstance() << ".i" << autoInstanceCounter_;
std::string instance = ss.str();
- return stubAdapter_->registerManagedStubLeafInterface(stub, instance);
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->registerManagedStubLeafInterface(_stub, instance);
}
-bool SecondRootStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) {
- return stubAdapter_->registerManagedStubLeafInterface(stub, instance);
+bool SecondRootStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->registerManagedStubLeafInterface(_stub, _instance);
}
-bool SecondRootStubDefault::deregisterManagedStubLeafInterface(const std::string& instance) {
- return stubAdapter_->deregisterManagedStubLeafInterface(instance);
+bool SecondRootStubDefault::deregisterManagedStubLeafInterface(const std::string &_instance) {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->deregisterManagedStubLeafInterface(_instance);
}
std::set<std::string>& SecondRootStubDefault::getLeafInterfaceInstances() {
+ assert(stubAdapter_ !=NULL);
return stubAdapter_->getLeafInterfaceInstances();
}
-SecondRootStubDefault::RemoteEventHandler::RemoteEventHandler(SecondRootStubDefault* defaultStub):
- defaultStub_(defaultStub) {
+SecondRootStubDefault::RemoteEventHandler::RemoteEventHandler(SecondRootStubDefault *_defaultStub)
+ :
+ defaultStub_(_defaultStub) {
}
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.h b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStubDefault.hpp
index bf5025e..d84f20a 100644
--- a/src/test/commonapi/tests/managed/SecondRootStubDefault.h
+++ b/src/test/src-gen/v1_0/commonapi/tests/managed/SecondRootStubDefault.hpp
@@ -1,19 +1,20 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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_MANAGED_Second_Root_STUB_DEFAULT_H_
-#define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_H_
+#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_HPP_
+#define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_HPP_
-#include <commonapi/tests/managed/SecondRootStub.h>
+#include <v1_0/commonapi/tests/managed/SecondRootStub.hpp>
#include <sstream>
+namespace v1_0 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -28,13 +29,14 @@ namespace managed {
* that would be defined for this service, and/or if you do not need any non-default
* behaviour.
*/
-class SecondRootStubDefault : public virtual SecondRootStub {
+class SecondRootStubDefault
+ : public virtual SecondRootStub {
public:
SecondRootStubDefault();
- SecondRootStubRemoteEvent* initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter);
+ SecondRootStubRemoteEvent* initStubAdapter(const std::shared_ptr<SecondRootStubAdapter> &_adapter);
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
@@ -46,12 +48,12 @@ public:
protected:
class RemoteEventHandler: public virtual SecondRootStubRemoteEvent {
- public:
- RemoteEventHandler(SecondRootStubDefault* defaultStub);
+ public:
+ RemoteEventHandler(SecondRootStubDefault *_defaultStub);
- private:
- SecondRootStubDefault* defaultStub_;
+ private:
+ SecondRootStubDefault *defaultStub_;
};
private:
SecondRootStubDefault::RemoteEventHandler remoteEventHandler_;
@@ -64,5 +66,6 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
+} // namespace v1_0
-#endif // COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_H_
+#endif // COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT
diff --git a/src/test/fake/legacy/service/LegacyInterface.h b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterface.hpp
index 75b4ad2..d0c0a3f 100644
--- a/src/test/fake/legacy/service/LegacyInterface.h
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterface.hpp
@@ -1,14 +1,14 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 FAKE_LEGACY_SERVICE_Legacy_Interface_H_
-#define FAKE_LEGACY_SERVICE_Legacy_Interface_H_
+#ifndef FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_HPP_
+#define FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_HPP_
@@ -17,25 +17,25 @@
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/types.h>
+#include <CommonAPI/Types.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace fake {
namespace legacy {
namespace service {
class LegacyInterface {
- public:
+public:
virtual ~LegacyInterface() { }
- static inline const char* getInterfaceId();
+ static inline const char* getInterface();
static inline CommonAPI::Version getInterfaceVersion();
};
-const char* LegacyInterface::getInterfaceId() {
- static const char* interfaceId = "fake.legacy.service.LegacyInterface";
- return interfaceId;
+const char* LegacyInterface::getInterface() {
+ return ("fake.legacy.service.LegacyInterface");
}
CommonAPI::Version LegacyInterface::getInterfaceVersion() {
@@ -46,16 +46,9 @@ CommonAPI::Version LegacyInterface::getInterfaceVersion() {
} // namespace service
} // namespace legacy
} // namespace fake
+} // namespace v1_0
namespace CommonAPI {
-
-}
-
-
-namespace std {
- //hashes for types
-
- //hashes for error types
}
-#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_H_
+#endif // FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_HPP_
diff --git a/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
new file mode 100644
index 0000000..7cb677e
--- /dev/null
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
@@ -0,0 +1,110 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 &_status, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t>,
+ CommonAPI::DBus::DBusSerializableArguments<int32_t, int32_t> >::callMethodWithReply(
+ *this,
+ "TestMethod",
+ "i",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _input,
+ _status
+ , _val1, _val2);
+ }
+ std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t>,
+ CommonAPI::DBus::DBusSerializableArguments<int32_t, int32_t> >::callMethodAsync(
+ *this,
+ "TestMethod",
+ "i",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _input,
+ std::move(_callback),
+ std::tuple<int32_t, int32_t>());
+ }
+ void LegacyInterfaceDBusProxy::OtherTestMethod(CommonAPI::CallStatus &_status, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
+ CommonAPI::DBus::DBusSerializableArguments<std::string, int32_t> >::callMethodWithReply(
+ *this,
+ "OtherTestMethod",
+ "",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _status
+ , _greeting, _identifier);
+ }
+ std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
+ CommonAPI::DBus::DBusSerializableArguments<std::string, int32_t> >::callMethodAsync(
+ *this,
+ "OtherTestMethod",
+ "",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ std::move(_callback),
+ std::tuple<std::string, int32_t>());
+ }
+ void LegacyInterfaceDBusProxy::finish(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
+ CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply(
+ *this,
+ "finish",
+ "",
+ (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
+ _status
+ );
+ }
+ 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),
+ std::move(_callback),
+ std::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/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp
new file mode 100644
index 0000000..97b813d
--- /dev/null
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp
@@ -0,0 +1,66 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 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>
+
+#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>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+#include <string>
+
+namespace v1_0 {
+namespace fake {
+namespace legacy {
+namespace service {
+
+class LegacyInterfaceDBusProxy
+ : virtual public LegacyInterfaceProxyBase,
+ virtual public CommonAPI::DBus::DBusProxy {
+public:
+ LegacyInterfaceDBusProxy(
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
+
+ virtual ~LegacyInterfaceDBusProxy() { }
+
+
+
+ virtual void TestMethod(const int32_t &_input, CommonAPI::CallStatus &_status, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void OtherTestMethod(CommonAPI::CallStatus &_status, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+ virtual void finish(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info);
+ virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+
+
+ virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+private:
+
+
+
+};
+
+} // namespace service
+} // namespace legacy
+} // namespace fake
+} // namespace v1_0
+
+#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_HPP_
+
diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
index b62a0fb..fa73390 100644
--- a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
@@ -1,37 +1,32 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 "LegacyInterfaceDBusStubAdapter.h"
-#include <fake/legacy/service/LegacyInterface.h>
+#include <v1_0/fake/legacy/service/LegacyInterface.hpp>
+#include <v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp>
+namespace v1_0 {
namespace fake {
namespace legacy {
namespace service {
std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLegacyInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& interfaceName,
- const std::string& busName,
- const std::string& objectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
- return std::make_shared<LegacyInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub) {
+ return std::make_shared<LegacyInterfaceDBusStubAdapter>(_address, _connection, _stub);
}
INITIALIZER(registerLegacyInterfaceDBusStubAdapter) {
- CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LegacyInterface::getInterfaceId(),
- &createLegacyInterfaceDBusStubAdapter);
+ CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
+ LegacyInterface::getInterface(), &createLegacyInterfaceDBusStubAdapter);
}
-
-
LegacyInterfaceDBusStubAdapterInternal::~LegacyInterfaceDBusStubAdapterInternal() {
deactivateManagedInstances();
LegacyInterfaceDBusStubAdapterHelper::deinit();
@@ -47,13 +42,13 @@ const char* LegacyInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionX
"<arg name=\"value\" type=\"uu\" direction=\"out\" />"
"</method>\n"
"<method name=\"TestMethod\">\n"
- "<arg name=\"input\" type=\"i\" direction=\"in\" />\n"
- "<arg name=\"val1\" type=\"i\" direction=\"out\" />\n"
- "<arg name=\"val2\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_input\" type=\"i\" direction=\"in\" />\n"
+ "<arg name=\"_val1\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_val2\" type=\"i\" direction=\"out\" />\n"
"</method>\n"
"<method name=\"OtherTestMethod\">\n"
- "<arg name=\"greeting\" type=\"s\" direction=\"out\" />\n"
- "<arg name=\"identifier\" type=\"i\" direction=\"out\" />\n"
+ "<arg name=\"_greeting\" type=\"s\" direction=\"out\" />\n"
+ "<arg name=\"_identifier\" type=\"i\" direction=\"out\" />\n"
"</method>\n"
"<method name=\"finish\">\n"
"</method>\n"
@@ -73,17 +68,17 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
LegacyInterfaceStub,
std::tuple<int32_t>,
std::tuple<int32_t, int32_t>
- > LegacyInterfaceDBusStubAdapterInternal::testMethodStubDispatcher(&LegacyInterfaceStub::TestMethod, "ii");
+ > LegacyInterfaceDBusStubAdapterInternal::testMethodStubDispatcher(&LegacyInterfaceStub::TestMethod, "ii", std::tuple<int32_t, int32_t, int32_t>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
LegacyInterfaceStub,
std::tuple<>,
std::tuple<std::string, int32_t>
- > LegacyInterfaceDBusStubAdapterInternal::otherTestMethodStubDispatcher(&LegacyInterfaceStub::OtherTestMethod, "si");
+ > LegacyInterfaceDBusStubAdapterInternal::otherTestMethodStubDispatcher(&LegacyInterfaceStub::OtherTestMethod, "si", std::tuple<std::string, int32_t>());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
LegacyInterfaceStub,
std::tuple<>,
std::tuple<>
- > LegacyInterfaceDBusStubAdapterInternal::finishStubDispatcher(&LegacyInterfaceStub::finish, "");
+ > LegacyInterfaceDBusStubAdapterInternal::finishStubDispatcher(&LegacyInterfaceStub::finish, "", std::tuple<>());
@@ -98,31 +93,12 @@ const CommonAPI::DBus::StubAttributeTable& LegacyInterfaceDBusStubAdapterInterna
}
LegacyInterfaceDBusStubAdapterInternal::LegacyInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub):
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- LegacyInterfaceDBusStubAdapterHelper(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- std::dynamic_pointer_cast<LegacyInterfaceStub>(stub),
- false),
- stubDispatcherTable_({
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
+ LegacyInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<LegacyInterfaceStub>(_stub), false),
+ stubDispatcherTable_({
{ { "TestMethod", "i" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::testMethodStubDispatcher },
{ { "OtherTestMethod", "" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::otherTestMethodStubDispatcher },
{ { "finish", "" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::finishStubDispatcher }
@@ -139,3 +115,4 @@ const bool LegacyInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
} // namespace service
} // namespace legacy
} // namespace fake
+} // namespace v1_0
diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.h b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp
index a826fd8..13ee475 100644
--- a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.h
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp
@@ -1,44 +1,43 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_H_
-#define FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_H_
+#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
+#define FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <fake/legacy/service/LegacyInterfaceStub.h>
+#include <v1_0/fake/legacy/service/LegacyInterfaceStub.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/DBus/DBusStubAdapterHelper.h>
-#include <CommonAPI/DBus/DBusStubAdapter.h>
-#include <CommonAPI/DBus/DBusFactory.h>
-#include <CommonAPI/DBus/DBusServicePublisher.h>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace fake {
namespace legacy {
namespace service {
typedef CommonAPI::DBus::DBusStubAdapterHelper<LegacyInterfaceStub> LegacyInterfaceDBusStubAdapterHelper;
-class LegacyInterfaceDBusStubAdapterInternal: public virtual LegacyInterfaceStubAdapter, public LegacyInterfaceDBusStubAdapterHelper {
- public:
+class LegacyInterfaceDBusStubAdapterInternal
+ : public virtual LegacyInterfaceStubAdapter,
+ public LegacyInterfaceDBusStubAdapterHelper
+{
+public:
LegacyInterfaceDBusStubAdapterInternal(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub);
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub);
~LegacyInterfaceDBusStubAdapterInternal();
@@ -51,7 +50,7 @@ class LegacyInterfaceDBusStubAdapterInternal: public virtual LegacyInterfaceStub
const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
void deactivateManagedInstances();
-
+
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
LegacyInterfaceStub,
@@ -87,36 +86,28 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
};
-class LegacyInterfaceDBusStubAdapter: public LegacyInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<LegacyInterfaceDBusStubAdapter> {
+class LegacyInterfaceDBusStubAdapter
+ : public LegacyInterfaceDBusStubAdapterInternal,
+ public std::enable_shared_from_this<LegacyInterfaceDBusStubAdapter> {
public:
LegacyInterfaceDBusStubAdapter(
- const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
- const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const std::shared_ptr<CommonAPI::StubBase>& stub) :
- CommonAPI::DBus::DBusStubAdapter(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- false),
- LegacyInterfaceDBusStubAdapterInternal(
- factory,
- commonApiAddress,
- dbusInterfaceName,
- dbusBusName,
- dbusObjectPath,
- dbusConnection,
- stub) { }
+ const CommonAPI::DBus::DBusAddress &_address,
+ const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
+ const std::shared_ptr<CommonAPI::StubBase> &_stub)
+ : CommonAPI::DBus::DBusStubAdapter(
+ _address,
+ _connection,
+ false),
+ LegacyInterfaceDBusStubAdapterInternal(
+ _address,
+ _connection,
+ _stub) {
+ }
};
} // namespace service
} // namespace legacy
} // namespace fake
+} // namespace v1_0
-#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_H_
+#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/fake/legacy/service/LegacyInterfaceProxy.h b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceProxy.hpp
index 4c9b482..f44a24b 100644
--- a/src/test/fake/legacy/service/LegacyInterfaceProxy.h
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceProxy.hpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_H_
-#define FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_H_
+#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
+#define FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
-#include "LegacyInterfaceProxyBase.h"
+#include <v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,13 +20,16 @@
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace fake {
namespace legacy {
namespace service {
template <typename ... _AttributeExtensions>
-class LegacyInterfaceProxy: virtual public LegacyInterface, virtual public LegacyInterfaceProxyBase
-, public _AttributeExtensions... {
+class LegacyInterfaceProxy
+ : virtual public LegacyInterface,
+ virtual public LegacyInterfaceProxyBase,
+ public _AttributeExtensions... {
public:
LegacyInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~LegacyInterfaceProxy();
@@ -45,7 +48,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void TestMethod(const int32_t& input, CommonAPI::CallStatus& callStatus, int32_t& val1, int32_t& val2);
+ virtual void TestMethod(const int32_t &_input, CommonAPI::CallStatus &_status, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls TestMethod with asynchronous semantics.
*
@@ -56,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);
+ virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls OtherTestMethod with synchronous semantics.
*
@@ -65,7 +68,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void OtherTestMethod(CommonAPI::CallStatus& callStatus, std::string& greeting, int32_t& identifier);
+ virtual void OtherTestMethod(CommonAPI::CallStatus &_status, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls OtherTestMethod with asynchronous semantics.
*
@@ -76,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);
+ virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls finish with synchronous semantics.
*
@@ -84,7 +87,7 @@ public:
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual void finish(CommonAPI::CallStatus& callStatus);
+ virtual void finish(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls finish with asynchronous semantics.
*
@@ -95,28 +98,13 @@ 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);
+ virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr);
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -144,11 +132,7 @@ public:
std::shared_ptr<LegacyInterfaceProxyBase> delegate_;
};
-#ifdef WIN32
- typedef LegacyInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> LegacyInterfaceProxyDefault;
-#else
- typedef LegacyInterfaceProxy<> LegacyInterfaceProxyDefault;
-#endif
+typedef LegacyInterfaceProxy<> LegacyInterfaceProxyDefault;
//
@@ -165,54 +149,39 @@ LegacyInterfaceProxy<_AttributeExtensions...>::~LegacyInterfaceProxy() {
}
template <typename ... _AttributeExtensions>
-void LegacyInterfaceProxy<_AttributeExtensions...>::TestMethod(const int32_t& input, CommonAPI::CallStatus& callStatus, int32_t& val1, int32_t& val2) {
- delegate_->TestMethod(input, callStatus, val1, val2);
+void LegacyInterfaceProxy<_AttributeExtensions...>::TestMethod(const int32_t &_input, CommonAPI::CallStatus &_status, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info) {
+ delegate_->TestMethod(_input, _status, _val1, _val2, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::TestMethodAsync(const int32_t& input, TestMethodAsyncCallback callback) {
- return delegate_->TestMethodAsync(input, callback);
+std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->TestMethodAsync(_input, _callback, _info);
}
template <typename ... _AttributeExtensions>
-void LegacyInterfaceProxy<_AttributeExtensions...>::OtherTestMethod(CommonAPI::CallStatus& callStatus, std::string& greeting, int32_t& identifier) {
- delegate_->OtherTestMethod(callStatus, greeting, identifier);
+void LegacyInterfaceProxy<_AttributeExtensions...>::OtherTestMethod(CommonAPI::CallStatus &_status, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info) {
+ delegate_->OtherTestMethod(_status, _greeting, _identifier, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::OtherTestMethodAsync(OtherTestMethodAsyncCallback callback) {
- return delegate_->OtherTestMethodAsync(callback);
+std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->OtherTestMethodAsync(_callback, _info);
}
template <typename ... _AttributeExtensions>
-void LegacyInterfaceProxy<_AttributeExtensions...>::finish(CommonAPI::CallStatus& callStatus) {
- delegate_->finish(callStatus);
+void LegacyInterfaceProxy<_AttributeExtensions...>::finish(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info) {
+ delegate_->finish(_status, _info);
}
template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::finishAsync(FinishAsyncCallback callback) {
- return delegate_->finishAsync(callback);
+std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::finishAsync(FinishAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ return delegate_->finishAsync(_callback, _info);
}
template <typename ... _AttributeExtensions>
-std::string LegacyInterfaceProxy<_AttributeExtensions...>::getAddress() const {
+const CommonAPI::Address &LegacyInterfaceProxy<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
-const std::string& LegacyInterfaceProxy<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& LegacyInterfaceProxy<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
-}
-
-template <typename ... _AttributeExtensions>
-const std::string& LegacyInterfaceProxy<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
-}
-
-template <typename ... _AttributeExtensions>
bool LegacyInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -236,6 +205,7 @@ CommonAPI::InterfaceVersionAttribute& LegacyInterfaceProxy<_AttributeExtensions.
} // namespace service
} // namespace legacy
} // namespace fake
+} // namespace v1_0
-#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_H_
+#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp
new file mode 100644
index 0000000..48361ec
--- /dev/null
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp
@@ -0,0 +1,57 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 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>
+
+
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <vector>
+
+#include <CommonAPI/Proxy.hpp>
+#include <functional>
+#include <future>
+
+#undef COMMONAPI_INTERNAL_COMPILATION
+
+namespace v1_0 {
+namespace fake {
+namespace legacy {
+namespace service {
+
+class LegacyInterfaceProxyBase
+ : virtual public CommonAPI::Proxy {
+public:
+
+ typedef std::function<void(const CommonAPI::CallStatus&, const int32_t&, const int32_t&)> TestMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&, const std::string&, const int32_t&)> OtherTestMethodAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&)> FinishAsyncCallback;
+
+
+
+ virtual void TestMethod(const int32_t &_input, CommonAPI::CallStatus &_status, 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 void OtherTestMethod(CommonAPI::CallStatus &_status, 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 void finish(CommonAPI::CallStatus &_status, const CommonAPI::CallInfo *_info = nullptr) = 0;
+ virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback _callback, const CommonAPI::CallInfo *_info = nullptr) = 0;
+};
+
+} // namespace service
+} // namespace legacy
+} // namespace fake
+} // namespace v1_0
+
+#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_HPP_
diff --git a/src/test/fake/legacy/service/LegacyInterfaceStub.h b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStub.hpp
index 69d3e22..a3d0151 100644
--- a/src/test/fake/legacy/service/LegacyInterfaceStub.h
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStub.hpp
@@ -1,19 +1,21 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_H_
-#define FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_H_
+#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_HPP_
+#define FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_HPP_
+#include <functional>
-#include "LegacyInterface.h"
+
+#include <v1_0/fake/legacy/service/LegacyInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -21,10 +23,11 @@
#include <vector>
-#include <CommonAPI/Stub.h>
+#include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+namespace v1_0 {
namespace fake {
namespace legacy {
namespace service {
@@ -35,7 +38,9 @@ namespace service {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
-class LegacyInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public LegacyInterface {
+class LegacyInterfaceStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public LegacyInterface {
public:
@@ -48,7 +53,6 @@ protected:
*/
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for LegacyInterface.
@@ -61,31 +65,37 @@ protected:
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class LegacyInterfaceStubRemoteEvent {
- public:
+class LegacyInterfaceStubRemoteEvent
+{
+public:
virtual ~LegacyInterfaceStubRemoteEvent() { }
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service LegacyInterface to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
-class LegacyInterfaceStub: public virtual CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent> {
+class LegacyInterfaceStub
+ : public virtual CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>
+{
public:
- virtual ~LegacyInterfaceStub() { }
+ typedef std::function<void (int32_t _val1, int32_t _val2)> TestMethodReply_t;
+ typedef std::function<void (std::string _greeting, int32_t _identifier)> OtherTestMethodReply_t;
+ typedef std::function<void ()> finishReply_t;
+
+ virtual ~LegacyInterfaceStub() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
/// This is the method that will be called on remote calls on the method TestMethod.
- virtual void TestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t input, int32_t& val1, int32_t& val2) = 0;
+ virtual void TestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _input, TestMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method OtherTestMethod.
- virtual void OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, std::string& greeting, int32_t& identifier) = 0;
+ virtual void OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, OtherTestMethodReply_t _reply) = 0;
/// This is the method that will be called on remote calls on the method finish.
- virtual void finish(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual void finish(const std::shared_ptr<CommonAPI::ClientId> _client, finishReply_t _reply) = 0;
using CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::initStubAdapter;
typedef CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
@@ -97,5 +107,6 @@ public:
} // namespace service
} // namespace legacy
} // namespace fake
+} // namespace v1_0
-#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_H_
+#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_HPP_
diff --git a/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.cpp b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.cpp
new file mode 100644
index 0000000..b7165b7
--- /dev/null
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.cpp
@@ -0,0 +1,60 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 <assert.h>
+
+namespace v1_0 {
+namespace fake {
+namespace legacy {
+namespace service {
+
+LegacyInterfaceStubDefault::LegacyInterfaceStubDefault():
+ remoteEventHandler_(this),
+ interfaceVersion_(LegacyInterface::getInterfaceVersion()) {
+}
+
+const CommonAPI::Version& LegacyInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ return interfaceVersion_;
+}
+
+LegacyInterfaceStubRemoteEvent* LegacyInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter> &_adapter) {
+ CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
+ return &remoteEventHandler_;
+}
+
+
+void LegacyInterfaceStubDefault::TestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _input, TestMethodReply_t _reply) {
+ int32_t val1;
+ int32_t val2;
+ _reply(val1, val2);
+}
+
+void LegacyInterfaceStubDefault::OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, OtherTestMethodReply_t _reply) {
+ std::string greeting;
+ int32_t identifier;
+ _reply(greeting, identifier);
+}
+
+void LegacyInterfaceStubDefault::finish(const std::shared_ptr<CommonAPI::ClientId> _client, finishReply_t _reply) {
+ _reply();
+}
+
+
+
+
+LegacyInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LegacyInterfaceStubDefault *_defaultStub)
+ :
+ defaultStub_(_defaultStub) {
+}
+
+} // namespace service
+} // namespace legacy
+} // namespace fake
+} // namespace v1_0
diff --git a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.h b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.hpp
index dc8fa1f..cdc0ceb 100644
--- a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.h
+++ b/src/test/src-gen/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.hpp
@@ -1,19 +1,20 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 2.1.5.qualifier.
-* Used org.franca.core 0.8.10.201309262002.
+* Used org.genivi.commonapi.core 3.1.1.v201505270851.
+* Used 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 FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_H_
-#define FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_H_
+#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_HPP_
+#define FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_HPP_
-#include <fake/legacy/service/LegacyInterfaceStub.h>
+#include <v1_0/fake/legacy/service/LegacyInterfaceStub.hpp>
#include <sstream>
+namespace v1_0 {
namespace fake {
namespace legacy {
namespace service {
@@ -28,35 +29,30 @@ namespace service {
* that would be defined for this service, and/or if you do not need any non-default
* behaviour.
*/
-class LegacyInterfaceStubDefault : public virtual LegacyInterfaceStub {
+class LegacyInterfaceStubDefault
+ : public virtual LegacyInterfaceStub {
public:
LegacyInterfaceStubDefault();
- LegacyInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter>& stubAdapter);
+ LegacyInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter> &_adapter);
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void TestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t input, int32_t& val1, int32_t& val2);
- virtual void TestMethod(int32_t input, int32_t& val1, int32_t& val2);
-
- virtual void OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, std::string& greeting, int32_t& identifier);
- virtual void OtherTestMethod(std::string& greeting, int32_t& identifier);
-
- virtual void finish(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void finish();
-
+ virtual void TestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _input, TestMethodReply_t _reply);
+ virtual void OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, OtherTestMethodReply_t _reply);
+ virtual void finish(const std::shared_ptr<CommonAPI::ClientId> _client, finishReply_t _reply);
protected:
class RemoteEventHandler: public virtual LegacyInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(LegacyInterfaceStubDefault* defaultStub);
+ public:
+ RemoteEventHandler(LegacyInterfaceStubDefault *_defaultStub);
- private:
- LegacyInterfaceStubDefault* defaultStub_;
+ private:
+ LegacyInterfaceStubDefault *defaultStub_;
};
private:
LegacyInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
@@ -68,5 +64,6 @@ private:
} // namespace service
} // namespace legacy
} // namespace fake
+} // namespace v1_0
-#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_H_
+#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT
diff --git a/src/test/test-derived-types.fidl b/src/test/test-derived-types.fidl
index 1c0784f..5d72a09 100644
--- a/src/test/test-derived-types.fidl
+++ b/src/test/test-derived-types.fidl
@@ -1,6 +1,8 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
package commonapi.tests
import commonapi.tests.* from "test-predefined-types.fidl"
diff --git a/src/test/test-freedesktop-interface.fdepl b/src/test/test-freedesktop-interface.fdepl
index 1eb84aa..0f309db 100644
--- a/src/test/test-freedesktop-interface.fdepl
+++ b/src/test/test-freedesktop-interface.fdepl
@@ -1,11 +1,16 @@
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_deployment.fdepl"
import "test-freedesktop-interface.fidl"
-define org.genivi.commonapi.dbus.deployment.deployment for interface commonapi.tests.TestFreedesktopInterface {
+define org.genivi.commonapi.dbus.deployment for interface commonapi.tests.TestFreedesktopInterface {
PropertiesType = freedesktop
}
-define org.genivi.commonapi.dbus.deployment.deployment for interface commonapi.tests.TestFreedesktopDerivedInterface {
+define org.genivi.commonapi.dbus.deployment for interface commonapi.tests.TestFreedesktopDerivedInterface {
PropertiesType = freedesktop
} \ No newline at end of file
diff --git a/src/test/test-freedesktop-interface.fidl b/src/test/test-freedesktop-interface.fidl
index db1143f..0131526 100644
--- a/src/test/test-freedesktop-interface.fidl
+++ b/src/test/test-freedesktop-interface.fidl
@@ -1,6 +1,8 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
package commonapi.tests
import commonapi.tests.* from "test-derived-types.fidl"
diff --git a/src/test/test-interface-proxy.fidl b/src/test/test-interface-proxy.fidl
index a80261a..0f4b33c 100644
--- a/src/test/test-interface-proxy.fidl
+++ b/src/test/test-interface-proxy.fidl
@@ -1,6 +1,8 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
package commonapi.tests
import commonapi.tests.* from "test-derived-types.fidl"
diff --git a/src/test/test-predefined-types.fidl b/src/test/test-predefined-types.fidl
index 6226ed2..96f8613 100644
--- a/src/test/test-predefined-types.fidl
+++ b/src/test/test-predefined-types.fidl
@@ -1,6 +1,8 @@
-/* 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/. */
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
package commonapi.tests
typeCollection PredefinedTypeCollection {