summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürgen Gehring <juergen.gehring@bmw.de>2015-06-01 07:57:07 -0700
committerJürgen Gehring <juergen.gehring@bmw.de>2015-06-01 07:57:07 -0700
commit54982071a99484488207ad3bd5e9391a15bffe02 (patch)
tree479c178ee629947cf0df65fc0e38f986f6ccdbc9
parent45a6f65628a142bb8d37a3b72cb210b1f8c24a5f (diff)
downloadgenivi-common-api-dbus-runtime-54982071a99484488207ad3bd5e9391a15bffe02.tar.gz
CommonAPI-D-Bus 3.1.13.1.1
-rw-r--r--.cproject152
-rw-r--r--.gitignore65
-rw-r--r--.project33
-rw-r--r--AUTHORS2
-rw-r--r--CMakeLists.txt330
-rw-r--r--CommonAPI-DBus-uninstalled.pc.in13
-rw-r--r--CommonAPI-DBus.pc.in11
-rw-r--r--CommonAPI-DBus.sln17
-rw-r--r--CommonAPI-DBus.vcxproj140
-rw-r--r--INSTALL68
-rw-r--r--Makefile.am448
-rw-r--r--README294
-rw-r--r--UnitTests.vcxproj148
-rw-r--r--aminclude.am168
-rw-r--r--cmake/CommonAPI-DBusConfig.cmake.in13
-rw-r--r--cmake/CommonAPI-DBusConfigVersion.cmake.in12
-rw-r--r--commonapi-dbus.spec.in127
-rw-r--r--configure.ac131
-rw-r--r--docx/01_mainpage.dox31
-rw-r--r--doxygen.in (renamed from doxygen.cfg)58
-rw-r--r--eclipse-code-style-formatter.xml166
-rw-r--r--include/CommonAPI/DBus/DBusAddress.hpp53
-rw-r--r--include/CommonAPI/DBus/DBusAddressTranslator.hpp61
-rw-r--r--include/CommonAPI/DBus/DBusAttribute.hpp156
-rw-r--r--include/CommonAPI/DBus/DBusClientId.hpp48
-rw-r--r--include/CommonAPI/DBus/DBusConfig.hpp24
-rw-r--r--include/CommonAPI/DBus/DBusConnection.hpp246
-rw-r--r--include/CommonAPI/DBus/DBusDaemonProxy.hpp94
-rw-r--r--include/CommonAPI/DBus/DBusDeployment.hpp37
-rw-r--r--include/CommonAPI/DBus/DBusError.hpp45
-rw-r--r--include/CommonAPI/DBus/DBusEvent.hpp91
-rw-r--r--include/CommonAPI/DBus/DBusFactory.hpp114
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp451
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp59
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp194
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopVariant.hpp74
-rw-r--r--include/CommonAPI/DBus/DBusFunctionalHash.hpp81
-rw-r--r--include/CommonAPI/DBus/DBusHelper.hpp55
-rw-r--r--include/CommonAPI/DBus/DBusInputStream.hpp426
-rw-r--r--include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp135
-rw-r--r--include/CommonAPI/DBus/DBusInterfaceHandler.hpp31
-rw-r--r--include/CommonAPI/DBus/DBusMainLoopContext.hpp (renamed from src/CommonAPI/DBus/DBusMainLoopContext.h)23
-rw-r--r--include/CommonAPI/DBus/DBusMessage.hpp101
-rw-r--r--include/CommonAPI/DBus/DBusMultiEvent.hpp (renamed from src/CommonAPI/DBus/DBusMultiEvent.h)25
-rw-r--r--include/CommonAPI/DBus/DBusObjectManager.hpp69
-rw-r--r--include/CommonAPI/DBus/DBusObjectManagerStub.hpp (renamed from src/CommonAPI/DBus/DBusObjectManagerStub.h)62
-rw-r--r--include/CommonAPI/DBus/DBusOutputStream.hpp398
-rw-r--r--include/CommonAPI/DBus/DBusProxy.hpp84
-rw-r--r--include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp (renamed from src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h)41
-rw-r--r--include/CommonAPI/DBus/DBusProxyBase.hpp72
-rw-r--r--include/CommonAPI/DBus/DBusProxyConnection.hpp (renamed from src/CommonAPI/DBus/DBusProxyConnection.h)58
-rw-r--r--include/CommonAPI/DBus/DBusProxyHelper.hpp258
-rw-r--r--include/CommonAPI/DBus/DBusProxyManager.hpp72
-rw-r--r--include/CommonAPI/DBus/DBusSelectiveEvent.hpp56
-rw-r--r--include/CommonAPI/DBus/DBusSerializableArguments.hpp30
-rw-r--r--include/CommonAPI/DBus/DBusServiceRegistry.hpp (renamed from src/CommonAPI/DBus/DBusServiceRegistry.h)194
-rw-r--r--include/CommonAPI/DBus/DBusStubAdapter.hpp59
-rw-r--r--include/CommonAPI/DBus/DBusStubAdapterHelper.hpp (renamed from src/CommonAPI/DBus/DBusStubAdapterHelper.h)538
-rw-r--r--include/CommonAPI/DBus/DBusTypeOutputStream.hpp153
-rw-r--r--include/CommonAPI/DBus/DBusTypes.hpp37
-rw-r--r--include/CommonAPI/DBus/DBusUtils.hpp (renamed from src/CommonAPI/DBus/DBusUtils.h)22
-rw-r--r--include/murmurhash/MurmurHash3.h (renamed from src/murmurhash/MurmurHash3.h)0
-rw-r--r--include/pugixml/pugiconfig.hpp (renamed from src/pugixml/pugiconfig.hpp)0
-rw-r--r--include/pugixml/pugixml.hpp (renamed from src/pugixml/pugixml.hpp)0
-rw-r--r--m4/ax_cxx_compile_stdcxx_11.m4107
-rw-r--r--m4/ax_prog_doxygen.m4532
-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/DBusMessage.cpp312
-rw-r--r--src/CommonAPI/DBus/DBusMessage.h117
-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/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/DBusProxyBase.cpp56
-rw-r--r--src/CommonAPI/DBus/DBusProxyBase.h75
-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/DBusStubAdapter.cpp91
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapter.h86
-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.patch (renamed from dbus-DBusMessage-add-support-for-custom-marshaling.patch)120
-rw-r--r--src/murmurhash/MurmurHash3.cpp2
-rw-r--r--src/pugixml/pugixml.cpp2
-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
308 files changed, 14971 insertions, 18000 deletions
diff --git a/.cproject b/.cproject
new file mode 100644
index 0000000..df73099
--- /dev/null
+++ b/.cproject
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1859452810">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1859452810" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/CommonAPI-D-Bus"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/CommonAPI-D-Bus/Debug"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="CommonAPI-D-Bus" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="so" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.so.debug.1859452810" name="Debug" parent="cdt.managedbuild.config.gnu.so.debug">
+ <folderInfo id="cdt.managedbuild.config.gnu.so.debug.1859452810." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.6905674" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
+ <targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1947112604" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=1" buildPath="${workspace_loc:/ascgit017.CommonAPI-D-Bus}" command="make" id="cdt.managedbuild.target.gnu.builder.so.debug.216703021" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.1612988189" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.1642217911" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
+ <option id="gnu.cpp.compiler.so.debug.option.optimization.level.1985215238" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.so.debug.option.debugging.level.1179045778" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.707478912" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1813739474" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.296806273" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
+ <option id="gnu.c.compiler.so.debug.option.debugging.level.2078130775" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.339439894" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.2108497925" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
+ <option defaultValue="true" id="gnu.c.link.so.debug.option.shared.351054059" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.899448754" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
+ <option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.1332463754" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.609192959" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.1733809661" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2132354807" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="cdt.managedbuild.config.gnu.so.release.1276040933">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.release.1276040933" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/CommonAPI-D-Bus"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/CommonAPI-D-Bus/Release"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="CommonAPI-D-Bus" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="so" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.so.release.1276040933" name="Release" parent="cdt.managedbuild.config.gnu.so.release">
+ <folderInfo id="cdt.managedbuild.config.gnu.so.release.1276040933." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.so.release.473555736" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.release">
+ <targetPlatform id="cdt.managedbuild.target.gnu.platform.so.release.913197338" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.release"/>
+ <builder buildPath="${workspace_loc:/ascgit017.CommonAPI-D-Bus}/Release" id="cdt.managedbuild.target.gnu.builder.so.release.1120719007" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.release"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.13478497" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.release.184956043" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.release">
+ <option id="gnu.cpp.compiler.so.release.option.optimization.level.226311448" name="Optimization Level" superClass="gnu.cpp.compiler.so.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.so.release.option.debugging.level.2024947288" name="Debug Level" superClass="gnu.cpp.compiler.so.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1309040493" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.so.release.1370355040" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.release">
+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.so.release.option.optimization.level.1785693532" name="Optimization Level" superClass="gnu.c.compiler.so.release.option.optimization.level" valueType="enumerated"/>
+ <option id="gnu.c.compiler.so.release.option.debugging.level.826432118" name="Debug Level" superClass="gnu.c.compiler.so.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.309528651" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.so.release.250098446" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.release">
+ <option defaultValue="true" id="gnu.c.link.so.release.option.shared.438760097" name="Shared (-shared)" superClass="gnu.c.link.so.release.option.shared" valueType="boolean"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.release.351648733" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.release">
+ <option defaultValue="true" id="gnu.cpp.link.so.release.option.shared.557352195" name="Shared (-shared)" superClass="gnu.cpp.link.so.release.option.shared" valueType="boolean"/>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.720953433" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.so.release.156898238" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.release">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.634438968" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="ascgit017.CommonAPI-D-Bus.cdt.managedbuild.target.gnu.so.602020624" name="Shared Library" projectType="cdt.managedbuild.target.gnu.so"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.1276040933;cdt.managedbuild.config.gnu.so.release.1276040933.;cdt.managedbuild.tool.gnu.cpp.compiler.so.release.184956043;cdt.managedbuild.tool.gnu.cpp.compiler.input.1309040493">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.1276040933;cdt.managedbuild.config.gnu.so.release.1276040933.;cdt.managedbuild.tool.gnu.c.compiler.so.release.1370355040;cdt.managedbuild.tool.gnu.c.compiler.input.309528651">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1859452810;cdt.managedbuild.config.gnu.so.debug.1859452810.;cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.1642217911;cdt.managedbuild.tool.gnu.cpp.compiler.input.707478912">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1859452810;cdt.managedbuild.config.gnu.so.debug.1859452810.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1813739474;cdt.managedbuild.tool.gnu.c.compiler.input.339439894">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Release">
+ <resource resourceType="PROJECT" workspacePath="/ascgit017.CommonAPI-D-Bus"/>
+ </configuration>
+ <configuration configurationName="Debug">
+ <resource resourceType="PROJECT" workspacePath="/ascgit017.CommonAPI-D-Bus"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=debug -D USE_INSTALLED_COMMONAPI=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/.gitignore b/.gitignore
index e2057f2..42ca389 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,63 +1,2 @@
-.deps
-.dirstamp
-.libs
-*.gz
-*.la
-*.lo
-*.log
-*.o
-*.trs
-*~
-/.autotools
-/.cproject
-/.project
-/.settings
-/*.pc
-/Makefile
-/Makefile.in
-/aclocal.m4
-/autom4te.cache
-/build-aux
-/config.log
-/config.status
-/configure
-/doc
-/libtool
-/m4/libtool.m4
-/m4/lt*.m4
-
-/DBusBroadcastTest
-/DBusFreedesktopPropertiesTest
-/DBusLoadTest
-/DBusBenchmarkingTest
-/DBusCommunicationTest
-/DBusDaemonProxyTest
-/DBusFactoryTest
-/DBusInputStreamTest
-/DBusMultipleConnectionTest
-/DBusOutputStreamTest
-/DBusProxyTest
-/DBusRuntimeTest
-/DBusTypeStreamTest
-/DBusVariantOutputStreamTest
-/DBusVariantTest
-/DBusAddressTranslatorTest
-/DBusServiceRegistryTest
-/DBusClientIdTest
-/DBusConnectionTest
-/DBusMainLoopIntegrationTest
-/DBusServicePublisherTest
-/DBusDynamicLoadingMixedValidityTest
-/DBusDynamicLoadingMultipleDefinitionTest
-/DBusDynamicLoadingWithConfigTest
-/DBusDynamicLoadingBasicTest
-/DBusDynamicLoadingMultipleBindingsTest
-/DBusDynamicLoadingNoValidityTest
-/DBusObjectManagerStubTest
-/DBusClientIdTest
-/DBusSelectiveBroadcastTest
-/DBusManagedTest
-/DBusPolymorphicTest
-/DBusBroadcastTest
-/DBusFreedesktopPropertiesTest
-/DBusLoadTest
+/build/*
+.settings/* \ No newline at end of file
diff --git a/.project b/.project
new file mode 100644
index 0000000..3a8657b
--- /dev/null
+++ b/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CommonAPI-D-Bus</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/AUTHORS b/AUTHORS
index 2708c9d..632e479 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1 @@
-BMW Group \ No newline at end of file
+Bayerische Motoren Werke Aktiengesellschaft (BMW AG) \ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..d23844a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,330 @@
+# 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)
+
+PROJECT(libcommonapi-dbus)
+
+# version of CommonAPI-DBus
+SET( LIBCOMMONAPI_DBUS_MAJOR_VERSION 3 )
+SET( LIBCOMMONAPI_DBUS_MINOR_VERSION 1 )
+SET( LIBCOMMONAPI_DBUS_PATCH_VERSION 1 )
+
+message(STATUS "Project name: ${PROJECT_NAME}")
+
+set(COMPONENT_VERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION}.${LIBCOMMONAPI_DBUS_MINOR_VERSION}.${LIBCOMMONAPI_DBUS_PATCH_VERSION})
+set(COMMONAPI_API_HEADER_VERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION}.${LIBCOMMONAPI_DBUS_MINOR_VERSION}) # used in *.cmake.in
+
+SET(PACKAGE_VERSION "${COMPONENT_VERSION}") # used in *.cmake.in
+
+set(GTEST_ROOT "n/a" CACHE STRING "Path to root folder of googletest. Must be set for building the tests.")
+
+# OS
+set(DL_LIBRARY "")
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ set(DL_LIBRARY "dl")
+endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+##############################################################################
+
+# define standard installation path in case CMAKE_INSTALL_PREFIX is not set
+if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
+ SET(CMAKE_INSTALL_PREFIX "/usr/local")
+endif()
+message(STATUS "CMAKE_INSTALL_PREFIX set to: ${CMAKE_INSTALL_PREFIX}")
+
+# create the commandline variables:
+OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON )
+message(STATUS "BUILD_SHARED_LIBS is set to value: ${BUILD_SHARED_LIBS}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+SET(RPM_PACKAGE_VERSION "r0" CACHE STRING "rpm packet version") # used in e.g. commonapi-dbus.spec.in
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+
+set(CMAKE_BUILD_TYPE_FOR_SPEC_IN "") # used in *.cmake.in
+string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_FOR_SPEC_IN)
+
+SET(BUILD_SERVER_COMMONAPI_INSTALL_PATH "na" CACHE STRING "CommonAPI install path on the build server")
+
+# Offer the user the choice of overriding the installation directories
+set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
+set(INSTALL_INCLUDE_DIR include/CommonAPI-${COMMONAPI_API_HEADER_VERSION} CACHE PATH "Installation directory for header files")
+if(WIN32 AND NOT CYGWIN)
+ set(DEF_INSTALL_CMAKE_DIR cmake)
+else()
+ set(DEF_INSTALL_CMAKE_DIR lib/cmake/CommonAPI-DBus-${COMPONENT_VERSION})
+endif()
+set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
+
+# Make relative paths absolute (needed later on)
+foreach(p LIB INCLUDE CMAKE)
+ set(var INSTALL_${p}_DIR)
+ if(NOT IS_ABSOLUTE "${${var}}")
+ set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
+ endif()
+endforeach()
+
+message(STATUS "RPM packet version set to ${RPM_PACKAGE_VERSION}")
+
+SET(MAX_LOG_LEVEL "DEBUG" CACHE STRING "maximum log level")
+message(STATUS "MAX_LOG_LEVEL is set to value: ${MAX_LOG_LEVEL}")
+
+##################### RPM CONFIG ########################
+SET( LICENSE "MPLv2" )
+#########################################################
+
+add_definitions( -DCOMMONAPI_DBUS_VERSION_MAJOR=${LIBCOMMONAPI_DBUS_MAJOR_VERSION} )
+add_definitions( -DCOMMONAPI_DBUS_VERSION_MINOR=${LIBCOMMONAPI_DBUS_MINOR_VERSION} )
+
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+##############################################################################
+# add COMMONAPI install path to cmake find root path
+
+if(NOT "${BUILD_SERVER_COMMONAPI_INSTALL_PATH}" STREQUAL "na")
+ set( CMAKE_FIND_ROOT_PATH ${BUILD_SERVER_COMMONAPI_INSTALL_PATH};${CMAKE_FIND_ROOT_PATH} )
+endif(NOT "${BUILD_SERVER_COMMONAPI_INSTALL_PATH}" STREQUAL "na")
+message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
+
+FIND_PACKAGE(PkgConfig)
+FIND_PACKAGE(Threads REQUIRED)
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI 3.1.1 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI 3.1.1 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI Version: ${CommonAPI_VERSION}")
+
+###############################################################################
+# find DBus by using the 'pkg-config' tool
+if (MSVC)
+ #Not beautiful, but it works
+ if (DBus_DIR)
+ if (DBus_BUILD_DIR)
+ set(DBus_INCLUDE_DIRS "${DBus_DIR};${DBus_BUILD_DIR};")
+ else ()
+ message (FATAL_ERROR "DBus_BUILD_DIR not set! Cannot continue.")
+ endif ()
+ else()
+ message (FATAL_ERROR "DBus_DIR not set! Cannot continue.")
+ endif ()
+else()
+ pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
+endif()
+
+##############################################################################
+
+# CommonAPI-DBus build section
+
+if (MSVC)
+# Visual C++ is not always sure whether he is really C++
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DCOMMONAPI_INTERNAL_COMPILATION -DCOMMONAPI_DLL_COMPILATION /EHsc /wd\\\"4503\\\"")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DCOMMONAPI_INTERNAL_COMPILATION -DCOMMONAPI_DLL_COMPILATION /wd\\\"4503\\\"")
+else()
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP")
+endif()
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_${MAX_LOG_LEVEL}")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+include_directories(
+ include
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${DBus_INCLUDE_DIRS}
+)
+
+# DBus source files
+file(GLOB CAPIDB_SRCS "src/CommonAPI/DBus/*.cpp")
+
+# pugixml source files
+file(GLOB PUGIXML_SRCS "src/pugixml/*.cpp")
+
+# murmurhash source files
+file(GLOB MMHASH_SRCS "src/murmurhash/*.cpp")
+
+# CommonAPI-DBus library
+add_library(CommonAPI-DBus ${CAPIDB_SRCS} ${PUGIXML_SRCS} ${MMHASH_SRCS})
+
+if(MSVC)
+#workaround since pkg-config on windows doesn't work easily
+target_link_libraries(CommonAPI-DBus CommonAPI debug ${DBus_BUILD_DIR}/bin/Debug/dbus-1d.lib optimized ${DBus_BUILD_DIR}/bin/Release/dbus-1.lib)
+else()
+target_link_libraries(CommonAPI-DBus CommonAPI dbus-1)
+endif()
+
+set_target_properties(CommonAPI-DBus PROPERTIES VERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION}.${LIBCOMMONAPI_DBUS_MINOR_VERSION}.${LIBCOMMONAPI_DBUS_PATCH_VERSION} SOVERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION} LINKER_LANGUAGE C)
+
+##############################################################################
+
+# configure files
+
+CONFIGURE_FILE(commonapi-dbus.spec.in commonapi-dbus.spec)
+
+##############################################################################
+# installing files
+
+# for installation of CommonAPI header files
+file (GLOB_RECURSE CommonAPI-DBus_INCLUDE_INSTALL_FILES "include/CommonAPI/DBus/*.hpp")
+set_target_properties (CommonAPI-DBus PROPERTIES PUBLIC_HEADER "${CommonAPI-DBus_INCLUDE_INSTALL_FILES}")
+
+# install CommonAPI-DBus library including headers
+install(TARGETS CommonAPI-DBus
+ EXPORT CommonAPI-DBusTargets
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+ ARCHIVE DESTINATION ${INSTALL_LIB_DIR}
+ PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/CommonAPI/DBus"
+)
+
+# install pugixml header files
+install(FILES include/pugixml/pugiconfig.hpp DESTINATION ${INSTALL_INCLUDE_DIR}/pugixml)
+install(FILES include/pugixml/pugixml.hpp DESTINATION ${INSTALL_INCLUDE_DIR}/pugixml)
+
+##############################################################################
+# exporting, configuring and installing of cmake files
+
+# Add all targets to the build-tree export set
+export(TARGETS CommonAPI-DBus
+ FILE "${PROJECT_BINARY_DIR}/CommonAPI-DBusTargets.cmake")
+
+# Export the package for use from the build-tree
+# (this registers the build-tree with a global CMake-registry)
+export(PACKAGE CommonAPI-DBus)
+
+# Create the CommonAPI-DBusConfig.cmake and CommonAPI-DBusConfigVersion files ...
+file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}")
+
+# ... for the build tree
+set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include")
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-DBusConfig.cmake.in
+ "${PROJECT_BINARY_DIR}/CommonAPI-DBusConfig.cmake" @ONLY)
+
+# ... for the install tree
+set(CONF_INCLUDE_DIRS "\${COMMONAPI_DBUS_CMAKE_DIR}/${REL_INCLUDE_DIR}")
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-DBusConfig.cmake.in
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CommonAPI-DBusConfig.cmake" @ONLY)
+
+# ... for both
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-DBusConfigVersion.cmake.in
+ "${PROJECT_BINARY_DIR}/CommonAPI-DBusConfigVersion.cmake" @ONLY)
+
+# Install the CommonAPI-DBusConfig.cmake and CommonAPI-DBusConfigVersion.cmake
+install(FILES
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CommonAPI-DBusConfig.cmake"
+ "${PROJECT_BINARY_DIR}/CommonAPI-DBusConfigVersion.cmake"
+ DESTINATION "${INSTALL_CMAKE_DIR}")
+
+# Install the export set for use with the install-tree
+install(EXPORT CommonAPI-DBusTargets DESTINATION
+ "${INSTALL_CMAKE_DIR}")
+
+##############################################################################
+# maintainer-clean
+add_custom_target(maintainer-clean COMMAND rm -rf *)
+
+##############################################################################
+# dist
+add_custom_target(dist
+ COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && git archive --format=tar.gz ${COMPONENT_VERSION} -o CommonAPI${COMPONENT_VERSION}.tar.gz
+)
+
+##############################################################################
+# build documentation
+FIND_PACKAGE(Doxygen)
+FIND_PROGRAM(ASCIIDOC_PATH asciidoc)
+if (NOT DOXYGEN_FOUND)
+ message(STATUS "Doxygen is not installed. Documentation can not be built.")
+else()
+ # set configuration variables for doxygen.in
+ set(PROJECT "GENIVI IPC Common API DBus C++")
+ set(DOCDIR doc)
+ set(SRCDIR .)
+ set(GENERATE_HTML YES)
+ set(GENERATE_HTMLHELP NO)
+ set(GENERATE_CHI NO)
+ set(GENERATE_LATEX NO)
+ set(GENERATE_PDF NO)
+ set(GENERATE_RTF NO)
+ set(GENERATE_MAN NO)
+ set(GENERATE_XML NO)
+
+ configure_file(doxygen.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY)
+
+ add_custom_target(doc)
+
+ add_custom_target(doxygen-doc
+ COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
+ SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
+
+ add_dependencies(doc doxygen-doc)
+
+ if ("${ASCIIDOC_PATH}" STREQUAL "ASCIIDOC_PATH-NOTFOUND")
+ message(STATUS "asciidoc is not installed. Readme can not be built.")
+ else()
+ message(STATUS "asciidoc found")
+ add_custom_command(TARGET doc
+ POST_BUILD
+ COMMAND asciidoc
+ -a version=${PACKAGE_VERSION}
+ -b html
+ -o doc/html/README.html
+ ${PROJECT_BINARY_DIR}/../README)
+ endif()
+endif()
+
+##############################################################################
+# Test section
+##############################################################################
+
+##############################################################################
+# google test
+
+# check for set environment variable
+if(${GTEST_ROOT} STREQUAL "n/a")
+ message(STATUS "GTEST_ROOT is not defined. For building the tests environment variable
+ GTEST_ROOT has to be defined. Tests can not be built.")
+ # early exit
+ return() # test can not be build -> make commands build_tests and check are not available
+else()
+ message(STATUS "GTEST_ROOT is set. gtest root path set to ${GTEST_ROOT}")
+endif()
+
+# build google test as static library (always) -> therefore deactivate BUILD_SHARED_LIBS in case it is active
+set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 0)
+if ("${BUILD_SHARED_LIBS}" STREQUAL "ON")
+ set(BUILD_SHARED_LIBS OFF)
+ set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 1)
+endif()
+add_subdirectory(${GTEST_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/gtest EXCLUDE_FROM_ALL)
+if ("${BUILD_SHARED_LIBS_AUTOMATIC_OFF}" STREQUAL "1")
+ set(BUILD_SHARED_LIBS ON)
+ set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 0)
+endif()
+
+##############################################################################
+# build tests
+
+enable_testing()
+
+add_custom_target(build_tests)
+
+set(CMAKE_CTEST_COMMAND ctest -V)
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+
+add_dependencies(check build_tests)
+
+##############################################################################
+# add test directory
+
+add_subdirectory( src/test EXCLUDE_FROM_ALL )
diff --git a/CommonAPI-DBus-uninstalled.pc.in b/CommonAPI-DBus-uninstalled.pc.in
deleted file mode 100644
index 17b4cc8..0000000
--- a/CommonAPI-DBus-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-abs_top_builddir=@abs_top_builddir@
-abs_top_srcdir=@abs_top_srcdir@
-prefix=${abs_top_srcdir}
-exec_prefix=${prefix}
-includedir=${prefix}/src
-libdir=${exec_prefix}/.libs
-
-Name: Common API C++ D-Bus Middleware
-Description: GENIVI Common API C++ D-Bus Middleware (uninstalled copy)
-Version: @PACKAGE_VERSION@
-Requires: CommonAPI dbus-1
-Libs: -Wl,--whole-archive ${abs_top_builddir}/libCommonAPI-DBus.la -Wl,--no-whole-archive
-Cflags: -I${abs_top_srcdir}/src \ No newline at end of file
diff --git a/CommonAPI-DBus.pc.in b/CommonAPI-DBus.pc.in
deleted file mode 100644
index c7cba59..0000000
--- a/CommonAPI-DBus.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: Common API C++ D-Bus Middleware
-Description: GENIVI Common API C++ D-Bus Middleware
-Version: @PACKAGE_VERSION@
-Requires: CommonAPI dbus-1
-Libs: -L${libdir} -Wl,--no-as-needed -lCommonAPI-DBus -Wl,--as-needed
-Cflags: -I${includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@ \ No newline at end of file
diff --git a/CommonAPI-DBus.sln b/CommonAPI-DBus.sln
index 19e7547..d48b6fc 100644
--- a/CommonAPI-DBus.sln
+++ b/CommonAPI-DBus.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Express 2013 for Windows Desktop
-VisualStudioVersion = 12.0.21005.1
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonAPI-DBus", "CommonAPI-DBus.vcxproj", "{D3B0744D-2A3E-4C36-9AA0-534D6BD5A44C}"
EndProject
@@ -10,6 +10,19 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests.vcxp
{D3B0744D-2A3E-4C36-9AA0-534D6BD5A44C} = {D3B0744D-2A3E-4C36-9AA0-534D6BD5A44C}
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Temp", "Temp", "{04DC3156-3D34-4F00-9A14-77D360BA3384}"
+ ProjectSection(SolutionItems) = preProject
+ src\test\DBusInputStreamTest.cpp = src\test\DBusInputStreamTest.cpp
+ src\test\DBusMainLoopIntegrationTest.cpp = src\test\DBusMainLoopIntegrationTest.cpp
+ src\test\DBusManagedTest.cpp = src\test\DBusManagedTest.cpp
+ src\test\DBusObjectManagerStubTest.cpp = src\test\DBusObjectManagerStubTest.cpp
+ src\test\DBusRuntimeTest.cpp = src\test\DBusRuntimeTest.cpp
+ src\test\DBusServiceRegistryTest.cpp = src\test\DBusServiceRegistryTest.cpp
+ src\test\DBusStubAdapterTest.cpp = src\test\DBusStubAdapterTest.cpp
+ src\test\DBusTypeStreamTest.cpp = src\test\DBusTypeStreamTest.cpp
+ src\test\DBusVariantOutputStreamTest.cpp = src\test\DBusVariantOutputStreamTest.cpp
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
diff --git a/CommonAPI-DBus.vcxproj b/CommonAPI-DBus.vcxproj
index 8fb18c3..6ee29b5 100644
--- a/CommonAPI-DBus.vcxproj
+++ b/CommonAPI-DBus.vcxproj
@@ -10,6 +10,76 @@
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\CommonAPI\DBus\DBusAddress.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusAddressTranslator.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusAttribute.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusClientId.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusConfig.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusConnection.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusDaemonProxy.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusDeployment.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusError.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusEvent.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusFactory.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusFreedesktopAttribute.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusFreedesktopPropertiesStub.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusFreedesktopStubAdapterHelper.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusFreedesktopVariant.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusFunctionalHash.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusHelper.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusInputStream.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusInstanceAvailabilityStatusChangedEvent.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusInterfaceHandler.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusMainLoopContext.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusMessage.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusMultiEvent.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusObjectManager.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusObjectManagerStub.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusOutputStream.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusProxy.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusProxyAsyncCallbackHandler.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusProxyBase.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusProxyConnection.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusProxyHelper.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusProxyManager.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusSelectiveEvent.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusSerializableArguments.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusServiceRegistry.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusStubAdapter.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusStubAdapterHelper.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusTypeOutputStream.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusTypes.hpp" />
+ <ClInclude Include="include\CommonAPI\DBus\DBusUtils.hpp" />
+ <ClInclude Include="include\murmurhash\MurmurHash3.h" />
+ <ClInclude Include="include\pugixml\pugiconfig.hpp" />
+ <ClInclude Include="include\pugixml\pugixml.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\CommonAPI\DBus\DBusAddress.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusAddressTranslator.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusClientId.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusConnection.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusDaemonProxy.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusDeployment.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusError.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusFactory.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusFreedesktopPropertiesStub.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusFunctionalHash.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusInputStream.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusMainLoopContext.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusMessage.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusObjectManager.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusObjectManagerStub.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusOutputStream.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusProxy.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusProxyBase.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusProxyManager.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusServiceRegistry.cpp" />
+ <ClCompile Include="src\CommonAPI\DBus\DBusStubAdapter.cpp" />
+ <ClCompile Include="src\murmurhash\MurmurHash3.cpp" />
+ <ClCompile Include="src\pugixml\pugixml.cpp" />
+ </ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D3B0744D-2A3E-4C36-9AA0-534D6BD5A44C}</ProjectGuid>
<RootNamespace>CommonAPIDBus</RootNamespace>
@@ -50,7 +120,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>$(COMMONAPI_DIR)\src;$(DBUS_BUILD_DIR);$(DBUS_DIR);$(SolutionDir)\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>include;$(DBUS_BUILD_DIR);$(DBUS_DIR);$(COMMONAPI_DIR)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
@@ -78,74 +148,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\CommonAPI\DBus\DBusAddressTranslator.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusClientId.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusConfiguration.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusConnection.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusDaemonProxy.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusError.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusFactory.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusFreedesktopPropertiesStub.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusFunctionalHash.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusInputStream.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusMainLoopContext.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusMessage.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusObjectManager.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusObjectManagerStub.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusOutputStream.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusProxy.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusProxyBase.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusProxyManager.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusRuntime.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusServicePublisher.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusServiceRegistry.cpp" />
- <ClCompile Include="src\CommonAPI\DBus\DBusStubAdapter.cpp" />
- <ClCompile Include="src\murmurhash\MurmurHash3.cpp" />
- <ClCompile Include="src\pugixml\pugixml.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\CommonAPI\DBus\DBusAddressTranslator.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusAttribute.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusClientId.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusConfiguration.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusConnection.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusConnectionBusType.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusDaemonProxy.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusError.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusEvent.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusFactory.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusFreedesktopPropertiesStub.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusFunctionalHash.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusHelper.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusInputStream.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusInstanceAvailabilityStatusChangedEvent.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusInterfaceHandler.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusLegacyVariant.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusMainLoopContext.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusMessage.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusMultiEvent.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusObjectManager.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusObjectManagerStub.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusOutputStream.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusProxy.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusProxyAsyncCallbackHandler.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusProxyBase.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusProxyConnection.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusProxyHelper.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusProxyManager.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusRuntime.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusSelectiveEvent.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusSerializableArguments.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusServicePublisher.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusServiceRegistry.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusStubAdapter.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusStubAdapterHelper.h" />
- <ClInclude Include="src\CommonAPI\DBus\DBusUtils.h" />
- <ClInclude Include="src\murmurhash\MurmurHash3.h" />
- <ClInclude Include="src\pugixml\pugiconfig.hpp" />
- <ClInclude Include="src\pugixml\pugixml.hpp" />
- </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..4ef692b
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,68 @@
+= IPC CommonAPI D-Bus C++
+
+:doctitle: IPC CommonAPI C++
+:version:
+
+== Copyright
+Copyright (C) 2015, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
+Copyright (C) 2015, GENIVI Alliance, Inc.
+
+This file is part of GENIVI Project IPC Common API C++.
+
+Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements or MPL 2.0.
+
+== License
+This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/.
+
+== Version
+{version}
+
+== CommonAPI D-Bus C++ User Guide
+The user guide can be found in the documentation directory of the CommonAPI-D-Bus-Tools project.
+
+== Further information
+Source code and latest news can be found at http://projects.genivi.org/commonapi/.
+
+== Build Instructions for Linux
+
+=== Patching libdbus
+
+CommonAPI-D-Bus needs some api functions of libdbus which are not available in actual libdbus versions. For these additional api functions it is necessary to patch the required libdbus version with the patches in the directory src/dbus-patches. Use autotools to build libdbus.
+
+----
+$ wget http://dbus.freedesktop.org/releases/dbus/dbus-<VERSION>.tar.gz
+$ tar -xzf dbus-<VERSION>.tar.gz
+$ cd dbus-<VERSION>
+$ patch -p1 < </path/to/CommonAPI-D-Bus/src/dbus-patches/patch-names>.patch
+$ ./configure --prefix=/usr/local
+$ make -C dbus
+$ sudo make -C dbus install
+$ sudo make install-pkgconfigDATA
+----
+
+You can change the installation directory by the prefix option or you can let it uninstalled (skip the +make install+ commands).
+
+=== Build CommonAPI-D-Bus Runtime
+
+In order to build the CommonAPI-D-Bus Runtime library the pkgconfig files of the patched libdbus library must be added to the +PKG_CONFIG_PATH+.
+
+For example, if the patched libdbus library is available in /usr/local, set the +PKG_CONFIG_PATH+ variable as follows:
+
+----
+$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
+----
+
+Now use CMake to build the CommonAPI D-Bus runtime library. We assume that your source directory is +common-api-dbus-runtime+:
+
+----
+$ cd common-api-dbus-runtime
+$ mkdir build
+$ cd build
+$ cmake -D USE_INSTALLED_COMMONAPI=ON -D CMAKE_INSTALL_PREFIX=/usr/local ..
+$ make
+$ make install
+----
+
+You can change the installation directory by the CMake variable +CMAKE_INSTALL_PREFIX+ or you can let it uninstalled (skip the +make install+ command). If you want to use the uninstalled version of CommonAPI set the CMake variable USE_INSTALLED_COMMONAPI to OFF.
+
+For further build instructions (build for windows, build documentation, tests etc.) please refer to the CommonAPI D-Bus tutorial. \ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 66e8f1c..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,448 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4
-
-EXTRA_DIST = LICENSE LICENSE_dbus_patch LICENSE_MurmurHash
-MOSTLYCLEANFILES =
-
-# Library interface (not package version!)
-LIBCOMMONAPI_DBUS_CURRENT=3
-LIBCOMMONAPI_DBUS_REVISION=1
-LIBCOMMONAPI_DBUS_AGE=0
-
-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}
-
-
-AM_LDFLAGS = \
- ${COMMONAPI_LIBS} \
- ${DBUS_LIBS}
-
-noinst_LTLIBRARIES =
-lib_LTLIBRARIES =
-
-# ------------------------------------------------------------------------------
-noinst_LTLIBRARIES += libmurmurhash-internal.la
-
-libmurmurhash_internal_la_SOURCES = \
- src/murmurhash/MurmurHash3.h \
- src/murmurhash/MurmurHash3.cpp
-
-# ------------------------------------------------------------------------------
-noinst_LTLIBRARIES += libpugixml-internal.la
-
-libpugixml_internal_la_SOURCES = \
- src/pugixml/pugiconfig.hpp \
- src/pugixml/pugixml.cpp \
- src/pugixml/pugixml.hpp
-# ------------------------------------------------------------------------------
-lib_LTLIBRARIES += libCommonAPI-DBus.la
-
-libCommonAPI_DBus_la_SOURCES = \
- src/CommonAPI/DBus/DBusAddressTranslator.cpp \
- src/CommonAPI/DBus/DBusClientId.cpp \
- src/CommonAPI/DBus/DBusConfiguration.cpp \
- src/CommonAPI/DBus/DBusConnection.cpp \
- src/CommonAPI/DBus/DBusDaemonProxy.cpp \
- src/CommonAPI/DBus/DBusError.cpp \
- src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp \
- src/CommonAPI/DBus/DBusFunctionalHash.cpp \
- src/CommonAPI/DBus/DBusInputStream.cpp \
- src/CommonAPI/DBus/DBusMainLoopContext.cpp \
- src/CommonAPI/DBus/DBusMessage.cpp \
- src/CommonAPI/DBus/DBusObjectManager.cpp \
- src/CommonAPI/DBus/DBusObjectManagerStub.cpp \
- src/CommonAPI/DBus/DBusOutputStream.cpp \
- src/CommonAPI/DBus/DBusProxyBase.cpp \
- src/CommonAPI/DBus/DBusProxy.cpp \
- src/CommonAPI/DBus/DBusProxyManager.cpp \
- src/CommonAPI/DBus/DBusFactory.cpp \
- src/CommonAPI/DBus/DBusRuntime.cpp \
- src/CommonAPI/DBus/DBusServicePublisher.cpp \
- src/CommonAPI/DBus/DBusServiceRegistry.cpp \
- src/CommonAPI/DBus/DBusStubAdapter.cpp
-
-libCommonAPI_DBus_la_LIBADD = \
- libmurmurhash-internal.la \
- libpugixml-internal.la \
- ${COMMONAPI_LIBS}
-libCommonAPI_DBus_la_LDFLAGS = \
- ${AM_LDFLAGS} \
- -version-info ${LIBCOMMONAPI_DBUS_CURRENT}:${LIBCOMMONAPI_DBUS_REVISION}:${LIBCOMMONAPI_DBUS_AGE}
-
-CommonAPI_DBus_pugi_includedir=$(includedir)/CommonAPI-${COMMONAPI_API_HEADER_VERSION}/pugixml
-CommonAPI_DBus_pugi_include_HEADERS = \
- src/pugixml/pugixml.hpp \
- src/pugixml/pugiconfig.hpp
-
-CommonAPI_DBus_includedir=$(includedir)/CommonAPI-${COMMONAPI_API_HEADER_VERSION}/CommonAPI/DBus
-CommonAPI_DBus_include_HEADERS = \
- src/CommonAPI/DBus/DBusAddressTranslator.h \
- src/CommonAPI/DBus/DBusAttribute.h \
- src/CommonAPI/DBus/DBusClientId.h \
- src/CommonAPI/DBus/DBusConfiguration.h \
- src/CommonAPI/DBus/DBusConnection.h \
- src/CommonAPI/DBus/DBusConnectionBusType.h \
- src/CommonAPI/DBus/DBusDaemonProxy.h \
- src/CommonAPI/DBus/DBusError.h \
- src/CommonAPI/DBus/DBusEvent.h \
- src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.h \
- src/CommonAPI/DBus/DBusFunctionalHash.h \
- src/CommonAPI/DBus/DBusHelper.h \
- src/CommonAPI/DBus/DBusInputStream.h \
- src/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.h \
- src/CommonAPI/DBus/DBusInterfaceHandler.h \
- src/CommonAPI/DBus/DBusMainLoopContext.h \
- src/CommonAPI/DBus/DBusMessage.h \
- src/CommonAPI/DBus/DBusMultiEvent.h \
- src/CommonAPI/DBus/DBusObjectManager.h \
- src/CommonAPI/DBus/DBusObjectManagerStub.h \
- src/CommonAPI/DBus/DBusOutputStream.h \
- src/CommonAPI/DBus/DBusProxyBase.h \
- src/CommonAPI/DBus/DBusProxy.h \
- src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h \
- src/CommonAPI/DBus/DBusProxyConnection.h \
- src/CommonAPI/DBus/DBusProxyManager.h \
- src/CommonAPI/DBus/DBusFactory.h \
- src/CommonAPI/DBus/DBusProxyHelper.h \
- src/CommonAPI/DBus/DBusRuntime.h \
- src/CommonAPI/DBus/DBusSelectiveEvent.h \
- src/CommonAPI/DBus/DBusSerializableArguments.h \
- src/CommonAPI/DBus/DBusServicePublisher.h \
- src/CommonAPI/DBus/DBusServiceRegistry.h \
- src/CommonAPI/DBus/DBusStubAdapter.h \
- src/CommonAPI/DBus/DBusStubAdapterHelper.h \
- src/CommonAPI/DBus/DBusUtils.h \
- src/CommonAPI/DBus/DBusLegacyVariant.h
-
-pkgconfigdir = ${libdir}/pkgconfig
-pkgconfig_DATA = CommonAPI-DBus.pc
-
-# ------------------------------------------------------------------------------
-if ENABLE_TESTS
-
-lib_LTLIBRARIES += libCommonAPI-Fake.la
-
-libCommonAPI_Fake_la_SOURCES = \
- src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.cpp
-
-libCommonAPI_Fake_la_LIBADD = \
- ${COMMONAPI_LIBS}
-libCommonAPI_Fake_la_LDFLAGS = \
- ${AM_LDFLAGS} \
- -version-info 1:0:0
-
-CommonAPI_Fake_includedir=$(includedir)/CommonAPI-${COMMONAPI_API_HEADER_VERSION}/CommonAPI/Fake
-CommonAPI_Fake_include_HEADERS = \
- src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h
-
-TestInterfaceSources = \
- src/test/commonapi/tests/DerivedTypeCollection.cpp \
- src/test/commonapi/tests/TestInterfaceStubDefault.cpp
-
-TestInterfaceDBusSources = \
- ${TestInterfaceSources} \
- src/test/commonapi/tests/TestInterfaceDBusProxy.cpp \
- src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp \
- src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
-
-FreedesktopPropertiesDBusSources = \
- ${TestInterfaceSources} \
- src/test/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp \
- src/test/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp \
- src/test/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp \
- src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp \
- src/test/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp \
- src/test/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
-
-ManagedSources = \
- src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp \
- src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp \
- src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp \
- src/test/commonapi/tests/managed/SecondRootStubDefault.cpp
-
-ManagedDBusSources = \
- ${ManagedSources} \
- src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp \
- src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp \
- src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp \
- src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp \
- src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp \
- src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp \
- src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp \
- src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
-
-ExtendedInterfaceSources = \
- src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp \
- src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp \
- src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp
-
-lib_LTLIBRARIES += libDBusGen-TestInterface.la
-libDBusGen_TestInterface_la_SOURCES = \
- ${TestInterfaceDBusSources}
-libDBusGen_TestInterface_la_LIBADD = \
- ${COMMONAPI_LIBS}
-libDBusGen_TestInterface_la_LDFLAGS = \
- ${AM_LDFLAGS}
-
-lib_LTLIBRARIES += libSomeOtherNameForGeneratedDBus.la
-libSomeOtherNameForGeneratedDBus_la_SOURCES = \
- ${TestInterfaceDBusSources}
-libSomeOtherNameForGeneratedDBus_la_LIBADD = \
- ${COMMONAPI_LIBS}
-libSomeOtherNameForGeneratedDBus_la_LDFLAGS = \
- ${AM_LDFLAGS}
-
-
-DYNAMIC_LOADING_TEST_SET = \
- DBusDynamicLoadingBasicTest \
- DBusDynamicLoadingMixedValidityTest \
- DBusDynamicLoadingNoValidityTest \
- DBusDynamicLoadingMultipleDefinitionTest \
- DBusDynamicLoadingMultipleBindingsTest
-
-check_PROGRAMS = \
- DBusManagedTest \
- DBusObjectManagerStubTest \
- DBusRuntimeTest \
- ${DYNAMIC_LOADING_TEST_SET} \
- DBusMainLoopIntegrationTest \
- DBusConnectionTest \
- DBusServiceRegistryTest \
- DBusProxyTest \
- DBusAddressTranslatorTest \
- DBusInputStreamTest \
- DBusOutputStreamTest \
- DBusFactoryTest \
- DBusVariantTest \
- DBusTypeStreamTest \
- DBusVariantOutputStreamTest \
- DBusDaemonProxyTest \
- DBusCommunicationTest \
- DBusMultipleConnectionTest \
- DBusServicePublisherTest \
- DBusClientIdTest \
- DBusBroadcastTest \
- DBusPolymorphicTest \
- DBusLoadTest \
- DBusFreedesktopPropertiesTest
-
-noinst_PROGRAMS = ${check_PROGRAMS}
-TESTS = ${check_PROGRAMS}
-
-LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS = ${GTEST_LIBS} ${LDADD}
-LDADD_FOR_GTEST = libCommonAPI-DBus.la ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
-
-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}
-
-DBusObjectManagerStubTest_SOURCES = src/test/DBusObjectManagerStubTest.cpp
-DBusObjectManagerStubTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusObjectManagerStubTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusObjectManagerStubTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusMainLoopIntegrationTest_SOURCES = \
- src/test/DBusMainLoopIntegrationTest.cpp \
- ${TestInterfaceDBusSources}
-DBusMainLoopIntegrationTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS} ${GLIB_CFLAGS}
-DBusMainLoopIntegrationTest_CXXFLAGS = ${GTEST_CXXFLAGS} ${GLIB_CFLAGS}
-DBusMainLoopIntegrationTest_LDADD = ${LDADD_FOR_GTEST} ${GLIB_LIBS}
-
-DBusServiceRegistryTest_SOURCES = \
- src/test/DBusServiceRegistryTest.cpp \
- ${TestInterfaceDBusSources}
-DBusServiceRegistryTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusServiceRegistryTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusServiceRegistryTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusAddressTranslatorTest_SOURCES = \
- src/test/DBusAddressTranslatorTest.cpp \
- ${TestInterfaceDBusSources}
-DBusAddressTranslatorTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusAddressTranslatorTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusAddressTranslatorTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusConnectionTest_SOURCES = src/test/DBusConnectionTest.cpp
-DBusConnectionTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusConnectionTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusConnectionTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusTypeStreamTest_SOURCES = src/test/DBusTypeStreamTest.cpp
-DBusTypeStreamTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusTypeStreamTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusTypeStreamTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusVariantOutputStreamTest_SOURCES = src/test/DBusVariantOutputStreamTest.cpp
-DBusVariantOutputStreamTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusVariantOutputStreamTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusVariantOutputStreamTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusCommunicationTest_SOURCES = \
- src/test/DBusCommunicationTest.cpp \
- ${TestInterfaceDBusSources}
-DBusCommunicationTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusCommunicationTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusCommunicationTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusDaemonProxyTest_SOURCES = src/test/DBusDaemonProxyTest.cpp
-DBusDaemonProxyTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusDaemonProxyTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusDaemonProxyTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusInputStreamTest_SOURCES = \
- src/test/DBusInputStreamTest.cpp \
- ${TestInterfaceDBusSources}
-DBusInputStreamTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusInputStreamTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusInputStreamTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusOutputStreamTest_SOURCES = \
- src/test/DBusOutputStreamTest.cpp \
- ${TestInterfaceDBusSources}
-DBusOutputStreamTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusOutputStreamTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusOutputStreamTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusFactoryTest_SOURCES = \
- src/test/DBusFactoryTest.cpp \
- ${TestInterfaceDBusSources}
-DBusFactoryTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusFactoryTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusFactoryTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusMultipleConnectionTest_SOURCES = \
- src/test/DBusMultipleConnectionTest.cpp \
- ${TestInterfaceDBusSources}
-DBusMultipleConnectionTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusMultipleConnectionTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusMultipleConnectionTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusProxyTest_SOURCES = \
- src/test/DBusProxyTest.cpp \
- ${TestInterfaceDBusSources} \
- ${ExtendedInterfaceSources}
-DBusProxyTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusProxyTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusProxyTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusFreedesktopPropertiesTest_SOURCES = \
- src/test/DBusFreedesktopPropertiesTest.cpp \
- ${FreedesktopPropertiesDBusSources}
-DBusFreedesktopPropertiesTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusFreedesktopPropertiesTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusFreedesktopPropertiesTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusServicePublisherTest_SOURCES = \
- src/test/DBusServicePublisherTest.cpp \
- ${TestInterfaceDBusSources}
-DBusServicePublisherTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusServicePublisherTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusServicePublisherTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusVariantTest_SOURCES = src/test/DBusVariantTest.cpp
-DBusVariantTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusVariantTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusVariantTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusRuntimeTest_SOURCES = src/test/DBusRuntimeTest.cpp
-DBusRuntimeTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusRuntimeTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusRuntimeTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusDynamicLoadingBasicTest_SOURCES = \
- ${TestInterfaceSources} \
- src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp
-DBusDynamicLoadingBasicTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusDynamicLoadingBasicTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusDynamicLoadingBasicTest_LDADD = ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
-
-DBusDynamicLoadingMultipleDefinitionTest_SOURCES = \
- ${TestInterfaceSources} \
- src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp
-DBusDynamicLoadingMultipleDefinitionTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusDynamicLoadingMultipleDefinitionTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusDynamicLoadingMultipleDefinitionTest_LDADD = ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
-
-DBusDynamicLoadingMultipleBindingsTest_SOURCES = \
- ${TestInterfaceSources} \
- src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp
-DBusDynamicLoadingMultipleBindingsTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusDynamicLoadingMultipleBindingsTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusDynamicLoadingMultipleBindingsTest_LDADD = ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
-
-DBusDynamicLoadingMixedValidityTest_SOURCES = \
- ${TestInterfaceSources} \
- src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp
-DBusDynamicLoadingMixedValidityTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusDynamicLoadingMixedValidityTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusDynamicLoadingMixedValidityTest_LDADD = ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
-
-DBusDynamicLoadingNoValidityTest_SOURCES = \
- ${TestInterfaceSources} \
- src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp
-DBusDynamicLoadingNoValidityTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusDynamicLoadingNoValidityTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusDynamicLoadingNoValidityTest_LDADD = ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
-
-DBusClientIdTest_SOURCES = \
- src/test/DBusClientIdTest.cpp
-DBusClientIdTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusClientIdTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusClientIdTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusBroadcastTest_SOURCES = \
- ${TestInterfaceDBusSources} \
- src/test/DBusBroadcastTest.cpp
-DBusBroadcastTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusBroadcastTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusBroadcastTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusPolymorphicTest_SOURCES = \
- ${TestInterfaceDBusSources} \
- src/test/DBusPolymorphicTest.cpp
-DBusPolymorphicTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusPolymorphicTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusPolymorphicTest_LDADD = ${LDADD_FOR_GTEST}
-
-DBusLoadTest_SOURCES = \
- src/test/DBusLoadTest.cpp \
- ${TestInterfaceDBusSources}
-DBusLoadTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS}
-DBusLoadTest_CXXFLAGS = ${GTEST_CXXFLAGS}
-DBusLoadTest_LDADD = ${LDADD_FOR_GTEST}
-
-endif
-
-
-# ------------------------------------------------------------------------------
-# Doxygen
-include $(top_srcdir)/aminclude.am
-EXTRA_DIST += doxygen.cfg dbus-DBusMessage-add-support-for-custom-marshaling.patch
-MOSTLYCLEANFILES += ${DX_CLEANFILES}
-
-# ------------------------------------------------------------------------------
-MAINTAINERCLEANFILES = \
- Makefile.in \
- aclocal.m4 \
- configure
-
-clean-local:
- -rm -rf src-gen
-
-maintainer-clean-local:
- -rm -rf build-aux
- -rm -f config.h.in*
- -rm -f m4/libtool*.m4
- -rm -f m4/lt*.m4
-
-doc: doxygen-doc
- asciidoc -b html -o doc/html/README.html README
diff --git a/README b/README
deleted file mode 100644
index 293c1cb..0000000
--- a/README
+++ /dev/null
@@ -1,294 +0,0 @@
-IPC CommonAPI C++ D-Bus
------------------------
-:Author: Juergen Gehring - juergen.gehring@bmw.de, Manfred Bathelt - manfred.bathelt@bmw.de
-:doctitle: IPC CommonAPI C++ D-Bus
-:version:
-
-Copyright
-+++++++++
-Copyright (C) 2014, BMW AG.
-Copyright (C) 2014, GENIVI Alliance, Inc.
-
-This file is part of GENIVI Project IPC Common API C++ D-Bus.
-
-Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements or MPL 2.0.
-
-License
-+++++++
-This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/.
-
-The files MurmurHash3.h, MurmurHash3.cpp, pugiconfig.hpp, pugixml.cpp and pugixml.hpp are subject to the terms of the MIT License (MIT). If a copy of the MIT was not distributed with this file, you can obtain one at http://opensource.org/licenses/MIT.
-
-Version
-+++++++
-{version}
-
-Further information
-+++++++++++++++++++
-Source code and latest news can be found at http://projects.genivi.org/commonapi/.
-
-Common API Overview
-~~~~~~~~~~~~~~~~~~~
-
-Common API C++ and its mechanism specific bindings (e.g. Common API D-Bus) provide a set of libraries and tools to work with
-RPC communication in a way independent of which mechanism is used. It currently consists of four sub-projects:
-
-*CommonAPI* - This is the base C++ library, which provides the application interface for users and can load runtime bindings such as DBus.
-
-*CommonAPI-Tools* - The Eclipse based tools for CommonAPI. This is essentially the code generator for the generation of C++ code from Franca IDL.
-
-*CommonAPI-D-Bus* - This is the D-Bus binding C++ library, which provides the necessary code to communicate over D-Bus. This is invisible to the application code, and simply needs to be linked against.
-
-*CommonAPI-D-Bus-Tools* - The eclipse based tools for CommonAPI D-Bus. This is the code generator for Franca IDL to Common API D-Bus C++ code.
-
-Build Instructions
-~~~~~~~~~~~~~~~~~~~
-
-Linux
-+++++
-
-To build this package the CommonAPI library and a version of libdbus patched with the marshaling patch must be available through PkgConfig. Instructions for making a patched version of libdbus available in /usr/local:
-
-----
-# wget http://dbus.freedesktop.org/releases/dbus/dbus-1.4.16.tar.gz
-
-# tar -xzf dbus-1.4.16.tar.gz
-
-# cd dbus-1.4.16
-
-# patch -p1 < /path/to/dbus-DBusMessage-add-support-for-custom-marshaling.patch
-
-# ./configure --prefix=/usr/local
-
-# make -C dbus
-
-# sudo make -C dbus install
-# sudo make install-pkgconfigDATA
-----
-
-The path to CommonAPI and patched libdbus pkgconfig files must be added to the +PKG_CONFIG_PATH+ for the entire build process.
-
-For example, if CommonAPI and patched dbus are available in /usr/local, set the +PKG_CONFIG_PATH+ variable as follows:
-
-----
-# export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
-----
-
-Now use Autotools to build this package with the above requirements available through Pkgconfig:
-
-----
-# autoreconf -i
-# ./configure
-# make
-# sudo make install (or alternative install process, eg. checkinstall on debian-based distributions, such as Ubuntu)
-----
-
-Building and executing the Unit Tests:
-
-----
-# export GTEST_CONFIG=/path/to/gtest-1.6.0/scripts/gtest-config
-# autoreconf -i
-# ./configure
-# make check
-----
-
-In order to execute the unit tests, the test framework "Google Test" (available at https://code.google.com/p/googletest/) needs to be available on your system. Google Test comes with a subfolder called "scripts", there you will find a file called "gtest-config". The path to this script has to be set via the environment variable GTEST_CONFIG. After having done so, CommonAPI and CommonAPI-D-Bus can be built and the make command "check" can be executed.
-
-"make check" builds and executes all tests. As the tests are developed as regression tests, the test output is limited to "OK" and "ERROR" for each test performed.
-
-Windows
-+++++++
-
-To build the Windows version of the dbus following steps have to be done:
-
-- Download dbus from http://www.freedesktop.org/wiki/Software/dbus/ e.g. dbus-1.8.0.tar.gz and unpack the archive into a directory
-- For building the dbus CMake is needed. Download CMake from http://cmake.org/cmake/resources/software.html. The result of the download is e.g. cmake-2.8.12.2-win32-x86.zip. Unpack the archive into a directory.
-- For building the dbus +expat+ is needed. +Expat+ can be downloaded from http://expat.sourceforge.net/ e.g. Download expat-win32bin-2.1.0.exe from http://sourceforge.net/projects/expat/files/expat_win32/2.1.0/. Install expat.
-- Now the dbus patch is needed. Download the patch from http://gnuwin32.sourceforge.net/packages/patch.htm e.g. patch-2.5.9-7-setup.exe and install the patch.
-- Install the CommonAPI dbus patch e.g. <patch_to_patch>\patch.exe -p1 < <patch_to_CommonAPI-D-Bus>\dbus-DBusMessage-add-support-for-custom-marshaling.patch.
-* Build dbus via the CMake command line tool:
-** Open the developer command line for VS2013
-** Change into root directory of the unpacked dbus archive e.g. dbus-1.8.0
-** Create a new directory dbus-build-dir e.g. mkdir dbus-build-dir
-** Change into this new created directory e.g. cd dbus-build-dir
-** Create the Visual Studio files for building the dbus:
-
-----
-cmake -DEXPAT_INCLUDE_DIR="<expat-path>\Source\lib"
- -DEXPAT_LIBRARY="<expat-path>\Bin\libexpat.lib" -G "Visual Studio 12" <DBusSourcenPath>\cmake
-----
-
-e.g. C:\Work\cmake-2.8.12.2-win32-x86\bin\cmake.exe
- -DEXPAT_INCLUDE_DIR="C:\Program Files (x86)\Expat 2.1.0\Source\lib"
- -DEXPAT_LIBRARY="C:\Program Files (x86)\Expat 2.1.0\Bin\libexpat.lib"
- -G "Visual Studio 12" C:\Work\dbus-1.8.0\cmake
-
-The Visual Studio files are created in the directory dbus-build-dir. Open the solution dbus.sln and build all projects. Info for dbus-1.8.0: In file printf.c the #include "test-utils.h" must be changed to #include "test/test-utils.h".
-
-To build now the Windows version with Visual Studio 2013, you can use the solution file CommonAPI-DBus.sln. It is configured to build CommonAPI-DBus as a static library.
-
-Before opening the solution file CommonAPI-DBus.sln the following environment variables must be set:
-
-* DBUS_DIR: directory containing the patched DBus sources e.g. <path_to_folder>\dbus-1.8.0
-* DBUS_BUILD_DIR: directory containing the build DBus e.g. <path_to_folder>\dbus-1.8.0\dbus-build-dir
-* COMMONAPI_DIR: directory containing the CommonAPI e.g. <path_to_folder>\ascgit017.CommonAPI
-
-To run the tests, you need to add the location of your built dbus-1d.dll or dbus-1.dll (depending on Debug or Release built) to the PATH environment variable.
-
-[NOTE]
-For building the tests the environment variable GTEST must be set (see README of CommonAPI).
-Furthermore the files DemoPoll.h and DemoPoll.cpp are needed (part of gnulib).
-
-Linking
-~~~~~~~
-
-Against CommonAPI
-+++++++++++++++++
-
-CommonAPI-D-Bus requires successful activation of all static initialization code on library load. Therefore it is necessary to activate certain linker flags to ensure this is always the case. These are specified in the pkg-config files, but are also listed here. In case of dynamic linking (.so) --no-as-needed must be specified for the CommonAPI-D-Bus library:
-----
--Wl,--no-as-needed -lCommonAPI-DBus -Wl,--as-needed
-----
-
-In case of static linking --whole-archive must be specified:
-----
--Wl,--whole-archive libCommonAPI-DBus.a -Wl,--no-whole-archive
-----
-
-Generated Proxies and Stubs
-+++++++++++++++++++++++++++
-
-Generated proxies and stubs also require successful activation of all static initialization code on load. If they are provided in either a static or dynamic library to the application they must also be linked wrapped in the flags described above.
-
-For linking the proxies and stubs on Windows notice the following information:
-
-* In case an error C4996 occurs disable this warning via the project settings.
-* Following code must be added to the file containing the call _CommonAPI::Runtime::load()_:
-** #define COMMONAPI_INTERNAL_COMPILATION
-** #include <CommonAPI/DBus/DBusRuntime.h>
-
-After loading of the runtime (std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();) the following code must be added:
-
-----
-// access the middlewareInfo in order to get a call to DBusRuntime. This forces the windows linker not to remove DBusRuntime from resulting binary
-std::cout << "Middleware Name: " << CommonAPI::DBus::DBusRuntime::middlewareInfo_.middlewareName_ << std::endl;
-----
-
-Configuring CommonAPI
-~~~~~~~~~~~~~~~~~~~~~
-
-Well known name
-+++++++++++++++
-
-The well known name that may be used to identify and dynamically load the D-Bus middleware binding is "DBus".
-
-
-Defining D-Bus Service Parameters
-+++++++++++++++++++++++++++++++++
-
-Normally, a CommonAPI address, format
-
-----
-<Domain>:<ServiceID>:<InstanceID>
-----
-
-is mapped to a D-Bus address the following way:
-
-----
-# D-Bus Interface Name = ServiceID
-# D-Bus Connection Name = InstanceID
-# D-Bus Object Path = InstanceID with a preceding '/' and all '.' replaced with '/'
-----
-For Domain, only the value "local" is allowed in this context, and it has no influence on the associated D-Bus service address values.
-
-In case a proxy or a service should not use the default mapping, it is possible to define config files that use the CommonAPI Address as a key in order to map any combination of D-Bus address values to it. The config files can be defined locally per binary, globally per binary or globally for all binaries.
-
-If more than one config file is defined and a CommonAPI address is defined more than once across several config files, the locally defined values override the global ones. If a CommonAPI address is defined more than once within a single file, the first definition found will be the only definition used.
-
-[NOTE]
-Only one managing interface can be defined per D-Bus object path!
-
-CommonAPI D-Bus Config files have to be named this way:
-
-----
-# Binary local: "<FqnOfBinary>_dbus.conf", e.g. "/usr/bin/myBinary_dbus.conf" if the binary is "/usr/bin/myBinary"
-# Binary global: "/etc/CommonApiDBus/<NameOfBinary>_dbus.conf", e.g. "/etc/CommonApiDBus/myBinary_dbus.conf"
-# Global: "/etc/CommonApiDBus/dbusAddresses.conf"
-----
-
-Each config file may have an arbitrary number of entries of the following format, with each entry being separated from the others by a newline:
-
-----
-[<CommonAPI Address>]
-dbus_connection=<valid D-Bus Connection Name>
-dbus_object=<valid D-Bus Object Path>
-dbus_interface=<valid D-Bus Interface Name>
-dbus_predefined=<true/false>
-----
-
-All "dbus_*"-values are optional. For each such omitted value the default value as described above will be used. For "dbus_predefined", the default value is "false".
-
-"dbus_predefined" should be used if the associated service of a proxy is a legacy service that does not provide the "org.freedesktop.DBus.ObjectManager" interface.
-
-* If "dbus_predefined" is set to "false" (which is default), a proxy will try to verify the existence of the specific interface at the specific connection name and object path, using the "org.freedesktop.DBus.ObjectManager" interface, before it is marked as available.
-* If "dbus_predefined" is set to "true", a proxy is marked as available as soon as the connection name of the associated
- service is visible. No further checks will be performed.
-
-Defining D-Bus Factory Parameters
-+++++++++++++++++++++++++++++++++
-
-If a section in a config file starts with "factory$", it defines a factory configuration, which can be referred to at factory creation. The name of the factory configuration follows the $ sign.
-
-----
-[factory$<Factory Name>]
-dbus_bustype=<valid D-Bus Bustype>
-----
-
-All "dbus_*"-values are optional. For each such omitted value the default value as described below will be used.
-
-# dbus_bustype may be set to "session" or "system" for communication on the user's session bus or on the system wide bus. The default value is "session"
-
-Remarks on Windows Version
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Restrictions
-++++++++++++
-
-* Calling disconnect and later connect on the same DBusConnection somehow damages the libdbus connection. On Linux implementation this all works fine.
-* The DBusLoadTest revealed that a number of more than about 50 proxies slows down the dbus communication significantly. That's why we run the DBusLoadTest on windows with just 50 instead of 100 proxies.
-
-Working on the code & contribution
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-- First get the code from the git:
-----
-git clone
-----
-
-- Get an overview of all branches:
-----
-git branch
-----
-
-- Switch to the branch you want to work on (master is the feature branch) and verify that it has switched (* changed)
-----
-git checkout <your branch>
-git branch
-----
-
-- Best practice is to create a local branch based on the current branch:
-----
-git branch working_branch
-----
-
-Start working, best practice is to commit smaller, compilable pieces during the development process that makes it easier to handle later on.
-
-- If you want to commit you changes, send them to the author, you can create a patch like this:
-----
-git format-patch working_branch <your branch>
-----
-
-This creates a set of patches that are published via the mailing list. The patches will be discussed and then merged & uploaded on the git by the maintainer.
-
-Patches can be accepted under MPL 2.0 (see section License). Please be sure that the signed-off-by is set correctly. For more, check out http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html
-
diff --git a/UnitTests.vcxproj b/UnitTests.vcxproj
index 9ba7a45..aa02c8a 100644
--- a/UnitTests.vcxproj
+++ b/UnitTests.vcxproj
@@ -11,16 +11,82 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="src\test\commonapi\tests\DerivedTypeCollection.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\ExtendedInterface.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceStubDefault.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\BranchInterface.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceStubDefault.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\LeafInterface.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceStubDefault.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\RootInterface.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceStubDefault.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\SecondRoot.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\SecondRootDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\SecondRootDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\SecondRootProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\SecondRootProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\SecondRootStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\managed\SecondRootStubDefault.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\PredefinedTypeCollection.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterface.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceStubDefault.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterface.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceStubDefault.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestInterface.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestInterfaceDBusProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestInterfaceDBusStubAdapter.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestInterfaceProxy.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestInterfaceProxyBase.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestInterfaceStub.hpp" />
+ <ClInclude Include="src\test\commonapi\tests\TestInterfaceStubDefault.hpp" />
+ <ClInclude Include="src\test\DBusTestUtils.hpp" />
+ <ClInclude Include="src\test\DemoMainLoop.hpp" />
+ <ClInclude Include="src\test\DemoPoll.h" />
+ </ItemGroup>
+ <ItemGroup>
<ClCompile Include="src\test\commonapi\tests\DerivedTypeCollection.cpp" />
<ClCompile Include="src\test\commonapi\tests\ExtendedInterfaceDBusProxy.cpp" />
<ClCompile Include="src\test\commonapi\tests\ExtendedInterfaceDBusStubAdapter.cpp" />
<ClCompile Include="src\test\commonapi\tests\ExtendedInterfaceStubDefault.cpp" />
+ <ClCompile Include="src\test\commonapi\tests\managed\BranchInterface.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\BranchInterfaceDBusProxy.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\BranchInterfaceDBusStubAdapter.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\BranchInterfaceStubDefault.cpp" />
+ <ClCompile Include="src\test\commonapi\tests\managed\LeafInterface.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\LeafInterfaceDBusProxy.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\LeafInterfaceDBusStubAdapter.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\LeafInterfaceStubDefault.cpp" />
+ <ClCompile Include="src\test\commonapi\tests\managed\RootInterface.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\RootInterfaceDBusProxy.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\RootInterfaceDBusStubAdapter.cpp" />
<ClCompile Include="src\test\commonapi\tests\managed\RootInterfaceStubDefault.cpp" />
@@ -37,89 +103,20 @@
<ClCompile Include="src\test\commonapi\tests\TestInterfaceDBusStubAdapter.cpp" />
<ClCompile Include="src\test\commonapi\tests\TestInterfaceStubDefault.cpp" />
<ClCompile Include="src\test\DBusAddressTranslatorTest.cpp" />
+ <ClCompile Include="src\test\DBusBroadcastTest.cpp" />
<ClCompile Include="src\test\DBusClientIdTest.cpp" />
<ClCompile Include="src\test\DBusCommunicationTest.cpp" />
<ClCompile Include="src\test\DBusConnectionTest.cpp" />
<ClCompile Include="src\test\DBusDaemonProxyTest.cpp" />
<ClCompile Include="src\test\DBusFactoryTest.cpp" />
<ClCompile Include="src\test\DBusFreedesktopPropertiesTest.cpp" />
- <ClCompile Include="src\test\DBusInputStreamTest.cpp" />
- <ClCompile Include="src\test\DBusMainLoopIntegrationTest.cpp" />
- <ClCompile Include="src\test\DBusManagedTest.cpp" />
+ <ClCompile Include="src\test\DBusLoadTest.cpp" />
<ClCompile Include="src\test\DBusMultipleConnectionTest.cpp" />
- <ClCompile Include="src\test\DBusObjectManagerStubTest.cpp" />
<ClCompile Include="src\test\DBusOutputStreamTest.cpp" />
<ClCompile Include="src\test\DBusPolymorphicTest.cpp" />
<ClCompile Include="src\test\DBusProxyTest.cpp" />
- <ClCompile Include="src\test\DBusRuntimeTest.cpp" />
<ClCompile Include="src\test\DBusServicePublisherTest.cpp" />
- <ClCompile Include="src\test\DBusServiceRegistryTest.cpp" />
- <ClCompile Include="src\test\DBusTypeStreamTest.cpp" />
- <ClCompile Include="src\test\DBusVariantOutputStreamTest.cpp" />
<ClCompile Include="src\test\DBusVariantTest.cpp" />
- <ClCompile Include="src\test\DemoPoll.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\test\commonapi\tests\DerivedTypeCollection.h" />
- <ClInclude Include="src\test\commonapi\tests\ExtendedInterface.h" />
- <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceStub.h" />
- <ClInclude Include="src\test\commonapi\tests\ExtendedInterfaceStubDefault.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\BranchInterface.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceStub.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\BranchInterfaceStubDefault.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\LeafInterface.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceStub.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\LeafInterfaceStubDefault.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\RootInterface.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceStub.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\RootInterfaceStubDefault.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\SecondRoot.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\SecondRootDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\SecondRootDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\SecondRootProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\SecondRootProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\SecondRootStub.h" />
- <ClInclude Include="src\test\commonapi\tests\managed\SecondRootStubDefault.h" />
- <ClInclude Include="src\test\commonapi\tests\PredefinedTypeCollection.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterface.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceStub.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopDerivedInterfaceStubDefault.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterface.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceStub.h" />
- <ClInclude Include="src\test\commonapi\tests\TestFreedesktopInterfaceStubDefault.h" />
- <ClInclude Include="src\test\commonapi\tests\TestInterface.h" />
- <ClInclude Include="src\test\commonapi\tests\TestInterfaceDBusProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\TestInterfaceDBusStubAdapter.h" />
- <ClInclude Include="src\test\commonapi\tests\TestInterfaceProxy.h" />
- <ClInclude Include="src\test\commonapi\tests\TestInterfaceProxyBase.h" />
- <ClInclude Include="src\test\commonapi\tests\TestInterfaceStub.h" />
- <ClInclude Include="src\test\commonapi\tests\TestInterfaceStubDefault.h" />
- <ClInclude Include="src\test\DBusTestUtils.h" />
- <ClInclude Include="src\test\DemoPoll.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A437B05C-A664-493D-B60A-822A3A7A1CED}</ProjectGuid>
@@ -163,17 +160,18 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(DBUS_DIR);$(DBUS_BUILD_DIR);$(SolutionDir)\src;$(SolutionDir)\src\test;$(COMMONAPI_DIR)\src;$(GTEST)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>ENABLE_ATTRIBUTE_EXTENSIONS;WIN32;COMMONAPI_INTERNAL_COMPILATION;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(DBUS_DIR);$(DBUS_BUILD_DIR);$(SolutionDir)\include;$(SolutionDir)\src\test;$(COMMONAPI_DIR)\include;$(GTEST)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>ENABLE_ATTRIBUTE_EXTENSIONS;WIN32;COMMONAPI_INTERNAL_COMPILATION;_DEBUG;__EXCEPTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
- <ShowIncludes>true</ShowIncludes>
+ <ShowIncludes>false</ShowIncludes>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(DBUS_BUILD_DIR)\bin\Debug;$(GTEST)\msvc\gtest-md\Debug;$(COMMONAPI_DIR)\Debug;$(SolutionDir)\Debug;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(DBUS_BUILD_DIR)\bin\Debug;$(GTEST)\msvc\gtest-md\Debug;C:\CommonAPI\CommonAPI\Debug;$(SolutionDir)\Debug;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>CommonAPId.lib;CommonAPI-DBusd.lib;gtestd.lib;gtest_main-mdd.lib;dbus-1d.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
diff --git a/aminclude.am b/aminclude.am
deleted file mode 100644
index 7dfed8d..0000000
--- a/aminclude.am
+++ /dev/null
@@ -1,168 +0,0 @@
-# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-#
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
-# ===========================================================================
-#
-
-## --------------------------------- ##
-## Format-independent Doxygen rules. ##
-## --------------------------------- ##
-
-if DX_COND_doc
-
-## ------------------------------- ##
-## Rules specific for HTML output. ##
-## ------------------------------- ##
-
-if DX_COND_html
-
-DX_CLEAN_HTML = @DX_DOCDIR@/html
-
-endif # DX_COND_html
-
-## ------------------------------ ##
-## Rules specific for CHM output. ##
-## ------------------------------ ##
-
-if DX_COND_chm
-
-DX_CLEAN_CHM = @DX_DOCDIR@/chm
-
-if DX_COND_chi
-
-DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
-
-endif # DX_COND_chi
-
-endif # DX_COND_chm
-
-## ------------------------------ ##
-## Rules specific for MAN output. ##
-## ------------------------------ ##
-
-if DX_COND_man
-
-DX_CLEAN_MAN = @DX_DOCDIR@/man
-
-endif # DX_COND_man
-
-## ------------------------------ ##
-## Rules specific for RTF output. ##
-## ------------------------------ ##
-
-if DX_COND_rtf
-
-DX_CLEAN_RTF = @DX_DOCDIR@/rtf
-
-endif # DX_COND_rtf
-
-## ------------------------------ ##
-## Rules specific for XML output. ##
-## ------------------------------ ##
-
-if DX_COND_xml
-
-DX_CLEAN_XML = @DX_DOCDIR@/xml
-
-endif # DX_COND_xml
-
-## ----------------------------- ##
-## Rules specific for PS output. ##
-## ----------------------------- ##
-
-if DX_COND_ps
-
-DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
-
-DX_PS_GOAL = doxygen-ps
-
-doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
-
-@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_LATEX) refman.tex; \
- $(MAKEINDEX_PATH) refman.idx; \
- $(DX_LATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_LATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
-
-endif # DX_COND_ps
-
-## ------------------------------ ##
-## Rules specific for PDF output. ##
-## ------------------------------ ##
-
-if DX_COND_pdf
-
-DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
-
-DX_PDF_GOAL = doxygen-pdf
-
-doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
-
-@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_PDFLATEX) refman.tex; \
- $(DX_MAKEINDEX) refman.idx; \
- $(DX_PDFLATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_PDFLATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- mv refman.pdf ../@PACKAGE@.pdf
-
-endif # DX_COND_pdf
-
-## ------------------------------------------------- ##
-## Rules specific for LaTeX (shared for PS and PDF). ##
-## ------------------------------------------------- ##
-
-if DX_COND_latex
-
-DX_CLEAN_LATEX = @DX_DOCDIR@/latex
-
-endif # DX_COND_latex
-
-.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
-
-doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
- rm -rf @DX_DOCDIR@
- $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
-
-DX_CLEANFILES = \
- @DX_DOCDIR@/@PACKAGE@.tag \
- -r \
- $(DX_CLEAN_HTML) \
- $(DX_CLEAN_CHM) \
- $(DX_CLEAN_CHI) \
- $(DX_CLEAN_MAN) \
- $(DX_CLEAN_RTF) \
- $(DX_CLEAN_XML) \
- $(DX_CLEAN_PS) \
- $(DX_CLEAN_PDF) \
- $(DX_CLEAN_LATEX)
-
-endif # DX_COND_doc \ No newline at end of file
diff --git a/cmake/CommonAPI-DBusConfig.cmake.in b/cmake/CommonAPI-DBusConfig.cmake.in
new file mode 100644
index 0000000..9f1f8ca
--- /dev/null
+++ b/cmake/CommonAPI-DBusConfig.cmake.in
@@ -0,0 +1,13 @@
+# - Config file for the CommonAPI-DBus package
+# It defines the following variables
+# COMMONAPI_DBUS_INCLUDE_DIRS - include directories for CommonAPI-DBus
+
+# Compute paths
+get_filename_component(COMMONAPI_DBUS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+set(COMMONAPI_DBUS_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
+
+# Our library dependencies (contains definitions for IMPORTED targets)
+include("${COMMONAPI_DBUS_CMAKE_DIR}/CommonAPI-DBusTargets.cmake")
+
+set(COMMONAPI_DBUS_VERSION @PACKAGE_VERSION@)
+set(COMMONAPI_DBUS_VERSION_STRING "@PACKAGE_VERSION@")
diff --git a/cmake/CommonAPI-DBusConfigVersion.cmake.in b/cmake/CommonAPI-DBusConfigVersion.cmake.in
new file mode 100644
index 0000000..8377282
--- /dev/null
+++ b/cmake/CommonAPI-DBusConfigVersion.cmake.in
@@ -0,0 +1,12 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+set(PACKAGE_VERSION_COMPATIBLE FALSE)
+
+string(REPLACE "." "\\." ESCAPED_API_HEADER_VERSION "@COMMONAPI_API_HEADER_VERSION@")
+if("${PACKAGE_FIND_VERSION}" MATCHES "^@ESCAPED_API_HEADER_VERSION@($|\\.)")
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+endif()
+
+if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
+ set(PACKAGE_VERSION_EXACT TRUE)
+endif()
diff --git a/commonapi-dbus.spec.in b/commonapi-dbus.spec.in
new file mode 100644
index 0000000..051996c
--- /dev/null
+++ b/commonapi-dbus.spec.in
@@ -0,0 +1,127 @@
+Name: @PROJECT_NAME@
+Version: @COMPONENT_VERSION@
+Release: @RPM_PACKAGE_VERSION@
+Summary: CommonAPI-DBus
+Group: libs
+License: @LICENSE@
+Vendor: BMW Group
+URL: http://www.bmw.de
+Source: @PROJECT_NAME@-@COMPONENT_VERSION@.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+#Requires: libcommonapi
+
+%description
+CAPI-DBus for IPC
+
+%package dev
+Summary: CommonAPI-DBus header files
+Group: Development/Libraries
+Requires: libcommonapi-dbus3
+
+%package staticdev
+Summary: CommonAPI-DBus header files
+Group: Development/Libraries
+Requires: libcommonapi-dbus3
+
+
+%description dev
+CAPI-DBus headers for IPC development
+
+%prep
+mkdir -p %{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI
+%setup
+
+
+
+%build
+mkdir -p build
+cd build
+cmake ..
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+cd build
+cmake ..
+make install DESTDIR=$RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT%{_bindir}
+mkdir -p %{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/libCommonAPI-DBus.so.@LIBCOMMONAPI_DBUS_MAJOR_VERSION@
+%{_libdir}/libCommonAPI-DBus.so.@LIBCOMMONAPI_DBUS_MAJOR_VERSION@.@LIBCOMMONAPI_DBUS_MINOR_VERSION@.@LIBCOMMONAPI_DBUS_PATCH_VERSION@
+%{_libdir}/libCommonAPI-DBus.so
+
+%files staticdev
+#%{_libdir}/libCommonAPI-DBus.la
+
+%files dev
+%defattr(-,root,root,-)
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusAddress.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusAddressTranslator.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusAttribute.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusClientId.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusConfig.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusConnection.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusDaemonProxy.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusDeployment.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusError.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusEvent.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusFactory.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusFreedesktopAttribute.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusFreedesktopVariant.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusFunctionalHash.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusHelper.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusInputStream.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusInterfaceHandler.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusMainLoopContext.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusMessage.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusMultiEvent.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusObjectManager.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusObjectManagerStub.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusOutputStream.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusProxy.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusProxyBase.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusProxyConnection.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusProxyHelper.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusProxyManager.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusSelectiveEvent.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusSerializableArguments.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusServiceRegistry.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusStubAdapter.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusStubAdapterHelper.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusTypeOutputStream.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusTypes.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/CommonAPI/DBus/DBusUtils.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/pugixml
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/pugixml/pugiconfig.hpp
+%{_includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@/pugixml/pugixml.hpp
+%{_libdir}/cmake/CommonAPI-@COMPONENT_VERSION@/CommonAPI-DBusConfig.cmake
+%{_libdir}/cmake/CommonAPI-@COMPONENT_VERSION@/CommonAPI-DBusConfigVersion.cmake
+%{_libdir}/cmake/CommonAPI-@COMPONENT_VERSION@/CommonAPI-DBusTargets.cmake
+%{_libdir}/cmake/CommonAPI-@COMPONENT_VERSION@/CommonAPI-DBusTargets-@CMAKE_BUILD_TYPE_FOR_SPEC_IN@.cmake
+
+%changelog dev
+* Mon Mar 23 2015 Markus Freutsmiedl <Markus.Freutsmiedl@partner.bmw.de> @GENIVI_PROJECT_VERSION@
+- LIB_MAJOR_VERSION changed to LIBCOMMONAPI_MAJOR_VERSION
+- LIB_MINOR_VERSION changed to LIBCOMMONAPI_MINOR_VERSION
+- LIB_PATCH_VERSION changed to LIBCOMMONAPI_PATCH_VERSION
+- files dev reworked
+
+%changelog dev
+* Wed Sep 3 2014 Markus Freutsmiedl <Markus.Freutsmiedl@partner.bmw.de> @GENIVI_PROJECT_VERSION@
+- files dev reworked
+
+%changelog dev
+* Tue Jun 03 2014 Markus Freutsmiedl <Markus.Freutsmiedl@partner.bmw.de> @GENIVI_PROJECT_VERSION@
+- Initial version
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index d655176..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,131 +0,0 @@
-AC_PREREQ([2.61])
-AC_INIT([GENIVI IPC Common API DBus C++],
- [2.1.6],
- [],
- [CommonAPI-DBus])
-
-AC_USE_SYSTEM_EXTENSIONS
-
-AC_CONFIG_MACRO_DIR([m4])
-m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_HEADERS([build-aux/config.h])
-AC_CONFIG_FILES([
- Makefile
- CommonAPI-DBus.pc
- CommonAPI-DBus-uninstalled.pc])
-
-AC_CANONICAL_SYSTEM
-
-AM_INIT_AUTOMAKE([foreign 1.11 silent-rules subdir-objects color-tests -Wall -Werror])
-AM_SILENT_RULES
-AM_MAINTAINER_MODE
-
-COMMONAPI_API_HEADER_VERSION="2.1"
-AC_SUBST(COMMONAPI_API_HEADER_VERSION)
-
-AC_ARG_WITH([loose-version-check], [AS_HELP_STRING([--with-loose-version-check], [if loose-version-check is set the CommonAPI will only be checked for major and minor version])],
- [LOOSE_VERSION_CHECK=1], [])
-
-AS_IF([test -z "${CXXFLAGS}"], [CXXFLAGS='-O0'], [])
-
-AC_PROG_CXX
-AC_LANG([C++])
-AX_CXX_COMPILE_STDCXX_11([noext])
-
-AC_ARG_VAR([GTEST_CONFIG], [The exact path of Google Test's 'gtest-config' script.])
-
-LT_PREREQ(2.2)
-LT_INIT
-PKG_PROG_PKG_CONFIG
-AS_IF([test ${LOOSE_VERSION_CHECK} = 1],
- [
- PKG_CHECK_MODULES(COMMONAPI, [CommonAPI >= 2.1 CommonAPI < 2.2])
- ],
- [
- PKG_CHECK_MODULES(COMMONAPI, [CommonAPI = 2.1.6])
- ]
-)
-PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.4.6])
-PKG_CHECK_MODULES(GLIB, [glib-2.0],
- [],
- [
- echo "WARNING: No glib found, tests will not be compiled!"
- TESTS_CAN_BE_EXECUTED=false
- ]
-)
-
-GTEST_MIN_VERSION="1.6.0"
-GTEST_URL="http://code.google.com/p/googletest"
-
-
-AC_ARG_VAR([GTEST_CONFIG], [The exact path of Google Test's 'gtest-config' script.])
-AC_ARG_VAR([GTEST_CPPFLAGS], [C-like preprocessor flags for Google Test.])
-AC_ARG_VAR([GTEST_CXXFLAGS], [C++ compile flags for Google Test.])
-AC_ARG_VAR([GTEST_LDFLAGS], [Linker path and option flags for Google Test.])
-AC_ARG_VAR([GTEST_LIBS], [Library linking flags for Google Test.])
-AC_ARG_VAR([GTEST_VERSION], [The available version of Google Test.])
-
-AS_IF([test -f "${GTEST_CONFIG}"],
- [AS_IF([${GTEST_CONFIG} --min-version=${GTEST_MIN_VERSION}],
- [],
- [AC_MSG_ERROR([dnl
- Found Google Test Version ${GTEST_VERSION}. However ${GTEST_MIN_VERSION} is
- required. Please refer to ${GTEST_URL} for a more recent version.])])
- [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`]
- [GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`]
- [GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`]
- [GTEST_LIBS=`${GTEST_CONFIG} --libs`]
- [GTEST_VERSION=`${GTEST_CONFIG} --version`]
- ]
- []
-)
-
-AS_IF([${TESTS_CAN_BE_EXECUTED}],
- [],
- [[GTEST_CPPFLAGS=""]
- [GTEST_CXXFLAGS=""]
- [GTEST_LDFLAGS=""]
- [GTEST_LIBS=""]
- [GTEST_VERSION=""]
- [GTEST_ERROR="
- WARNING: No glib found, tests will not be compiled! Please install the glib package!
- "]])
-
-AM_CONDITIONAL(ENABLE_TESTS, [test -f "${GTEST_CONFIG}" && ${TESTS_CAN_BE_EXECUTED}])
-
-# Doxygen support
-DX_HTML_FEATURE(ON)
-DX_CHM_FEATURE(OFF)
-DX_CHI_FEATURE(OFF)
-DX_MAN_FEATURE(OFF)
-DX_RTF_FEATURE(OFF)
-DX_XML_FEATURE(OFF)
-DX_PDF_FEATURE(OFF)
-DX_PS_FEATURE(OFF)
-DX_INIT_DOXYGEN(${PACKAGE_NAME}, doxygen.cfg, doc)
-
-AC_MSG_RESULT([
- $PACKAGE_NAME v$VERSION
- ${GTEST_ERROR}
- enable docs: ${ENABLE_DOCS}
-
- COMMONAPI_CFLAGS: ${COMMONAPI_CFLAGS}
- COMMONAPI_LIBS: ${COMMONAPI_LIBS}
-
- DBUS_CFLAGS: ${DBUS_CFLAGS}
- DBUS_LIBS: ${DBUS_LIBS}
-
- GTEST_CONFIG: ${GTEST_CONFIG}
- GTEST_CPPFLAGS: ${GTEST_CPPFLAGS}
- GTEST_CXXFLAGS: ${GTEST_CXXFLAGS}
- GTEST_LDFLAGS: ${GTEST_LDFLAGS}
- GTEST_LIBS: ${GTEST_LIBS}
- GTEST_VERSION: ${GTEST_VERSION}
-
- prefix: ${prefix}
- CXXFLAGS: ${CXXFLAGS}
- LDFLAGS: ${LDFLAGS}
-])
-
-AC_OUTPUT
diff --git a/docx/01_mainpage.dox b/docx/01_mainpage.dox
index 789c6c6..8484cd0 100644
--- a/docx/01_mainpage.dox
+++ b/docx/01_mainpage.dox
@@ -1,32 +1,23 @@
/**
- * Copyright (C) 2013 BMW AG
- *
- *
- * This file is part of GENIVI Project CommonAPI-D-Bus.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
* \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.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) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+ *
+ * This file is part of GENIVI project IPC CommonAPI D-Bus C++.
*
- * \author Juergen Gehring (juergen.gehring@bmw.de)
- * \author Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements.
*
*/
/*!
\mainpage
-\par Usage information
-can be found in the <a href="README.html">README file</a>.
-
-\par More information
-can be found at http://projects.genivi.org/commonapi/ \n
+\par License
+This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-\par About CommonAPI-D-Bus
-This is the D-Bus binding for CommonAPI.
+\par CommonAPI D-Bus C++ User Guide
+The user guide can be found in the documentation directory of the CommonAPI D-Bus Tools project.
+\par Build instructions
+can be found in the README file of this project.
*/ \ No newline at end of file
diff --git a/doxygen.cfg b/doxygen.in
index 357f4a1..dd571fd 100644
--- a/doxygen.cfg
+++ b/doxygen.in
@@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
-PROJECT_NAME = $(PROJECT)-$(VERSION)
+PROJECT_NAME = "@PROJECT@-@PACKAGE_VERSION@"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
@@ -52,7 +52,7 @@ PROJECT_LOGO =
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
-OUTPUT_DIRECTORY = $(DOCDIR)
+OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/@DOCDIR@
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -128,7 +128,7 @@ FULL_PATH_NAMES = YES
# If left blank the directory from which doxygen is run is used as the
# path to strip.
-STRIP_FROM_PATH = $(SRCDIR)
+STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/@SRCDIR@
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
@@ -319,22 +319,6 @@ INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penalty.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will roughly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-SYMBOL_CACHE_SIZE = 0
-
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
# their name and scope. Since this can be an expensive process and often the
@@ -426,7 +410,7 @@ HIDE_IN_BODY_DOCS = YES
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
-INTERNAL_DOCS = NO
+INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
@@ -440,7 +424,7 @@ CASE_SENSE_NAMES = YES
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
-HIDE_SCOPE_NAMES = NO
+HIDE_SCOPE_NAMES = YES
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the documentation
@@ -655,7 +639,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = $(SRCDIR) docx
+INPUT = @PROJECT_SOURCE_DIR@/@SRCDIR@ @PROJECT_SOURCE_DIR@/docx
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -687,7 +671,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE = src/test build-aux src/murmurhash
+EXCLUDE = @PROJECT_SOURCE_DIR@/src/test @PROJECT_SOURCE_DIR@/src/murmurhash
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -859,7 +843,7 @@ IGNORE_PREFIX =
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
-GENERATE_HTML = $(GENERATE_HTML)
+GENERATE_HTML = @GENERATE_HTML@
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
@@ -1000,27 +984,27 @@ DOCSET_PUBLISHER_NAME = Publisher
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
-GENERATE_HTMLHELP = $(GENERATE_HTMLHELP)
+GENERATE_HTMLHELP = @GENERATE_HTMLHELP@
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output directory.
-CHM_FILE = ../$(PROJECT).chm
+CHM_FILE = ../@PROJECT@.chm
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
-HHC_LOCATION = $(HHC_PATH)
+HHC_LOCATION = @HHC_PATH@
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
-GENERATE_CHI = $(GENERATE_CHI)
+GENERATE_CHI = @GENERATE_CHI@
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
# is used to encode HtmlHelp index (hhk), content (hhc) and project file
@@ -1216,7 +1200,7 @@ SERVER_BASED_SEARCH = NO
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
-GENERATE_LATEX = $(GENERATE_LATEX)
+GENERATE_LATEX = @GENERATE_LATEX@
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
@@ -1248,7 +1232,7 @@ COMPACT_LATEX = YES
# by the printer. Possible values are: a4, letter, legal and
# executive. If left blank a4wide will be used.
-PAPER_TYPE = $(PAPER_SIZE)
+PAPER_TYPE = @PAPER_SIZE@
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
@@ -1280,7 +1264,7 @@ PDF_HYPERLINKS = NO
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
-USE_PDFLATEX = $(GENERATE_PDF)
+USE_PDFLATEX = @GENERATE_PDF@
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
@@ -1316,7 +1300,7 @@ LATEX_BIB_STYLE = plain
# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
-GENERATE_RTF = $(GENERATE_RTF)
+GENERATE_RTF = @GENERATE_RTF@
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
@@ -1357,7 +1341,7 @@ RTF_EXTENSIONS_FILE =
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
-GENERATE_MAN = $(GENERATE_MAN)
+GENERATE_MAN = @GENERATE_MAN@
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
@@ -1386,7 +1370,7 @@ MAN_LINKS = NO
# generate an XML file that captures the structure of
# the code including all documentation.
-GENERATE_XML = $(GENERATE_XML)
+GENERATE_XML = @GENERATE_XML@
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
@@ -1550,7 +1534,7 @@ TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
-GENERATE_TAGFILE = $(DOCDIR)/$(PROJECT).tag
+GENERATE_TAGFILE = @DOCDIR@/@PROJECT@.tag
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
@@ -1601,7 +1585,7 @@ HIDE_UNDOC_RELATIONS = YES
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
-HAVE_DOT = $(HAVE_DOT)
+HAVE_DOT = @HAVE_DOT@
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
# allowed to run in parallel. When set to 0 (the default) doxygen will
@@ -1732,7 +1716,7 @@ INTERACTIVE_SVG = NO
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
-DOT_PATH = $(DOT_PATH)
+DOT_PATH = @DOT_PATH@
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
diff --git a/eclipse-code-style-formatter.xml b/eclipse-code-style-formatter.xml
deleted file mode 100644
index 8be3b29..0000000
--- a/eclipse-code-style-formatter.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<profiles version="1">
-<profile kind="CodeFormatterProfile" name="C++ Itestra" version="1">
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="120"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_member_access" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list" value="82"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment" value="1"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="4"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_enumerator_list" value="48"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_declarator_list" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_empty_lines" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.join_wrapped_lines" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="48"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="82"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.continuation_indentation" value="4"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_expression_list" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" value="80"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer" value="4"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_compact_if" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_assignment" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain" value="18"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration" value="80"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_body" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_binary_expression" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.compact_else_if" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="4"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments" value="do not insert"/>
-</profile>
-</profiles> \ No newline at end of file
diff --git a/include/CommonAPI/DBus/DBusAddress.hpp b/include/CommonAPI/DBus/DBusAddress.hpp
new file mode 100644
index 0000000..926b11b
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusAddress.hpp
@@ -0,0 +1,53 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_ADDRESS_HPP_
+#define COMMONAPI_DBUS_ADDRESS_HPP_
+
+#include <iostream>
+#include <map>
+
+#include <CommonAPI/Export.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusAddress {
+public:
+ COMMONAPI_EXPORT DBusAddress(const std::string &_service = "",
+ const std::string &_objectPath = "",
+ const std::string &_interface = "");
+ COMMONAPI_EXPORT DBusAddress(const DBusAddress &_source);
+ COMMONAPI_EXPORT virtual ~DBusAddress();
+
+ COMMONAPI_EXPORT bool operator==(const DBusAddress &_other) const;
+ COMMONAPI_EXPORT bool operator!=(const DBusAddress &_other) const;
+ COMMONAPI_EXPORT bool operator<(const DBusAddress &_other) const;
+
+ COMMONAPI_EXPORT const std::string &getInterface() const;
+ COMMONAPI_EXPORT void setInterface(const std::string &_interface);
+
+ COMMONAPI_EXPORT const std::string &getObjectPath() const;
+ COMMONAPI_EXPORT void setObjectPath(const std::string &_objectPath);
+
+ COMMONAPI_EXPORT const std::string &getService() const;
+ COMMONAPI_EXPORT void setService(const std::string &_service);
+
+private:
+ std::string service_;
+ std::string objectPath_;
+ std::string interface_;
+
+friend std::ostream &operator<<(std::ostream &_out, const DBusAddress &_dbusAddress);
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_ADDRESS_HPP_
diff --git a/include/CommonAPI/DBus/DBusAddressTranslator.hpp b/include/CommonAPI/DBus/DBusAddressTranslator.hpp
new file mode 100644
index 0000000..6d950e9
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusAddressTranslator.hpp
@@ -0,0 +1,61 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_ADDRESSTRANSLATOR_HPP_
+#define COMMONAPI_DBUS_ADDRESSTRANSLATOR_HPP_
+
+#include <map>
+#include <memory>
+#include <mutex>
+
+#include <CommonAPI/Address.hpp>
+#include <CommonAPI/DBus/DBusAddress.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusAddressTranslator {
+public:
+ COMMONAPI_EXPORT static std::shared_ptr<DBusAddressTranslator> get();
+
+ COMMONAPI_EXPORT DBusAddressTranslator();
+
+ COMMONAPI_EXPORT void init();
+
+ COMMONAPI_EXPORT bool translate(const std::string &_key, DBusAddress &_value);
+ COMMONAPI_EXPORT bool translate(const CommonAPI::Address &_key, DBusAddress &_value);
+
+ COMMONAPI_EXPORT bool translate(const DBusAddress &_key, std::string &_value);
+ COMMONAPI_EXPORT bool translate(const DBusAddress &_key, CommonAPI::Address &_value);
+
+ COMMONAPI_EXPORT void insert(const std::string &_address,
+ const std::string &_service, const std::string &_path, const std::string &_interface);
+
+private:
+ COMMONAPI_EXPORT bool readConfiguration();
+
+ COMMONAPI_EXPORT bool isValid(const std::string &, const char,
+ bool = false, bool = false, bool = false) const;
+
+private:
+ bool isDefault_;
+
+ std::string defaultConfig_;
+ std::string defaultDomain_;
+
+ std::map<CommonAPI::Address, DBusAddress> forwards_;
+ std::map<DBusAddress, CommonAPI::Address> backwards_;
+
+ std::mutex mutex_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_ADDRESSTRANSLATOR_HPP_
diff --git a/include/CommonAPI/DBus/DBusAttribute.hpp b/include/CommonAPI/DBus/DBusAttribute.hpp
new file mode 100644
index 0000000..3d9170d
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusAttribute.hpp
@@ -0,0 +1,156 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_ATTRIBUTE_HPP_
+#define COMMONAPI_DBUS_DBUS_ATTRIBUTE_HPP_
+
+#include <cassert>
+#include <cstdint>
+#include <tuple>
+
+#include <CommonAPI/DBus/DBusConfig.hpp>
+#include <CommonAPI/DBus/DBusEvent.hpp>
+#include <CommonAPI/DBus/DBusProxyHelper.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+class DBusReadonlyAttribute: public _AttributeType {
+public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef _AttributeDepl ValueTypeDepl;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+
+ DBusReadonlyAttribute(DBusProxy &_proxy,
+ const char *setMethodSignature, const char *getMethodName,
+ _AttributeDepl *_depl = nullptr)
+ : proxy_(_proxy),
+ getMethodName_(getMethodName),
+ setMethodSignature_(setMethodSignature),
+ depl_(_depl) {
+ assert(getMethodName);
+ }
+
+ void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const {
+ CommonAPI::Deployable<ValueType, _AttributeDepl> deployedValue(depl_);
+ DBusProxyHelper<
+ DBusSerializableArguments<
+ >,
+ DBusSerializableArguments<
+ CommonAPI::Deployable<
+ ValueType,
+ _AttributeDepl
+ >
+ >
+ >::callMethodWithReply(proxy_, getMethodName_, "", (_info ? _info : &defaultCallInfo), _status, deployedValue);
+ _value = deployedValue.getValue();
+ }
+
+ std::future<CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<ValueType, _AttributeDepl> deployedValue(depl_);
+ return DBusProxyHelper<
+ DBusSerializableArguments<>,
+ DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>>
+ >::callMethodAsync(proxy_, getMethodName_, "", (_info ? _info : &defaultCallInfo),
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, _AttributeDepl> _response) {
+ _callback(_status, _response.getValue());
+ },
+ std::make_tuple(deployedValue));
+ }
+
+ protected:
+ DBusProxy &proxy_;
+ const char *getMethodName_;
+ const char *setMethodSignature_;
+ _AttributeDepl *depl_;
+};
+
+template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+class DBusAttribute: public DBusReadonlyAttribute<_AttributeType, _AttributeDepl> {
+public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+
+ DBusAttribute(DBusProxy &_proxy,
+ const char *_setMethodName, const char *_setMethodSignature, const char *_getMethodName,
+ _AttributeDepl *_depl = nullptr)
+ : DBusReadonlyAttribute<_AttributeType, _AttributeDepl>(_proxy, _setMethodSignature, _getMethodName, _depl),
+ setMethodName_(_setMethodName),
+ setMethodSignature_(_setMethodSignature) {
+ assert(_setMethodName);
+ assert(_setMethodSignature);
+ }
+
+ void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<ValueType, _AttributeDepl> deployedRequest(_request, this->depl_);
+ CommonAPI::Deployable<ValueType, _AttributeDepl> deployedResponse(this->depl_);
+ DBusProxyHelper<DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>>,
+ DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>> >::callMethodWithReply(
+ this->proxy_,
+ setMethodName_,
+ setMethodSignature_,
+ (_info ? _info : &defaultCallInfo),
+ deployedRequest,
+ _status,
+ deployedResponse);
+ _response = deployedResponse.getValue();
+ }
+
+
+ std::future<CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<ValueType, _AttributeDepl> deployedRequest(_request, this->depl_);
+ CommonAPI::Deployable<ValueType, _AttributeDepl> deployedResponse(this->depl_);
+ return DBusProxyHelper<DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>>,
+ DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>> >::callMethodAsync(
+ this->proxy_,
+ setMethodName_,
+ setMethodSignature_,
+ (_info ? _info : &defaultCallInfo),
+ deployedRequest,
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, _AttributeDepl> _response) {
+ _callback(_status, _response.getValue());
+ },
+ std::make_tuple(deployedResponse));
+ }
+
+ protected:
+ const char* setMethodName_;
+ const char* setMethodSignature_;
+};
+
+template <typename _AttributeType>
+class DBusObservableAttribute: public _AttributeType {
+public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::ValueTypeDepl ValueTypeDepl;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename _AttributeType::ChangedEvent ChangedEvent;
+
+ template <typename... _AttributeTypeArguments>
+ DBusObservableAttribute(DBusProxy &_proxy,
+ const char *_changedEventName,
+ _AttributeTypeArguments... arguments)
+ : _AttributeType(_proxy, arguments...),
+ changedEvent_(_proxy, _changedEventName, this->setMethodSignature_,
+ std::make_tuple(CommonAPI::Deployable<ValueType, ValueTypeDepl>(this->depl_))) {
+ }
+
+ ChangedEvent &getChangedEvent() {
+ return changedEvent_;
+ }
+
+ protected:
+ DBusEvent<ChangedEvent, CommonAPI::Deployable<ValueType, ValueTypeDepl> > changedEvent_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_ATTRIBUTE_HPP_
diff --git a/include/CommonAPI/DBus/DBusClientId.hpp b/include/CommonAPI/DBus/DBusClientId.hpp
new file mode 100644
index 0000000..72dc1c5
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusClientId.hpp
@@ -0,0 +1,48 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSCLIENTID_HPP_
+#define COMMONAPI_DBUS_DBUSCLIENTID_HPP_
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/Types.hpp>
+
+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 struct std::hash<DBusClientId>;
+
+public:
+ COMMONAPI_EXPORT DBusClientId(std::string dbusId);
+
+ COMMONAPI_EXPORT bool operator==(CommonAPI::ClientId& clientIdToCompare);
+ COMMONAPI_EXPORT bool operator==(DBusClientId& clientIdToCompare);
+ COMMONAPI_EXPORT size_t hashCode();
+
+ COMMONAPI_EXPORT const char * getDBusId();
+
+ COMMONAPI_EXPORT 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_HPP_
diff --git a/include/CommonAPI/DBus/DBusConfig.hpp b/include/CommonAPI/DBus/DBusConfig.hpp
new file mode 100644
index 0000000..dae6b7a
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusConfig.hpp
@@ -0,0 +1,24 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSCONFIG_HPP_
+#define COMMONAPI_DBUS_DBUSCONFIG_HPP_
+
+#include <CommonAPI/CallInfo.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+static const Timeout_t DEFAULT_SEND_TIMEOUT_MS = 5000;
+static CommonAPI::CallInfo defaultCallInfo(DEFAULT_SEND_TIMEOUT_MS);
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSCONFIG_HPP_
diff --git a/include/CommonAPI/DBus/DBusConnection.hpp b/include/CommonAPI/DBus/DBusConnection.hpp
new file mode 100644
index 0000000..436cfab
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusConnection.hpp
@@ -0,0 +1,246 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_CONNECTION_HPP_
+#define COMMONAPI_DBUS_DBUS_CONNECTION_HPP_
+
+#include <atomic>
+
+#include <dbus/dbus.h>
+
+#include <CommonAPI/DBus/DBusConfig.hpp>
+#include <CommonAPI/DBus/DBusDaemonProxy.hpp>
+#include <CommonAPI/DBus/DBusMainLoopContext.hpp>
+#include <CommonAPI/DBus/DBusObjectManager.hpp>
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+#include <CommonAPI/DBus/DBusServiceRegistry.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusObjectManager;
+
+class DBusConnectionStatusEvent
+ : public DBusProxyConnection::ConnectionStatusEvent {
+public:
+ DBusConnectionStatusEvent(DBusConnection* dbusConnection);
+ virtual ~DBusConnectionStatusEvent() {}
+
+ protected:
+ virtual void onListenerAdded(const Listener& listener);
+
+ // TODO: change to std::weak_ptr<DBusConnection> connection_;
+ DBusConnection* dbusConnection_;
+
+friend class 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:
+ COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> getBus(const DBusType_t &_type);
+ COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> wrap(::DBusConnection *_connection);
+
+ COMMONAPI_EXPORT DBusConnection(DBusType_t _type);
+ COMMONAPI_EXPORT DBusConnection(const DBusConnection&) = delete;
+ COMMONAPI_EXPORT DBusConnection(::DBusConnection* libDbusConnection);
+ COMMONAPI_EXPORT virtual ~DBusConnection();
+
+ COMMONAPI_EXPORT DBusConnection& operator=(const DBusConnection&) = delete;
+
+ COMMONAPI_EXPORT DBusType_t getBusType() const;
+
+ COMMONAPI_EXPORT bool connect(bool startDispatchThread = true);
+ COMMONAPI_EXPORT bool connect(DBusError& dbusError, bool startDispatchThread = true);
+ COMMONAPI_EXPORT void disconnect();
+
+ COMMONAPI_EXPORT virtual bool isConnected() const;
+
+ COMMONAPI_EXPORT virtual ConnectionStatusEvent& getConnectionStatusEvent();
+
+ COMMONAPI_EXPORT virtual bool requestServiceNameAndBlock(const std::string& serviceName) const;
+ COMMONAPI_EXPORT virtual bool releaseServiceName(const std::string& serviceName) const;
+
+ COMMONAPI_EXPORT bool sendDBusMessage(const DBusMessage& dbusMessage/*, uint32_t* allocatedSerial = NULL*/) const;
+
+ COMMONAPI_EXPORT std::future<CallStatus> sendDBusMessageWithReplyAsync(
+ const DBusMessage& dbusMessage,
+ std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
+ const CommonAPI::CallInfo *_info) const;
+
+ COMMONAPI_EXPORT DBusMessage sendDBusMessageWithReplyAndBlock(const DBusMessage& dbusMessage,
+ DBusError& dbusError,
+ const CommonAPI::CallInfo *_info) const;
+
+ COMMONAPI_EXPORT virtual bool addObjectManagerSignalMemberHandler(const std::string& dbusBusName,
+ DBusSignalHandler* dbusSignalHandler);
+ COMMONAPI_EXPORT virtual bool removeObjectManagerSignalMemberHandler(const std::string& dbusBusName,
+ DBusSignalHandler* dbusSignalHandler);
+
+ COMMONAPI_EXPORT DBusSignalHandlerToken addSignalMemberHandler(const std::string& objectPath,
+ const std::string& interfaceName,
+ const std::string& interfaceMemberName,
+ const std::string& inuint32_tterfaceMemberSignature,
+ DBusSignalHandler* dbusSignalHandler,
+ const bool justAddFilter = false);
+
+ COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcast(bool& subscriptionAccepted,
+ const std::string& objectPath,
+ const std::string& interfaceName,
+ const std::string& interfaceMemberName,
+ const std::string& interfaceMemberSignature,
+ DBusSignalHandler* dbusSignalHandler,
+ DBusProxy* callingProxy);
+
+ COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
+ DBusProxyConnection::DBusSignalHandlerToken subscription,
+ DBusProxy* callingProxy,
+ const DBusSignalHandler* dbusSignalHandler);
+
+ COMMONAPI_EXPORT void registerObjectPath(const std::string& objectPath);
+ COMMONAPI_EXPORT void unregisterObjectPath(const std::string& objectPath);
+
+ COMMONAPI_EXPORT bool removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken,
+ const DBusSignalHandler* dbusSignalHandler = NULL);
+ COMMONAPI_EXPORT bool readWriteDispatch(int timeoutMilliseconds = -1);
+
+ COMMONAPI_EXPORT virtual const std::shared_ptr<DBusObjectManager> getDBusObjectManager();
+
+ COMMONAPI_EXPORT void setObjectPathMessageHandler(DBusObjectPathMessageHandler);
+ COMMONAPI_EXPORT bool isObjectPathMessageHandlerSet();
+
+ COMMONAPI_EXPORT virtual bool attachMainLoopContext(std::weak_ptr<MainLoopContext>);
+
+ COMMONAPI_EXPORT bool isDispatchReady();
+ COMMONAPI_EXPORT 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:
+ COMMONAPI_EXPORT void dispatch();
+ COMMONAPI_EXPORT void suspendDispatching() const;
+ COMMONAPI_EXPORT void resumeDispatching() const;
+
+ std::thread* dispatchThread_;
+ bool stopDispatching_;
+
+ std::weak_ptr<MainLoopContext> mainLoopContext_;
+ DispatchSource* dispatchSource_;
+ WatchContext* watchContext_;
+
+ mutable std::recursive_mutex sendLock_;
+ mutable bool pauseDispatching_;
+ mutable std::mutex dispatchSuspendLock_;
+
+ COMMONAPI_EXPORT void addLibdbusSignalMatchRule(const std::string& objectPath,
+ const std::string& interfaceName,
+ const std::string& interfaceMemberName,
+ const bool justAddFilter = false);
+
+ COMMONAPI_EXPORT void removeLibdbusSignalMatchRule(const std::string& objectPath,
+ const std::string& interfaceName,
+ const std::string& interfaceMemberName);
+
+ COMMONAPI_EXPORT void initLibdbusSignalFilterAfterConnect();
+ ::DBusHandlerResult onLibdbusSignalFilter(::DBusMessage* libdbusMessage);
+
+ COMMONAPI_EXPORT void initLibdbusObjectPathHandlerAfterConnect();
+ ::DBusHandlerResult onLibdbusObjectPathMessage(::DBusMessage* libdbusMessage);
+
+ COMMONAPI_EXPORT static void onLibdbusPendingCallNotifyThunk(::DBusPendingCall* libdbusPendingCall, void* userData);
+ COMMONAPI_EXPORT static void onLibdbusDataCleanup(void* userData);
+
+ COMMONAPI_EXPORT static ::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
+ ::DBusMessage* libdbusMessage,
+ void* userData);
+
+ COMMONAPI_EXPORT static ::DBusHandlerResult onLibdbusSignalFilterThunk(::DBusConnection* libdbusConnection,
+ ::DBusMessage* libdbusMessage,
+ void* userData);
+
+ COMMONAPI_EXPORT static dbus_bool_t onAddWatch(::DBusWatch* libdbusWatch, void* data);
+ COMMONAPI_EXPORT static void onRemoveWatch(::DBusWatch* libdbusWatch, void* data);
+ COMMONAPI_EXPORT static void onToggleWatch(::DBusWatch* libdbusWatch, void* data);
+
+ COMMONAPI_EXPORT static dbus_bool_t onAddTimeout(::DBusTimeout* dbus_timeout, void* data);
+ COMMONAPI_EXPORT static void onRemoveTimeout(::DBusTimeout* dbus_timeout, void* data);
+ COMMONAPI_EXPORT static void onToggleTimeout(::DBusTimeout* dbus_timeout, void* data);
+
+ COMMONAPI_EXPORT static void onWakeupMainContext(void* data);
+
+ COMMONAPI_EXPORT void enforceAsynchronousTimeouts() const;
+ COMMONAPI_EXPORT static const DBusObjectPathVTable* getDBusObjectPathVTable();
+
+ ::DBusConnection* connection_;
+ mutable std::mutex connectionGuard_;
+
+ std::mutex signalGuard_;
+ std::mutex objectManagerGuard_;
+ std::mutex serviceRegistryGuard_;
+
+ DBusType_t busType_;
+
+ 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_;
+
+ COMMONAPI_EXPORT bool addObjectManagerSignalMatchRule(const std::string& dbusBusName);
+ COMMONAPI_EXPORT bool removeObjectManagerSignalMatchRule(const std::string& dbusBusName);
+
+ COMMONAPI_EXPORT bool addLibdbusSignalMatchRule(const std::string& dbusMatchRule);
+ COMMONAPI_EXPORT bool removeLibdbusSignalMatchRule(const std::string& dbusMatchRule);
+
+ 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_;
+
+ typedef std::pair<DBusMessageReplyAsyncHandler *, DBusMessage> MainloopTimeout_t;
+ mutable std::list<MainloopTimeout_t> mainloopTimeouts_;
+
+ mutable std::mutex enforceTimeoutMutex_;
+ mutable std::condition_variable enforceTimeoutCondition_;
+
+ mutable std::shared_ptr<std::thread> enforcerThread_;
+ mutable std::mutex enforcerThreadMutex_;
+ bool enforcerThreadCancelled_;
+};
+
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_CONNECTION_HPP_
diff --git a/include/CommonAPI/DBus/DBusDaemonProxy.hpp b/include/CommonAPI/DBus/DBusDaemonProxy.hpp
new file mode 100644
index 0000000..1333548
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusDaemonProxy.hpp
@@ -0,0 +1,94 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_DAEMON_PROXY_HPP_
+#define COMMONAPI_DBUS_DBUS_DAEMON_PROXY_HPP_
+
+#include <functional>
+#include <string>
+#include <vector>
+
+#include <CommonAPI/Address.hpp>
+
+#include <CommonAPI/DBus/DBusAttribute.hpp>
+#include <CommonAPI/DBus/DBusEvent.hpp>
+#include <CommonAPI/DBus/DBusProxyBase.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class StaticInterfaceVersionAttribute: public InterfaceVersionAttribute {
+ public:
+ StaticInterfaceVersionAttribute(const uint32_t& majorValue, const uint32_t& minorValue);
+
+ void getValue(CommonAPI::CallStatus& callStatus, Version &_version, const CommonAPI::CallInfo *_info) const;
+ std::future<CommonAPI::CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info);
+
+ 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;
+
+ COMMONAPI_EXPORT DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection);
+ COMMONAPI_EXPORT virtual ~DBusDaemonProxy() {}
+
+ COMMONAPI_EXPORT virtual bool isAvailable() const;
+ COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
+ COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent();
+
+ COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
+
+ COMMONAPI_EXPORT void init();
+
+ COMMONAPI_EXPORT static const char* getInterfaceId();
+
+ COMMONAPI_EXPORT NameOwnerChangedEvent& getNameOwnerChangedEvent();
+
+ COMMONAPI_EXPORT void listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const;
+ COMMONAPI_EXPORT std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const;
+
+ COMMONAPI_EXPORT void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const;
+ COMMONAPI_EXPORT std::future<CallStatus> nameHasOwnerAsync(const std::string& busName,
+ NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const;
+
+ COMMONAPI_EXPORT std::future<CallStatus> getManagedObjectsAsync(const std::string& forDBusServiceName,
+ 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;
+
+ private:
+ DBusEvent<NameOwnerChangedEvent, std::string, std::string, std::string> nameOwnerChangedEvent_;
+ StaticInterfaceVersionAttribute interfaceVersionAttribute_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_DAEMON_PROXY_HPP_
diff --git a/include/CommonAPI/DBus/DBusDeployment.hpp b/include/CommonAPI/DBus/DBusDeployment.hpp
new file mode 100644
index 0000000..21ad78a
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusDeployment.hpp
@@ -0,0 +1,37 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSDEPLOYMENTS_HPP_
+#define COMMONAPI_DBUS_DBUSDEPLOYMENTS_HPP_
+
+#include <string>
+#include <unordered_map>
+
+#include <CommonAPI/Deployment.hpp>
+#include <CommonAPI/Export.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+template<typename... _Types>
+struct VariantDeployment : CommonAPI::Deployment<_Types...> {
+ VariantDeployment(bool _isFreeDesktop, _Types*... _t)
+ : CommonAPI::Deployment<_Types...>(_t...),
+ isFreeDesktop_(_isFreeDesktop) {
+ }
+
+ bool isFreeDesktop_;
+};
+
+extern COMMONAPI_IMPORT_EXPORT VariantDeployment<> freedesktopVariant;
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSDEPLOYMENTS_HPP_
diff --git a/include/CommonAPI/DBus/DBusError.hpp b/include/CommonAPI/DBus/DBusError.hpp
new file mode 100644
index 0000000..6e8f170
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusError.hpp
@@ -0,0 +1,45 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_ERROR_HPP_
+#define COMMONAPI_DBUS_DBUS_ERROR_HPP_
+
+#include <string>
+#include <dbus/dbus.h>
+
+#include <CommonAPI/Export.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusConnection;
+
+
+class COMMONAPI_EXPORT 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_HPP_
diff --git a/include/CommonAPI/DBus/DBusEvent.hpp b/include/CommonAPI/DBus/DBusEvent.hpp
new file mode 100644
index 0000000..a3bfe01
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusEvent.hpp
@@ -0,0 +1,91 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_EVENT_HPP_
+#define COMMONAPI_DBUS_DBUS_EVENT_HPP_
+
+#include <CommonAPI/Event.hpp>
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusHelper.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusProxyBase.hpp>
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+#include <CommonAPI/DBus/DBusSerializableArguments.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+template <typename _Event, typename... _Arguments>
+class DBusEvent: public _Event, public DBusProxyConnection::DBusSignalHandler {
+public:
+ typedef typename _Event::Listener Listener;
+
+ DBusEvent(DBusProxyBase &_proxy,
+ const std::string &_name, const std::string &_signature,
+ std::tuple<_Arguments...> _arguments)
+ : proxy_(_proxy),
+ name_(_name), signature_(_signature),
+ arguments_(_arguments) {
+
+ interface_ = proxy_.getDBusAddress().getInterface();
+ path_ = proxy_.getDBusAddress().getObjectPath();
+ }
+
+ DBusEvent(DBusProxyBase &_proxy,
+ const std::string &_name, const std::string &_signature,
+ const std::string &_path, const std::string &_interface,
+ std::tuple<_Arguments...> _arguments)
+ : proxy_(_proxy),
+ name_(_name), signature_(_signature),
+ path_(_path), interface_(_interface),
+ arguments_(_arguments) {
+ }
+
+ virtual ~DBusEvent() {
+ proxy_.removeSignalMemberHandler(subscription_, this);
+ }
+
+ virtual void onSignalDBusMessage(const DBusMessage &_message) {
+ handleSignalDBusMessage(_message, typename make_sequence<sizeof...(_Arguments)>::type());
+ }
+ protected:
+ virtual void onFirstListenerAdded(const Listener&) {
+ subscription_ = proxy_.addSignalMemberHandler(
+ path_, interface_, name_, signature_, this);
+ }
+
+ virtual void onLastListenerRemoved(const Listener&) {
+ proxy_.removeSignalMemberHandler(subscription_, this);
+ }
+
+ template<int ... _Indices>
+ inline void handleSignalDBusMessage(const DBusMessage &_message, index_sequence<_Indices...>) {
+ DBusInputStream input(_message);
+ if (DBusSerializableArguments<
+ _Arguments...
+ >::deserialize(input, std::get<_Indices>(arguments_)...)) {
+ this->notifyListeners(std::get<_Indices>(arguments_)...);
+ }
+ }
+
+ DBusProxyBase &proxy_;
+
+ std::string name_;
+ std::string signature_;
+ std::string path_;
+ std::string interface_;
+
+ DBusProxyConnection::DBusSignalHandlerToken subscription_;
+ std::tuple<_Arguments...> arguments_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_EVENT_HPP_
diff --git a/include/CommonAPI/DBus/DBusFactory.hpp b/include/CommonAPI/DBus/DBusFactory.hpp
new file mode 100644
index 0000000..fa0808b
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusFactory.hpp
@@ -0,0 +1,114 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_FACTORY_HPP_
+#define COMMONAPI_DBUS_FACTORY_HPP_
+
+#include <map>
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/Factory.hpp>
+#include <CommonAPI/DBus/DBusTypes.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusAddress;
+class DBusProxy;
+class DBusProxyConnection;
+class DBusStubAdapter;
+
+typedef std::shared_ptr<DBusProxy>
+(*ProxyCreateFunction)(const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection);
+
+typedef std::shared_ptr<DBusStubAdapter>
+(*StubAdapterCreateFunction) (const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection,
+ const std::shared_ptr<StubBase> &_stub);
+
+class Factory : public CommonAPI::Factory {
+public:
+ COMMONAPI_EXPORT static std::shared_ptr<Factory> get();
+
+ COMMONAPI_EXPORT Factory();
+ COMMONAPI_EXPORT virtual ~Factory();
+
+ COMMONAPI_EXPORT void registerProxyCreateMethod(const std::string &_address,
+ ProxyCreateFunction _function);
+
+ COMMONAPI_EXPORT void registerStubAdapterCreateMethod(const std::string &_address,
+ StubAdapterCreateFunction _function);
+
+
+ COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ const ConnectionId_t &_connectionId);
+
+ COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<MainLoopContext> _context);
+
+ COMMONAPI_EXPORT bool registerStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<StubBase> _stub,
+ const ConnectionId_t &_connectionId);
+
+ COMMONAPI_EXPORT bool registerStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<StubBase> _stub,
+ std::shared_ptr<MainLoopContext> _context);
+
+ COMMONAPI_EXPORT bool unregisterStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance);
+
+ // Services
+ COMMONAPI_EXPORT std::shared_ptr<DBusStubAdapter> getRegisteredService(const std::string &_address);
+
+ // Managed services
+ COMMONAPI_EXPORT std::shared_ptr<DBusStubAdapter> createDBusStubAdapter(const std::shared_ptr<StubBase> &_stub,
+ const std::string &_interface,
+ const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection);
+ COMMONAPI_EXPORT bool registerManagedService(const std::shared_ptr<DBusStubAdapter> &_adapter);
+ COMMONAPI_EXPORT bool unregisterManagedService(const std::string &_address);
+
+private:
+ COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(const ConnectionId_t &);
+ COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(std::shared_ptr<MainLoopContext>);
+ COMMONAPI_EXPORT bool registerStubAdapter(std::shared_ptr<DBusStubAdapter>);
+ COMMONAPI_EXPORT bool unregisterStubAdapter(std::shared_ptr<DBusStubAdapter>);
+
+ // Managed services
+ typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> ServicesMap;
+ COMMONAPI_EXPORT bool unregisterManagedService(const ServicesMap::iterator &);
+
+private:
+ static std::shared_ptr<Factory> theFactory;
+
+ std::map<ConnectionId_t, std::shared_ptr<DBusConnection>> connections_;
+ std::map<MainLoopContext *, std::shared_ptr<DBusConnection>> contextConnections_;
+
+ std::map<std::string, ProxyCreateFunction> proxyCreateFunctions_;
+ std::map<std::string, StubAdapterCreateFunction> stubAdapterCreateFunctions_;
+
+ ServicesMap services_;
+
+ DBusType_t defaultBusType_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_FACTORY_HPP_
diff --git a/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp
new file mode 100644
index 0000000..dc485cb
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp
@@ -0,0 +1,451 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_FREEDESKTOPATTRIBUTE_HPP_
+#define COMMONAPI_DBUS_DBUS_FREEDESKTOPATTRIBUTE_HPP_
+
+#include <CommonAPI/DBus/DBusDeployment.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+template <typename _AttributeType>
+class DBusFreedesktopReadonlyAttribute: public _AttributeType {
+public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+
+ DBusFreedesktopReadonlyAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
+ : proxy_(_proxy),
+ interfaceName_(_interfaceName),
+ propertyName_(_propertyName) {
+ }
+
+ void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const {
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedValue(&freedesktopVariant);
+ DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string
+ >,
+ DBusSerializableArguments<
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
+ >
+ >::callMethodWithReply(
+ proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ "ss",
+ (_info ? _info : &defaultCallInfo),
+ interfaceName_,
+ propertyName_,
+ _status,
+ deployedValue);
+
+ _value = deployedValue.getValue().template get<ValueType>();
+ }
+
+ std::future<CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedValue(&freedesktopVariant);
+ return DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string
+ >,
+ DBusSerializableArguments<
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
+ >
+ >::callMethodAsync(
+ proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ "ss",
+ (_info ? _info : &defaultCallInfo),
+ interfaceName_,
+ propertyName_,
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> _value) {
+ _callback(_status, _value.getValue().template get<ValueType>());
+ },
+ std::make_tuple(deployedValue)
+ );
+ }
+
+protected:
+ DBusProxy &proxy_;
+ std::string interfaceName_;
+ std::string propertyName_;
+};
+
+template <typename _AttributeType>
+class DBusFreedesktopUnionReadonlyAttribute: public _AttributeType {
+public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+
+ DBusFreedesktopUnionReadonlyAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
+ : proxy_(_proxy),
+ interfaceName_(_interfaceName),
+ propertyName_(_propertyName) {
+ }
+
+ void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const {
+ CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedValue(&freedesktopVariant);
+ DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string
+ >,
+ DBusSerializableArguments<
+ CommonAPI::Deployable<ValueType, VariantDeployment<>>
+ >
+ >::callMethodWithReply(
+ proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ "ss",
+ (_info ? _info : &defaultCallInfo),
+ interfaceName_,
+ propertyName_,
+ _status,
+ deployedValue);
+
+ _value = deployedValue.getValue().template get<ValueType>();
+ }
+
+ std::future<CommonAPI::CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedValue(&freedesktopVariant);
+ return DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string
+ >,
+ DBusSerializableArguments<
+ CommonAPI::Deployable<ValueType, VariantDeployment<>>
+ >
+ >::callMethodAsync(
+ proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ "ss",
+ (_info ? _info : &defaultCallInfo),
+ interfaceName_,
+ propertyName_,
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, VariantDeployment<>> _value) {
+ _callback(_status, _value.getValue().template get<ValueType>());
+ },
+ std::make_tuple(deployedValue)
+ );
+ }
+
+protected:
+ DBusProxy &proxy_;
+ std::string interfaceName_;
+ std::string propertyName_;
+};
+
+template <typename _AttributeType>
+class DBusFreedesktopAttribute
+ : public DBusFreedesktopReadonlyAttribute<_AttributeType> {
+ public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename _AttributeType::ChangedEvent ChangedEvent;
+
+ DBusFreedesktopAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
+ : DBusFreedesktopReadonlyAttribute<_AttributeType>(_proxy, _interfaceName, _propertyName) {
+ }
+
+ void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
+ DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
+ >,
+ DBusSerializableArguments<
+ >
+ >::callMethodWithReply(
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ "ssv",
+ (_info ? _info : &defaultCallInfo),
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
+ deployedVariant,
+ _status);
+ _response = _request;
+ }
+
+ std::future<CommonAPI::CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
+ return DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
+ >,
+ DBusSerializableArguments<
+ >
+ >::callMethodAsync(
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ "ssv",
+ (_info ? _info : &defaultCallInfo),
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
+ deployedVariant,
+ [_callback, deployedVariant](CommonAPI::CallStatus _status) {
+ _callback(_status, deployedVariant.getValue().template get<ValueType>());
+ },
+ std::tuple<>());
+ }
+};
+
+template <typename _AttributeType>
+class DBusFreedesktopUnionAttribute
+ : public DBusFreedesktopReadonlyAttribute<_AttributeType> {
+ public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+
+ DBusFreedesktopUnionAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
+ : DBusFreedesktopUnionReadonlyAttribute<_AttributeType>(_proxy, _interfaceName, _propertyName) {
+ }
+
+ void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
+ DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string, CommonAPI::Deployable<ValueType, VariantDeployment<>>
+ >,
+ DBusSerializableArguments<
+ >
+ >::callMethodWithReply(
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ "ssv",
+ (_info ? _info : &defaultCallInfo),
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
+ deployedVariant,
+ _status);
+ _response = _request;
+ }
+
+ std::future<CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
+ CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
+ return DBusProxyHelper<
+ DBusSerializableArguments<
+ std::string, std::string, CommonAPI::Deployable<ValueType, VariantDeployment<>>
+ >,
+ DBusSerializableArguments<
+ >
+ >::callMethodAsync(
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ "ssv",
+ (_info ? _info : &defaultCallInfo),
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
+ DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
+ deployedVariant,
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, VariantDeployment<>> _value) {
+ _callback(_status, _value.getValue().template get<ValueType>());
+ },
+ std::make_tuple(deployedVariant));
+ }
+};
+
+template<class, class>
+class LegacyEvent;
+
+template <template <class...> class _Type, class _Types, class _Variant>
+class LegacyEvent<_Type<_Types>, _Variant>: public _Type<_Types> {
+public:
+ typedef _Types ValueType;
+ typedef typename _Type<ValueType>::Listener Listener;
+ typedef std::unordered_map<std::string, _Variant> PropertyMap;
+ typedef MapDeployment<EmptyDeployment, VariantDeployment<>> PropertyMapDeployment;
+ typedef Deployable<PropertyMap, PropertyMapDeployment> DeployedPropertyMap;
+ typedef std::vector<std::string> InvalidArray;
+ typedef Event<std::string, DeployedPropertyMap, InvalidArray> SignalEvent;
+
+ LegacyEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
+ : interfaceName_(_interfaceName),
+ propertyName_(_propertyName),
+ isSubcriptionSet_(false),
+ internalEvent_(_proxy,
+ "PropertiesChanged",
+ "sa{sv}as",
+ _proxy.getDBusAddress().getObjectPath(),
+ "org.freedesktop.DBus.Properties",
+ std::make_tuple("", getDeployedMap(), InvalidArray())) {
+ }
+
+protected:
+ void onFirstListenerAdded(const Listener &) {
+ if (!isSubcriptionSet_) {
+ subscription_ = internalEvent_.subscribe(
+ [this](const std::string &_interfaceName,
+ const PropertyMap &_properties,
+ const InvalidArray &_invalid) {
+ if (interfaceName_ == _interfaceName) {
+ auto iter = _properties.find(propertyName_);
+ if (iter != _properties.end()) {
+ const ValueType &value = iter->second.template get<ValueType>();
+ this->notifyListeners(value);
+ }
+ }
+ });
+
+ isSubcriptionSet_ = true;
+ }
+ }
+
+ void onLastListenerRemoved(const Listener &) {
+ if (isSubcriptionSet_) {
+ internalEvent_.unsubscribe(subscription_);
+ isSubcriptionSet_ = false;
+ }
+ }
+
+ std::string interfaceName_;
+ std::string propertyName_;
+
+ typename DBusEvent<SignalEvent, std::string, DeployedPropertyMap, InvalidArray>::Subscription subscription_;
+ bool isSubcriptionSet_;
+
+ DBusEvent<SignalEvent, std::string, DeployedPropertyMap, InvalidArray> internalEvent_;
+
+private:
+ static DeployedPropertyMap &getDeployedMap() {
+ static PropertyMapDeployment itsDeployment(nullptr, &freedesktopVariant);
+ static DeployedPropertyMap itsDeployedMap(&itsDeployment);
+ return itsDeployedMap;
+ }
+};
+
+template <typename _AttributeType, typename _Variant>
+class DBusFreedesktopObservableAttribute: public _AttributeType {
+ public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename _AttributeType::ChangedEvent ChangedEvent;
+
+ template <typename... _AttributeTypeArguments>
+ DBusFreedesktopObservableAttribute(DBusProxy &_proxy,
+ const std::string &_interfaceName,
+ const std::string &_propertyName,
+ _AttributeTypeArguments... _arguments)
+ : _AttributeType(_proxy, _interfaceName, _propertyName, _arguments...),
+ interfaceName_(_interfaceName),
+ propertyName_(_propertyName),
+ externalChangedEvent_(_proxy, _interfaceName, _propertyName) {
+ }
+
+ ChangedEvent &getChangedEvent() {
+ return externalChangedEvent_;
+ }
+
+ protected:
+ std::string interfaceName_;
+ std::string propertyName_;
+ LegacyEvent<ChangedEvent, _Variant> externalChangedEvent_;
+};
+
+template<class, class>
+class LegacyUnionEvent;
+
+template <template <class...> class _Type, class _Types, class _Variant>
+class LegacyUnionEvent<_Type<_Types>, _Variant>: public _Type<_Types> {
+public:
+ typedef _Types ValueType;
+ typedef typename _Type<ValueType>::Listener Listener;
+ typedef std::unordered_map<std::string, _Variant> PropertyMap;
+ typedef MapDeployment<EmptyDeployment, VariantDeployment<>> PropertyMapDeployment;
+ typedef CommonAPI::Deployable<PropertyMap, PropertyMapDeployment> DeployedPropertyMap;
+ typedef std::vector<std::string> InvalidArray;
+ typedef Event<std::string, DeployedPropertyMap, InvalidArray> SignalEvent;
+
+ LegacyUnionEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
+ : interfaceName_(_interfaceName),
+ propertyName_(_propertyName),
+ isSubcriptionSet_(false),
+ internalEvent_(_proxy,
+ "PropertiesChanged",
+ "sa{sv}as",
+ _proxy.getDBusAddress().getObjectPath(),
+ "org.freedesktop.DBus.Properties",
+ std::make_tuple("", getDeployedMap(), InvalidArray())) {
+ }
+
+protected:
+ void onFirstListenerAdded(const Listener &) {
+ if (isSubcriptionSet_) {
+ subscription_ = internalEvent_.subscribe(
+ [this](const std::string &_interfaceName,
+ const PropertyMap &_properties,
+ const std::vector<std::string> &_invalid) {
+ if (interfaceName_ == _interfaceName) {
+ auto iter = _properties.find(propertyName_);
+ if (iter != _properties.end()) {
+ this->notifyListeners(iter->second.template get<ValueType>());
+ }
+ }
+ });
+ isSubcriptionSet_ = true;
+ }
+ }
+
+ void onLastListenerRemoved(const Listener &) {
+ if (isSubcriptionSet_) {
+ internalEvent_.unsubscribe(subscription_);
+ isSubcriptionSet_ = false;
+ }
+ }
+
+ DBusEvent<SignalEvent, ValueType> internalEvent_;
+ std::string interfaceName_;
+ std::string propertyName_;
+
+ typename DBusEvent<SignalEvent>::Subscription subscription_;
+ bool isSubcriptionSet_;
+
+private:
+ static DeployedPropertyMap &getDeployedMap() {
+ static PropertyMapDeployment itsDeployment(nullptr, &freedesktopVariant);
+ static DeployedPropertyMap itsDeployedMap(&itsDeployment);
+ return itsDeployedMap;
+ }
+};
+
+template <typename _AttributeType, typename _Variant>
+class DBusFreedesktopUnionObservableAttribute: public _AttributeType {
+ public:
+ typedef typename _AttributeType::ValueType ValueType;
+ typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename _AttributeType::ChangedEvent ChangedEvent;
+
+ template <typename... _AttributeTypeArguments>
+ DBusFreedesktopUnionObservableAttribute(DBusProxy &_proxy,
+ const std::string &_interfaceName,
+ const std::string &_propertyName,
+ _AttributeTypeArguments... _arguments)
+ : _AttributeType(_proxy, _interfaceName, _propertyName, _arguments...),
+ externalChangedEvent_(_proxy, _interfaceName, _propertyName) {
+ }
+
+ ChangedEvent &getChangedEvent() {
+ return externalChangedEvent_;
+ }
+
+ protected:
+ LegacyUnionEvent<ChangedEvent, _Variant> externalChangedEvent_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_FREEDESKTOPATTRIBUTE_HPP_
diff --git a/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
new file mode 100644
index 0000000..f7e2cdf
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
@@ -0,0 +1,59 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_FREEDESKTOPPROPERTIESSTUB_HPP_
+#define COMMONAPI_DBUS_DBUS_FREEDESKTOPPROPERTIESSTUB_HPP_
+
+#include <memory>
+#include <mutex>
+#include <string>
+
+#include <CommonAPI/DBus/DBusInterfaceHandler.hpp>
+
+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 &_path,
+ const std::string &_interface,
+ const std::shared_ptr<DBusProxyConnection> &_connection,
+ const std::shared_ptr<DBusStubAdapter> &_adapter);
+
+ virtual ~DBusFreedesktopPropertiesStub();
+
+ const std::string &getObjectPath() const;
+ static const std::string &getInterface();
+
+ virtual const char* getMethodsDBusIntrospectionXmlData() const;
+ virtual bool onInterfaceDBusMessage(const DBusMessage &_message);
+ virtual const bool hasFreedesktopProperties();
+
+private:
+ std::string path_;
+ std::weak_ptr<DBusProxyConnection> connection_;
+ std::shared_ptr<DBusStubAdapter> adapter_;
+
+ typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> DBusInterfacesMap;
+ DBusInterfacesMap managedInterfaces_;
+
+ std::mutex dbusInterfacesLock_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_FREEDESKTOPPROPERTIESSTUB_HPP_
diff --git a/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
new file mode 100644
index 0000000..5c0bffa
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
@@ -0,0 +1,194 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSFREEDESKTOPSTUBADAPTERHELPER_HPP_
+#define COMMONAPI_DBUS_DBUSFREEDESKTOPSTUBADAPTERHELPER_HPP_
+
+#include <CommonAPI/Struct.hpp>
+#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+template <typename _StubClass>
+class DBusGetFreedesktopAttributeStubDispatcherBase {
+public:
+ virtual ~DBusGetFreedesktopAttributeStubDispatcherBase() {}
+ virtual void dispatchDBusMessageAndAppendReply(const DBusMessage &_message,
+ const std::shared_ptr<_StubClass> &_stub,
+ DBusOutputStream &_output,
+ const std::shared_ptr<DBusClientId> &_clientId) = 0;
+};
+
+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 &_message,
+ const std::shared_ptr<_StubClass> &_stub,
+ DBusOutputStream &_output,
+ const std::shared_ptr<DBusClientId> &_clientId) {
+ CommonAPI::Deployable<CommonAPI::Variant<_AttributeType>, VariantDeployment<>> deployedVariant(
+ (_stub.get()->*(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::getStubFunctor_))(_clientId), &freedesktopVariant);
+
+ _output << deployedVariant;
+ }
+
+protected:
+ virtual bool sendAttributeValueReply(const DBusMessage &_message, const std::shared_ptr<_StubClass> &_stub, DBusStubAdapterHelperType &_helper) {
+ DBusMessage reply = _message.createMethodReturn(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::signature_);
+
+ std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(_message.getSender()));
+ CommonAPI::Deployable<CommonAPI::Variant<_AttributeType>, VariantDeployment<>> deployedVariant(
+ (_stub.get()->*(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::getStubFunctor_))(clientId), &freedesktopVariant);
+
+ DBusOutputStream output(reply);
+ output << deployedVariant;
+ output.flush();
+
+ return _helper.getDBusConnection()->sendDBusMessage(reply);
+ }
+};
+
+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 &_message, bool &_error) {
+ std::string interfaceName, attributeName;
+ DBusInputStream input(_message);
+ CommonAPI::Deployable<CommonAPI::Variant<_AttributeType>, VariantDeployment<>> deployedVariant(&freedesktopVariant);
+ input >> interfaceName; // skip over interface and attribute name
+ input >> attributeName;
+ input >> deployedVariant;
+ _error = input.hasError();
+ _AttributeType attributeValue = deployedVariant.getValue().template get<_AttributeType>() ;
+ return attributeValue;
+ }
+};
+
+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") {
+ }
+};
+
+template<class>
+struct DBusStubFreedesktopPropertiesSignalHelper;
+
+template<template<class ...> class _In, class _InArg>
+struct DBusStubFreedesktopPropertiesSignalHelper<_In<DBusInputStream, DBusOutputStream, _InArg>> {
+
+ template <typename _ValueType>
+ struct DBusPropertiesEntry
+ : public CommonAPI::Struct<std::string, CommonAPI::Variant<_ValueType>> {
+
+ DBusPropertiesEntry() = default;
+ DBusPropertiesEntry(const std::string &_propertyName,
+ const _ValueType &_propertyValue) {
+ std::get<0>(this->values_) = _propertyName;
+ std::get<1>(this->values_) = _propertyValue;
+ };
+
+ const std::string &getPropertyName() const { return std::get<0>(this->values_); }
+ void setPropertyName(const std::string &_value) { std::get<0>(this->values_) = _value; }
+
+ const _ValueType getPropertyValue() const { return std::get<1>(this->values_); }
+ void setPropertyValue(const _ValueType &_value) { std::get<1>(this->values_) = _value; }
+ };
+
+ typedef std::vector<DBusPropertiesEntry<_InArg>> PropertiesArray;
+ typedef CommonAPI::Deployment<CommonAPI::EmptyDeployment, VariantDeployment<>> PropertyDeployment;
+ typedef CommonAPI::ArrayDeployment<PropertyDeployment> PropertiesDeployment;
+ typedef CommonAPI::Deployable<PropertiesArray, PropertiesDeployment> DeployedPropertiesArray;
+
+ template <typename _StubClass>
+ static bool sendPropertiesChangedSignal(const _StubClass &_stub, const std::string &_propertyName, const _InArg &_inArg) {
+ const std::vector<std::string> invalidatedProperties;
+ PropertiesArray changedProperties;
+ DBusPropertiesEntry<_InArg> entry(_propertyName, _inArg);
+ changedProperties.push_back(entry);
+
+ PropertyDeployment propertyDeployment(nullptr, &freedesktopVariant);
+ PropertiesDeployment changedPropertiesDeployment(&propertyDeployment);
+
+ DeployedPropertiesArray deployedChangedProperties(changedProperties, &changedPropertiesDeployment);
+
+ return DBusStubSignalHelper<
+ _In<
+ DBusInputStream,
+ DBusOutputStream,
+ const std::string,
+ DeployedPropertiesArray,
+ std::vector<std::string>
+ >
+ >::sendSignal(
+ _stub.getDBusAddress().getObjectPath().c_str(),
+ "org.freedesktop.DBus.Properties",
+ "PropertiesChanged",
+ "sa{sv}as",
+ _stub.getDBusConnection(),
+ _stub.getInterface(),
+ deployedChangedProperties,
+ invalidatedProperties);
+ }
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSFREEDESKTOPSTUBADAPTERHELPER_HPP_
diff --git a/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp b/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp
new file mode 100644
index 0000000..31490d2
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp
@@ -0,0 +1,74 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <CommonAPI/DBus/DBusTypeOutputStream.hpp>
+
+#ifndef COMMONAPI_DBUS_FREEDESKTOPVARIANT_HPP_
+#define COMMONAPI_DBUS_FREEDESKTOPVARIANT_HPP_
+
+namespace CommonAPI {
+namespace DBus {
+
+template<class Visitor, class Variant, typename ... _Types>
+struct ApplyTypeCompareVisitor;
+
+template<class Visitor, class Variant>
+struct ApplyTypeCompareVisitor<Visitor, Variant> {
+ static const uint8_t index = 0;
+
+ static uint8_t visit(Visitor&, const Variant&) {
+ // won't be called if the variant contains the requested type
+ assert(false);
+ return 0;
+ }
+};
+
+template<class Visitor, class Variant, typename _Type, typename ... _Types>
+struct ApplyTypeCompareVisitor<Visitor, Variant, _Type, _Types...> {
+ static const uint8_t index
+ = ApplyTypeCompareVisitor<Visitor, Variant, _Types...>::index + 1;
+
+ static uint8_t visit(Visitor &_visitor, const Variant &_variant) {
+ DBusTypeOutputStream output;
+ _Type current;
+ output.writeType(current);
+#ifdef WIN32
+ if (_visitor.operator()<_Type>(output.getSignature())) {
+#else
+ if (_visitor.template operator()<_Type>(output.getSignature())) {
+#endif
+ return index;
+ } else {
+ return ApplyTypeCompareVisitor<
+ Visitor, Variant, _Types...
+ >::visit(_visitor, _variant);
+ }
+ }
+};
+
+template<typename ... _Types>
+struct TypeCompareVisitor {
+public:
+ TypeCompareVisitor(const std::string &_type)
+ : type_(_type) {
+ }
+
+ template<typename _Type>
+ bool operator()(const std::string &_type) const {
+ return (_type == type_);
+ }
+
+private:
+ const std::string type_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_FREEDESKTOPVARIANT_HPP_
diff --git a/include/CommonAPI/DBus/DBusFunctionalHash.hpp b/include/CommonAPI/DBus/DBusFunctionalHash.hpp
new file mode 100644
index 0000000..78848c7
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusFunctionalHash.hpp
@@ -0,0 +1,81 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_FUNCTIONAL_HASH_HPP_
+#define COMMONAPI_DBUS_DBUS_FUNCTIONAL_HASH_HPP_
+
+#include <functional>
+#include <string>
+#include <tuple>
+
+#include <CommonAPI/Export.hpp>
+
+namespace std {
+
+template<>
+struct COMMONAPI_EXPORT 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 COMMONAPI_EXPORT hash<const char*>
+ : public unary_function<const char*, size_t> {
+
+ size_t operator()(const char* const t) const;
+};
+
+template<>
+struct COMMONAPI_EXPORT hash<pair<string, string> >
+ : public unary_function<pair<string, string>, size_t> {
+
+ size_t operator()(const pair<string, string>& t) const;
+};
+
+template<>
+struct COMMONAPI_EXPORT hash<tuple<string, string, string> >
+ : public unary_function<tuple<string, string, string>, size_t> {
+
+ size_t operator()(const tuple<string, string, string>& t) const;
+};
+
+template<>
+struct COMMONAPI_EXPORT hash<tuple<string, string, string, bool> >
+ : public unary_function<tuple<string, string, string, bool>, size_t> {
+
+ size_t operator()(const tuple<string, string, string, bool>& t) const;
+};
+
+template<>
+struct COMMONAPI_EXPORT hash<tuple<string, string, string, int> >
+ : public unary_function<tuple<string, string, string, int>, size_t> {
+
+ size_t operator()(const tuple<string, string, string, int>& t) const;
+};
+
+template<>
+struct COMMONAPI_EXPORT hash<tuple<string, string, string, string> >
+ : public std::unary_function<tuple<string, string, string, string>, size_t> {
+
+ size_t operator()(const tuple<string, string, string, string>& t) const;
+};
+
+template<>
+struct COMMONAPI_EXPORT equal_to<pair<const char*, const char*> >
+ : public binary_function<pair<const char*, const char*>,
+ 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_HPP_
diff --git a/include/CommonAPI/DBus/DBusHelper.hpp b/include/CommonAPI/DBus/DBusHelper.hpp
new file mode 100644
index 0000000..53a5625
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusHelper.hpp
@@ -0,0 +1,55 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_HELPER_HPP_
+#define COMMONAPI_DBUS_DBUS_HELPER_HPP_
+
+#include <unordered_map>
+#include <vector>
+
+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;
+};
+
+template<typename _Type>
+struct is_std_vector { static const bool value = false; };
+
+template<typename _Type>
+struct is_std_vector<std::vector<_Type> > { static const bool value = true; };
+
+template<typename _Type>
+struct is_std_unordered_map { static const bool value = false; };
+
+template<typename _Key, typename _Value, typename _Hash>
+struct is_std_unordered_map<std::unordered_map<_Key, _Value, _Hash>> { static const bool value = true; };
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_HELPER_HPP_
diff --git a/include/CommonAPI/DBus/DBusInputStream.hpp b/include/CommonAPI/DBus/DBusInputStream.hpp
new file mode 100644
index 0000000..389cb68
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusInputStream.hpp
@@ -0,0 +1,426 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSINPUTSTREAM_HPP_
+#define COMMONAPI_DBUS_DBUSINPUTSTREAM_HPP_
+
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+
+#include <cassert>
+#include <cstdint>
+#include <stack>
+#include <string>
+#include <vector>
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/InputStream.hpp>
+#include <CommonAPI/Struct.hpp>
+#include <CommonAPI/DBus/DBusDeployment.hpp>
+#include <CommonAPI/DBus/DBusError.hpp>
+#include <CommonAPI/DBus/DBusFreedesktopVariant.hpp>
+#include <CommonAPI/DBus/DBusHelper.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+
+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<DBusInputStream> {
+public:
+ COMMONAPI_EXPORT bool hasError() const {
+ return isErrorSet();
+ }
+
+ COMMONAPI_EXPORT InputStream &readValue(bool &_value, const EmptyDeployment *_depl);
+
+ COMMONAPI_EXPORT InputStream &readValue(int8_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(int16_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(int32_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(int64_t &_value, const EmptyDeployment *_depl);
+
+ COMMONAPI_EXPORT InputStream &readValue(uint8_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(uint16_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(uint32_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(uint64_t &_value, const EmptyDeployment *_depl);
+
+ COMMONAPI_EXPORT InputStream &readValue(float &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(double &_value, const EmptyDeployment *_depl);
+
+ COMMONAPI_EXPORT InputStream &readValue(std::string &_value, const EmptyDeployment *_depl);
+
+ COMMONAPI_EXPORT InputStream &readValue(Version &_value, const EmptyDeployment *_depl);
+
+ template<class _Deployment, typename _Base>
+ COMMONAPI_EXPORT InputStream &readValue(Enumeration<_Base> &_value, const _Deployment *_depl) {
+ _Base tmpValue;
+ readValue(tmpValue, _depl);
+ _value = tmpValue;
+ return (*this);
+ }
+
+ template<class _Deployment, typename... _Types>
+ COMMONAPI_EXPORT InputStream &readValue(Struct<_Types...> &_value, const _Deployment *_depl) {
+ align(8);
+ const auto itsSize(std::tuple_size<std::tuple<_Types...>>::value);
+ StructReader<itsSize-1, DBusInputStream, Struct<_Types...>, _Deployment>{}(
+ (*this), _value, _depl);
+ return (*this);
+ }
+
+ template<class _Deployment, class _PolymorphicStruct>
+ COMMONAPI_EXPORT InputStream &readValue(std::shared_ptr<_PolymorphicStruct> &_value,
+ const _Deployment *_depl) {
+ uint32_t serial;
+ align(8);
+ _readValue(serial);
+ skipSignature();
+ align(8);
+ if (!hasError()) {
+ _value = _PolymorphicStruct::create(serial);
+ _value->template readValue<>(*this, _depl);
+ }
+
+ return (*this);
+ }
+
+ template<typename... _Types>
+ COMMONAPI_EXPORT InputStream &readValue(Variant<_Types...> &_value, const CommonAPI::EmptyDeployment *_depl = nullptr) {
+ if(_value.hasValue()) {
+ DeleteVisitor<_value.maxSize> visitor(_value.valueStorage_);
+ ApplyVoidVisitor<DeleteVisitor<_value.maxSize>,
+ Variant<_Types...>, _Types... >::visit(visitor, _value);
+ }
+
+ align(8);
+ readValue(_value.valueType_, static_cast<EmptyDeployment *>(nullptr));
+ skipSignature();
+
+ InputStreamReadVisitor<DBusInputStream, _Types...> visitor((*this), _value);
+ ApplyVoidVisitor<InputStreamReadVisitor<DBusInputStream, _Types... >,
+ Variant<_Types...>, _Types...>::visit(visitor, _value);
+
+ return (*this);
+ }
+
+ template<typename _Deployment, typename... _Types>
+ COMMONAPI_EXPORT InputStream &readValue(Variant<_Types...> &_value, const _Deployment *_depl) {
+ if(_value.hasValue()) {
+ DeleteVisitor<_value.maxSize> visitor(_value.valueStorage_);
+ ApplyVoidVisitor<DeleteVisitor<_value.maxSize>,
+ Variant<_Types...>, _Types... >::visit(visitor, _value);
+ }
+
+ if (_depl != nullptr && _depl->isFreeDesktop_) {
+ // Read signature
+ uint8_t signatureLength;
+ readValue(signatureLength, static_cast<EmptyDeployment *>(nullptr));
+ std::string signature(_readRaw(signatureLength+1), signatureLength);
+
+ // Determine index (value type) from signature
+ TypeCompareVisitor<_Types...> visitor(signature);
+ _value.valueType_ = ApplyTypeCompareVisitor<
+ TypeCompareVisitor<_Types...>,
+ Variant<_Types...>,
+ _Types...
+ >::visit(visitor, _value);
+ } else {
+ align(8);
+ readValue(_value.valueType_, static_cast<EmptyDeployment *>(nullptr));
+ skipSignature();
+ }
+
+
+ InputStreamReadVisitor<DBusInputStream, _Types...> visitor((*this), _value);
+ ApplyVoidVisitor<InputStreamReadVisitor<DBusInputStream, _Types... >,
+ Variant<_Types...>, _Types...>::visit(visitor, _value);
+
+ return (*this);
+ }
+
+ template<typename _ElementType>
+ COMMONAPI_EXPORT InputStream &readValue(std::vector<_ElementType> &_value, const EmptyDeployment *_depl) {
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
+
+ alignVector<_ElementType>();
+
+ pushPosition();
+
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ _ElementType itsElement;
+ readValue(itsElement, static_cast<EmptyDeployment *>(nullptr));
+
+ if (hasError()) {
+ break;
+ }
+
+ _value.push_back(std::move(itsElement));
+ }
+
+ popSize();
+ popPosition();
+
+ return (*this);
+ }
+
+ template<class _Deployment, typename _ElementType>
+ COMMONAPI_EXPORT InputStream &readValue(std::vector<_ElementType> &_value, const _Deployment *_depl) {
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
+
+ alignVector<_ElementType>();
+
+ pushPosition();
+
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ _ElementType itsElement;
+ readValue(itsElement, _depl->elementDepl_);
+
+ if (hasError()) {
+ break;
+ }
+
+ _value.push_back(std::move(itsElement));
+ }
+
+ popSize();
+ popPosition();
+
+ return (*this);
+ }
+
+ template<typename _KeyType, typename _ValueType, typename _HasherType>
+ COMMONAPI_EXPORT InputStream &readValue(std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
+ const EmptyDeployment *_depl) {
+
+ typedef typename std::unordered_map<_KeyType, _ValueType, _HasherType>::value_type MapElement;
+
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
+
+ align(8);
+ pushPosition();
+
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ _KeyType itsKey;
+ _ValueType itsValue;
+
+ align(8);
+ readValue(itsKey, _depl);
+ readValue(itsValue, _depl);
+
+ if (hasError()) {
+ break;
+ }
+
+ _value.insert(MapElement(std::move(itsKey), std::move(itsValue)));
+ }
+
+ (void)popSize();
+ (void)popPosition();
+
+ return (*this);
+ }
+
+ template<class _Deployment, typename _KeyType, typename _ValueType, typename _HasherType>
+ COMMONAPI_EXPORT InputStream &readValue(std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
+ const _Deployment *_depl) {
+
+ typedef typename std::unordered_map<_KeyType, _ValueType, _HasherType>::value_type MapElement;
+
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
+
+ align(8);
+ pushPosition();
+
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ _KeyType itsKey;
+ _ValueType itsValue;
+
+ align(8);
+ readValue(itsKey, _depl->key_);
+ readValue(itsValue, _depl->value_);
+
+ if (hasError()) {
+ break;
+ }
+
+ _value.insert(MapElement(std::move(itsKey), std::move(itsValue)));
+ }
+
+ (void)popSize();
+ (void)popPosition();
+
+ return (*this);
+ }
+
+ /**
+ * 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.
+ */
+ COMMONAPI_EXPORT DBusInputStream(const CommonAPI::DBus::DBusMessage &_message);
+ COMMONAPI_EXPORT DBusInputStream(const DBusInputStream &_stream) = delete;
+
+ /**
+ * Destructor; does not call the destructor of the referred #DBusMessage. Make sure to maintain a reference to the
+ * #DBusMessage outside of the stream if you intend to make further use of the message.
+ */
+ COMMONAPI_EXPORT ~DBusInputStream();
+
+ // Marks the stream as erroneous.
+ COMMONAPI_EXPORT void setError();
+
+ /**
+ * @return An instance of #DBusError if this stream is in an erroneous state, NULL otherwise
+ */
+ COMMONAPI_EXPORT const DBusError &getError() const;
+
+ /**
+ * @return true if this stream is in an erroneous state, false otherwise.
+ */
+ COMMONAPI_EXPORT bool isErrorSet() const;
+
+ // Marks the state of the stream as cleared from all errors. Further reading is possible afterwards.
+ // The stream will have maintained the last valid position from before its state became erroneous.
+ COMMONAPI_EXPORT void clearError();
+
+ /**
+ * 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 _boundary the byte boundary to which the stream needs to be aligned.
+ */
+ COMMONAPI_EXPORT void align(const size_t _boundary);
+
+ /**
+ * 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
+ */
+ COMMONAPI_EXPORT char *_readRaw(const size_t _size);
+
+ /**
+ * 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 _Type The type of the value that is to be read from the given stream.
+ * @param _value The variable in which the retrieved value is to be stored
+ * @return The given inputMessageStream to allow for successive reading
+ */
+ template<typename _Type>
+ COMMONAPI_EXPORT DBusInputStream &_readValue(_Type &_value) {
+ if (sizeof(_value) > 1)
+ align(sizeof(_Type));
+
+ _value = *(reinterpret_cast<_Type *>(_readRaw(sizeof(_Type))));
+
+ return (*this);
+ }
+
+ COMMONAPI_EXPORT DBusInputStream &_readValue(float &_value) {
+ align(sizeof(double));
+
+ _value = (float) (*(reinterpret_cast<double*>(_readRaw(sizeof(double)))));
+ return (*this);
+ }
+
+private:
+ COMMONAPI_EXPORT void pushPosition();
+ COMMONAPI_EXPORT size_t popPosition();
+
+ COMMONAPI_EXPORT void pushSize(size_t _size);
+ COMMONAPI_EXPORT size_t popSize();
+
+ inline void skipSignature() {
+ uint8_t length;
+ _readValue(length);
+ _readRaw(length + 1);
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_class<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
+ if (4 < sizeof(_Type)) align(8);
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_same<_Type, std::string>::value>::type * = nullptr,
+ typename std::enable_if<std::is_class<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
+ align(8);
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_same<_Type, std::string>::value>::type * = nullptr) {
+ // Intentionally do nothing
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_vector<_Type>::value>::type * = nullptr) {
+ // Intentionally do nothing
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_unordered_map<_Type>::value>::type * = nullptr) {
+ align(4);
+ }
+
+ char *begin_;
+ size_t current_;
+ size_t size_;
+ CommonAPI::DBus::DBusError* exception_;
+ CommonAPI::DBus::DBusMessage message_;
+
+ std::stack<uint32_t> sizes_;
+ std::stack<size_t> positions_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_INPUTSTREAM_HPP_
diff --git a/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
new file mode 100644
index 0000000..d520034
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
@@ -0,0 +1,135 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSINSTANCEAVAILABILITYSTATUSCHANGED_EVENT_HPP_
+#define COMMONAPI_DBUS_DBUSINSTANCEAVAILABILITYSTATUSCHANGED_EVENT_HPP_
+
+#include <functional>
+#include <future>
+#include <string>
+#include <vector>
+
+#include <CommonAPI/ProxyManager.hpp>
+#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
+#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
+#include <CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp>
+#include <CommonAPI/DBus/DBusTypes.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+// TODO Check to move logic to DBusServiceRegistry, now every proxy will deserialize the messages!
+class DBusInstanceAvailabilityStatusChangedEvent:
+ public ProxyManager::InstanceAvailabilityStatusChangedEvent,
+ public DBusProxyConnection::DBusSignalHandler {
+ public:
+ DBusInstanceAvailabilityStatusChangedEvent(DBusProxy &_proxy, const std::string &_interfaceName) :
+ proxy_(_proxy),
+ observedInterfaceName_(_interfaceName) {
+ }
+
+ virtual ~DBusInstanceAvailabilityStatusChangedEvent() {
+ proxy_.removeSignalMemberHandler(interfacesAddedSubscription_);
+ proxy_.removeSignalMemberHandler(interfacesRemovedSubscription_);
+ }
+
+ virtual void onSignalDBusMessage(const DBusMessage& dbusMessage) {
+ if (dbusMessage.hasMemberName("InterfacesAdded")) {
+ onInterfacesAddedSignal(dbusMessage);
+ } else if (dbusMessage.hasMemberName("InterfacesRemoved")) {
+ onInterfacesRemovedSignal(dbusMessage);
+ }
+ }
+
+ protected:
+ virtual void onFirstListenerAdded(const Listener&) {
+ interfacesAddedSubscription_ = proxy_.addSignalMemberHandler(
+ proxy_.getDBusAddress().getObjectPath(),
+ DBusObjectManagerStub::getInterfaceName(),
+ "InterfacesAdded",
+ "oa{sa{sv}}",
+ this);
+
+ interfacesRemovedSubscription_ = proxy_.addSignalMemberHandler(
+ proxy_.getDBusAddress().getObjectPath(),
+ DBusObjectManagerStub::getInterfaceName(),
+ "InterfacesRemoved",
+ "oas",
+ this);
+ }
+
+ virtual void onLastListenerRemoved(const Listener&) {
+ proxy_.removeSignalMemberHandler(interfacesAddedSubscription_);
+ proxy_.removeSignalMemberHandler(interfacesRemovedSubscription_);
+ }
+
+ private:
+ inline void onInterfacesAddedSignal(const DBusMessage &_message) {
+ DBusInputStream dbusInputStream(_message);
+ std::string dbusObjectPath;
+ 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 &_message) {
+ DBusInputStream dbusInputStream(_message);
+ 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 &_objectPath,
+ const std::string &_interfaceName,
+ const AvailabilityStatus &_availability) {
+ CommonAPI::Address itsAddress;
+ DBusAddress itsDBusAddress(proxy_.getDBusAddress().getService(),
+ _objectPath,
+ _interfaceName);
+
+ DBusAddressTranslator::get()->translate(itsDBusAddress, itsAddress);
+
+ notifyListeners(itsAddress.getAddress(), _availability);
+ }
+
+
+ DBusProxy &proxy_;
+ std::string observedInterfaceName_;
+ DBusProxyConnection::DBusSignalHandlerToken interfacesAddedSubscription_;
+ DBusProxyConnection::DBusSignalHandlerToken interfacesRemovedSubscription_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSINSTANCEAVAILABILITYSTATUSCHANGEDEVENT_HPP_
diff --git a/include/CommonAPI/DBus/DBusInterfaceHandler.hpp b/include/CommonAPI/DBus/DBusInterfaceHandler.hpp
new file mode 100644
index 0000000..c570975
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusInterfaceHandler.hpp
@@ -0,0 +1,31 @@
+// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef COMMONAPI_DBUS_DBUSINTERFACEHANDLER_HPP_
+#define COMMONAPI_DBUS_DBUSINTERFACEHANDLER_HPP_
+
+#include <memory>
+
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+
+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_DBUSINTERFACEHANDLER_HPP_
diff --git a/src/CommonAPI/DBus/DBusMainLoopContext.h b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
index 439d530..9230cd2 100644
--- a/src/CommonAPI/DBus/DBusMainLoopContext.h
+++ b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
@@ -1,32 +1,27 @@
-/* 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/.
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
#endif
-#ifndef DBUS_MAINLOOPCONTEXT_H_
-#define DBUS_MAINLOOPCONTEXT_H_
+#ifndef COMMONAPI_DBUS_DBUSMAINLOOPCONTEXT_HPP_
+#define COMMONAPI_DBUS_DBUSMAINLOOPCONTEXT_HPP_
#include <list>
#include <memory>
-#include <CommonAPI/MainLoopContext.h>
#include <dbus/dbus.h>
-
+#include <CommonAPI/MainLoopContext.hpp>
namespace CommonAPI {
namespace DBus {
class DBusConnection;
-
-
class DBusDispatchSource: public DispatchSource {
public:
DBusDispatchSource(DBusConnection* dbusConnection);
@@ -89,4 +84,4 @@ class DBusTimeout: public Timeout {
} // namespace DBus
} // namespace CommonAPI
-#endif
+#endif // COMMONAPI_DBUS_DBUSMAINLOOPCONTEXT_HPP_
diff --git a/include/CommonAPI/DBus/DBusMessage.hpp b/include/CommonAPI/DBus/DBusMessage.hpp
new file mode 100644
index 0000000..dc5d72e
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusMessage.hpp
@@ -0,0 +1,101 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSMESSAGE_HPP_
+#define COMMONAPI_DBUS_DBUSMESSAGE_HPP_
+
+#include <string>
+
+#include <dbus/dbus.h>
+
+#include <CommonAPI/Export.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusAddress;
+class DBusConnection;
+
+class COMMONAPI_EXPORT DBusMessage {
+public:
+ 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
+ };
+
+ DBusMessage();
+ DBusMessage(::DBusMessage* libdbusMessage);
+ DBusMessage(::DBusMessage* libdbusMessage, bool _reference);
+ DBusMessage(const DBusMessage &_source);
+ DBusMessage(DBusMessage &&_source);
+
+ ~DBusMessage();
+
+ DBusMessage &operator=(const DBusMessage &_source);
+ DBusMessage &operator=(DBusMessage &&_source);
+ operator bool() const;
+
+ static DBusMessage createOrgFreedesktopOrgMethodCall(const std::string &_method,
+ const std::string &_signature = "");
+
+ static DBusMessage createMethodCall(const DBusAddress &_address,
+ const std::string &_method, const std::string &_signature = "");
+
+ DBusMessage createMethodReturn(const std::string &_signature) const;
+
+ DBusMessage createMethodError(const std::string &_name, const std::string &_reason = "") const;
+
+ static DBusMessage createSignal(const std::string& objectPath,
+ const std::string& interfaceName,
+ const std::string& signalName,
+ const std::string& signature = "");
+
+ const char* getSender() const;
+ const char* getObjectPath() const;
+ const char* getInterface() const;
+ const char* getMember() const;
+ const char* getSignature() const;
+ const char* getError() const;
+ const char* getDestination() const;
+ const uint32_t getSerial() 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;
+
+ 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 *message_;
+
+ friend class DBusConnection;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSMESSAGE_HPP_
diff --git a/src/CommonAPI/DBus/DBusMultiEvent.h b/include/CommonAPI/DBus/DBusMultiEvent.hpp
index a98dd80..8215d4f 100644
--- a/src/CommonAPI/DBus/DBusMultiEvent.h
+++ b/include/CommonAPI/DBus/DBusMultiEvent.hpp
@@ -1,22 +1,19 @@
-/* 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/.
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#error "Only <CommonAPI/CommonAPI.hpp> 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>
+#ifndef COMMONAPI_DBUS_DBUSMULTIEVENT_HPP_
+#define COMMONAPI_DBUS_DBUSMULTIEVENT_HPP_
#include <string>
#include <unordered_map>
+#include <CommonAPI/Event.hpp>
namespace CommonAPI {
namespace DBus {
@@ -28,13 +25,13 @@ class DBusMultiEvent {
typedef std::unordered_multimap<std::string, Listener> ListenersMap;
typedef typename ListenersMap::iterator Subscription;
+ virtual ~DBusMultiEvent() {}
+
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);
@@ -118,4 +115,4 @@ SubscriptionStatus DBusMultiEvent<_Arguments...>::notifyListenersRange(
} // namespace DBus
} // namespace CommonAPI
-#endif // COMMONAPI_DBUS_DBUS_MULTI_EVENT_H_
+#endif // COMMONAPI_DBUS_DBUSMULTIEVENT_HPP_
diff --git a/include/CommonAPI/DBus/DBusObjectManager.hpp b/include/CommonAPI/DBus/DBusObjectManager.hpp
new file mode 100644
index 0000000..8c7225b
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusObjectManager.hpp
@@ -0,0 +1,69 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSOBJECTMANAGER_HPP_
+#define COMMONAPI_DBUS_DBUSOBJECTMANAGER_HPP_
+
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusStubAdapter;
+class DBusInterfaceHandler;
+
+class DBusObjectManager {
+ public:
+ COMMONAPI_EXPORT DBusObjectManager(const std::shared_ptr<DBusProxyConnection>&);
+ COMMONAPI_EXPORT ~DBusObjectManager();
+
+ COMMONAPI_EXPORT bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+
+ //Zusammenfassbar mit "registerDBusStubAdapter"?
+ COMMONAPI_EXPORT bool exportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unexportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+
+ COMMONAPI_EXPORT bool handleMessage(const DBusMessage&);
+
+ COMMONAPI_EXPORT std::shared_ptr<DBusObjectManagerStub> getRootDBusObjectManagerStub();
+
+ private:
+ // objectPath, interfaceName
+ typedef std::pair<std::string, std::string> DBusInterfaceHandlerPath;
+
+ COMMONAPI_EXPORT bool addDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
+ std::shared_ptr<DBusInterfaceHandler> dbusInterfaceHandler);
+
+ COMMONAPI_EXPORT bool removeDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
+ std::shared_ptr<DBusInterfaceHandler> dbusInterfaceHandler);
+
+ COMMONAPI_EXPORT bool onIntrospectableInterfaceDBusMessage(const DBusMessage& callMessage);
+ COMMONAPI_EXPORT bool onFreedesktopPropertiesDBusMessage(const DBusMessage& callMessage);
+
+
+ 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_DBUSOBJECTMANAGER_HPP_
diff --git a/src/CommonAPI/DBus/DBusObjectManagerStub.h b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
index 7de54f2..a16578b 100644
--- a/src/CommonAPI/DBus/DBusObjectManagerStub.h
+++ b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
@@ -1,19 +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/. */
-#ifndef COMMONAPI_DBUS_DBUS_FREEDESKTOP_OBJECT_MANAGER_STUB_H_
-#define COMMONAPI_DBUS_DBUS_FREEDESKTOP_OBJECT_MANAGER_STUB_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 "DBusInterfaceHandler.h"
+#ifndef COMMONAPI_DBUS_DBUSFREEDESKTOPOBJECTMANAGERSTUB_HPP_
+#define COMMONAPI_DBUS_DBUSFREEDESKTOPOBJECTMANAGERSTUB_HPP_
#include <memory>
#include <mutex>
#include <string>
+#include <CommonAPI/DBus/DBusInterfaceHandler.hpp>
+
namespace CommonAPI {
namespace DBus {
@@ -41,20 +39,20 @@ class DBusStubAdapter;
* - 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;
+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>&);
+public:
+ COMMONAPI_EXPORT DBusObjectManagerStub(const std::string& dbusObjectPath, const std::shared_ptr<DBusProxyConnection>&);
/**
* Unregisters all currently registered DBusStubAdapter instances from the DBusServicePublisher
*/
- virtual ~DBusObjectManagerStub();
+ COMMONAPI_EXPORT virtual ~DBusObjectManagerStub();
/**
* Export DBusStubAdapter instance with the current DBusObjectManagerStub instance.
@@ -74,7 +72,7 @@ class DBusObjectManagerStub: public DBusInterfaceHandler {
* @see CommonAPI::ServicePublisher
* @see DBusObjectManager
*/
- bool exportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool exportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
/**
* Unexport DBusStubAdapter instance from this DBusObjectManagerStub instance.
@@ -90,25 +88,25 @@ class DBusObjectManagerStub: public DBusInterfaceHandler {
*
* @see exportDBusStubAdapter()
*/
- bool unexportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unexportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- bool isDBusStubAdapterExported(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool isDBusStubAdapterExported(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- const std::string& getDBusObjectPath() const;
- static const char* getInterfaceName();
+ COMMONAPI_EXPORT const std::string& getDBusObjectPath() const;
+ COMMONAPI_EXPORT static const char* getInterfaceName();
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
- virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage);
- virtual const bool hasFreedesktopProperties();
+ COMMONAPI_EXPORT virtual const char* getMethodsDBusIntrospectionXmlData() const;
+ COMMONAPI_EXPORT virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage);
+ COMMONAPI_EXPORT virtual const bool hasFreedesktopProperties();
private:
- bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- bool emitInterfacesAddedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
+ COMMONAPI_EXPORT bool emitInterfacesAddedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
const std::shared_ptr<DBusProxyConnection>& dbusConnection) const;
- bool emitInterfacesRemovedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
+ COMMONAPI_EXPORT bool emitInterfacesRemovedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
const std::shared_ptr<DBusProxyConnection>& dbusConnection) const;
std::string dbusObjectPath_;
@@ -124,4 +122,4 @@ class DBusObjectManagerStub: public DBusInterfaceHandler {
} // namespace DBus
} // namespace CommonAPI
-#endif // COMMONAPI_DBUS_DBUS_FREEDESKTOP_OBJECT_MANAGER_STUB_H_
+#endif // COMMONAPI_DBUS_DBUSFREEDESKTOPOBJECTMANAGERSTUB_HPP_
diff --git a/include/CommonAPI/DBus/DBusOutputStream.hpp b/include/CommonAPI/DBus/DBusOutputStream.hpp
new file mode 100644
index 0000000..1148f3e
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusOutputStream.hpp
@@ -0,0 +1,398 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSOUTPUTSTREAM_HPP_
+#define COMMONAPI_DBUS_DBUSOUTPUTSTREAM_HPP_
+
+#include <cassert>
+#include <cstring>
+#include <memory>
+#include <stack>
+#include <string>
+#include <vector>
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/Logger.hpp>
+#include <CommonAPI/OutputStream.hpp>
+#include <CommonAPI/DBus/DBusDeployment.hpp>
+#include <CommonAPI/DBus/DBusError.hpp>
+#include <CommonAPI/DBus/DBusHelper.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusTypeOutputStream.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+/**
+ * @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<DBusOutputStream> {
+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.
+ */
+ COMMONAPI_EXPORT DBusOutputStream(DBusMessage dbusMessage);
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const bool &_value, const EmptyDeployment *_depl) {
+ uint32_t tmp = (_value ? 1 : 0);
+ return _writeValue(tmp);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const int8_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const int16_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const int32_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const int64_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint8_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint16_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint32_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint64_t &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const float &_value, const EmptyDeployment *_depl) {
+ return _writeValue(static_cast<double>(_value));
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const double &_value, const EmptyDeployment *_depl) {
+ return _writeValue(_value);
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::string &_value, const EmptyDeployment * = nullptr) {
+ return writeString(_value.c_str(), _value.length());
+ }
+
+ COMMONAPI_EXPORT OutputStream &writeValue(const Version &_value, const EmptyDeployment *_depl = nullptr) {
+ align(8);
+ writeValue(_value.Major, _depl);
+ writeValue(_value.Minor, _depl);
+ return (*this);
+ }
+
+ template<class _Deployment, typename _Base>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Enumeration<_Base> &_value, const _Deployment *_depl = nullptr) {
+ return writeValue(static_cast<_Base>(_value), _depl);
+ }
+
+ template<class _Deployment, typename... _Types>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Struct<_Types...> &_value, const _Deployment *_depl = nullptr) {
+ align(8);
+
+ const auto itsSize(std::tuple_size<std::tuple<_Types...>>::value);
+ StructWriter<itsSize-1, DBusOutputStream, Struct<_Types...>, _Deployment>{}((*this), _value, _depl);
+
+ return (*this);
+ }
+
+ template<class _Deployment, class _PolymorphicStruct>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::shared_ptr<_PolymorphicStruct> &_value, const _Deployment *_depl = nullptr) {
+ align(8);
+ _writeValue(_value->getSerial());
+
+ DBusTypeOutputStream typeOutput;
+ typeOutput.writeType(_value);
+ writeSignature(typeOutput.getSignature());
+
+ align(8);
+ _value->template writeValue<>((*this), _depl);
+
+ return (*this);
+ }
+
+ template<typename... _Types>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Variant<_Types...> &_value, const CommonAPI::EmptyDeployment *_depl = nullptr) {
+ align(8);
+ writeValue(_value.getValueType(), static_cast<EmptyDeployment *>(nullptr));
+
+ DBusTypeOutputStream typeOutput;
+ TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(typeOutput);
+ ApplyVoidVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
+ Variant<_Types...>, _Types...>::visit(typeVisitor, _value);
+ writeSignature(typeOutput.getSignature());
+
+ OutputStreamWriteVisitor<DBusOutputStream> valueVisitor(*this);
+ ApplyVoidVisitor<OutputStreamWriteVisitor<DBusOutputStream>,
+ Variant<_Types...>, _Types...>::visit(valueVisitor, _value);
+
+ return (*this);
+ }
+
+ template<typename _Deployment, typename... _Types>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Variant<_Types...> &_value, const _Deployment *_depl = nullptr) {
+ if (_depl != nullptr && _depl->isFreeDesktop_) {
+ align(1);
+ } else {
+ align(8);
+ writeValue(_value.getValueType(), static_cast<EmptyDeployment *>(nullptr));
+ }
+
+ DBusTypeOutputStream typeOutput;
+ TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(typeOutput);
+ ApplyVoidVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
+ Variant<_Types...>, _Types...>::visit(typeVisitor, _value);
+ writeSignature(typeOutput.getSignature());
+
+ OutputStreamWriteVisitor<DBusOutputStream> valueVisitor(*this);
+ ApplyVoidVisitor<OutputStreamWriteVisitor<DBusOutputStream>,
+ Variant<_Types...>, _Types...>::visit(valueVisitor, _value);
+
+ return (*this);
+ }
+
+ template<typename _ElementType>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<_ElementType> &_value,
+ const EmptyDeployment *_depl) {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
+
+ alignVector<_ElementType>();
+ pushPosition(); // Start of vector data
+
+ for (auto i : _value) {
+ writeValue(i, _depl);
+ if (hasError()) {
+ break;
+ }
+ }
+
+ // Write number of written bytes to placeholder position
+ uint32_t length = getPosition() - popPosition();
+ _writeValueAt(popPosition(), length);
+
+ return (*this);
+ }
+
+ template<class _Deployment, typename _ElementType>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<_ElementType> &_value,
+ const _Deployment *_depl) {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
+
+ alignVector<_ElementType>();
+ pushPosition(); // Start of vector data
+
+ for (auto i : _value) {
+ writeValue(i, _depl->elementDepl_);
+ if (hasError()) {
+ break;
+ }
+ }
+
+ // Write number of written bytes to placeholder position
+ uint32_t length = getPosition() - popPosition();
+ _writeValueAt(popPosition(), length);
+
+ return (*this);
+ }
+
+ template<typename _KeyType, typename _ValueType, typename _HasherType>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
+ const EmptyDeployment *_depl) {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
+
+ align(8);
+ pushPosition(); // Start of map data
+
+ for (auto v : _value) {
+ align(8);
+ writeValue(v.first, static_cast<EmptyDeployment *>(nullptr));
+ writeValue(v.second, static_cast<EmptyDeployment *>(nullptr));
+
+ if (hasError()) {
+ return (*this);
+ }
+ }
+
+ // Write number of written bytes to placeholder position
+ uint32_t length = getPosition() - popPosition();
+ _writeValueAt(popPosition(), length);
+ return (*this);
+ }
+
+ template<class _Deployment, typename _KeyType, typename _ValueType, typename _HasherType>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
+ const _Deployment *_depl) {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
+
+ align(8);
+ pushPosition(); // Start of map data
+
+ for (auto v : _value) {
+ align(8);
+ writeValue(v.first, _depl->key_);
+ writeValue(v.second, _depl->value_);
+
+ if (hasError()) {
+ return (*this);
+ }
+ }
+
+ // Write number of written bytes to placeholder position
+ uint32_t length = getPosition() - popPosition();
+ _writeValueAt(popPosition(), length);
+ return (*this);
+ }
+
+ /**
+ * 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().
+ */
+ COMMONAPI_EXPORT void flush();
+
+ COMMONAPI_EXPORT bool hasError() const;
+
+private:
+ COMMONAPI_EXPORT size_t getPosition();
+ COMMONAPI_EXPORT void pushPosition();
+ COMMONAPI_EXPORT size_t popPosition();
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_class<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
+ if (4 < sizeof(_Type)) align(8);
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_same<_Type, std::string>::value>::type * = nullptr,
+ typename std::enable_if<std::is_class<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
+ align(8);
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_same<_Type, std::string>::value>::type * = nullptr) {
+ // Intentionally do nothing
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_vector<_Type>::value>::type * = nullptr) {
+ // Intentionally do nothing
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_unordered_map<_Type>::value>::type * = nullptr) {
+ align(4);
+ }
+
+ COMMONAPI_EXPORT 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.
+ */
+ COMMONAPI_EXPORT void reserveMemory(size_t numOfBytes);
+
+ template<typename _Type>
+ COMMONAPI_EXPORT DBusOutputStream &_writeValue(const _Type &_value) {
+ if (sizeof(_Type) > 1)
+ align(sizeof(_Type));
+
+ _writeRaw(reinterpret_cast<const char*>(&_value), sizeof(_Type));
+ return (*this);
+ }
+
+ template<typename _Type>
+ COMMONAPI_EXPORT void _writeValueAt(size_t _position, const _Type &_value) {
+ assert(_position + sizeof(_Type) <= payload_.size());
+ _writeRawAt(reinterpret_cast<const char *>(&_value),
+ sizeof(_Type), _position);
+ }
+
+ COMMONAPI_EXPORT DBusOutputStream &writeString(const char *_data, 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.
+ */
+ COMMONAPI_EXPORT void align(const size_t _boundary);
+
+ /**
+ * 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 _data The array of chars that should serve as input
+ * @param _size The number of bytes that should be written
+ * @return true if writing was successful, false otherwise.
+ *
+ * @see DBusOutputMessageStream()
+ * @see flush()
+ */
+ COMMONAPI_EXPORT void _writeRaw(const char *_data, const size_t _size);
+ COMMONAPI_EXPORT void _writeRawAt(const char *_data, const size_t _size, size_t _position);
+
+protected:
+ std::string payload_;
+
+private:
+ COMMONAPI_EXPORT void writeSignature(const std::string& signature);
+
+ COMMONAPI_EXPORT size_t getCurrentStreamPosition();
+
+ DBusError dbusError_;
+ DBusMessage dbusMessage_;
+
+ std::stack<size_t> positions_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSOUTPUTSTREAM_PPH_
diff --git a/include/CommonAPI/DBus/DBusProxy.hpp b/include/CommonAPI/DBus/DBusProxy.hpp
new file mode 100644
index 0000000..af40863
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusProxy.hpp
@@ -0,0 +1,84 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSPROXY_HPP_
+#define COMMONAPI_DBUS_DBUSPROXY_HPP_
+
+#include <functional>
+#include <memory>
+#include <string>
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/DBus/DBusAttribute.hpp>
+#include <CommonAPI/DBus/DBusServiceRegistry.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusProxyStatusEvent
+ : public ProxyStatusEvent {
+ friend class DBusProxy;
+
+ public:
+ DBusProxyStatusEvent(DBusProxy* dbusProxy);
+ virtual ~DBusProxyStatusEvent() {}
+
+ protected:
+ virtual void onListenerAdded(const Listener& listener);
+
+ DBusProxy* dbusProxy_;
+};
+
+
+class DBusProxy
+ : public DBusProxyBase {
+public:
+ COMMONAPI_EXPORT DBusProxy(const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection);
+ COMMONAPI_EXPORT virtual ~DBusProxy();
+
+ COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent();
+ COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
+
+ COMMONAPI_EXPORT virtual bool isAvailable() const;
+ COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
+
+ COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcastOnConnection(
+ bool& subscriptionAccepted,
+ const std::string& objectPath,
+ const std::string& interfaceName,
+ const std::string& interfaceMemberName,
+ const std::string& interfaceMemberSignature,
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
+ COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
+ DBusProxyConnection::DBusSignalHandlerToken subscription,
+ const DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
+
+ COMMONAPI_EXPORT void init();
+
+private:
+ COMMONAPI_EXPORT DBusProxy(const DBusProxy &) = delete;
+
+ COMMONAPI_EXPORT void onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus);
+
+ DBusProxyStatusEvent dbusProxyStatusEvent_;
+ DBusServiceRegistry::DBusServiceSubscription dbusServiceRegistrySubscription_;
+ AvailabilityStatus availabilityStatus_;
+
+ DBusReadonlyAttribute<InterfaceVersionAttribute> interfaceVersionAttribute_;
+
+ std::shared_ptr<DBusServiceRegistry> dbusServiceRegistry_;
+};
+
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSPROXY_HPP_
+
diff --git a/src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
index 66a78f1..eac96d2 100644
--- a/src/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.h
+++ b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
@@ -1,26 +1,24 @@
-/* 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) 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/.
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#error "Only <CommonAPI/CommonAPI.hpp> 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"
+#ifndef COMMONAPI_DBUS_DBUSPROXYASYNCCALLBACKHANDLER_HPP_
+#define COMMONAPI_DBUS_DBUSPROXYASYNCCALLBACKHANDLER_HPP_
#include <functional>
#include <future>
#include <memory>
+#include <CommonAPI/DBus/DBusHelper.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+#include <CommonAPI/DBus/DBusSerializableArguments.hpp>
+
namespace CommonAPI {
namespace DBus {
@@ -30,23 +28,23 @@ class DBusProxyAsyncCallbackHandler: public DBusProxyConnection::DBusMessageRepl
typedef std::function<void(CallStatus, _ArgTypes...)> FunctionType;
static std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler> create(
- FunctionType&& callback) {
+ FunctionType&& callback, std::tuple<_ArgTypes...> args) {
return std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(
- new DBusProxyAsyncCallbackHandler(std::move(callback)));
+ new DBusProxyAsyncCallbackHandler(std::move(callback), args));
}
DBusProxyAsyncCallbackHandler() = delete;
- DBusProxyAsyncCallbackHandler(FunctionType&& callback):
- callback_(std::move(callback)) {
+ DBusProxyAsyncCallbackHandler(FunctionType&& callback, std::tuple<_ArgTypes...> args):
+ callback_(std::move(callback)), args_(args) {
}
+ virtual ~DBusProxyAsyncCallbackHandler() {}
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));
+ promise_.set_value(handleDBusMessageReply(dbusMessageCallStatus, dbusMessage, typename make_sequence<sizeof...(_ArgTypes)>::type(), args_));
}
private:
@@ -71,9 +69,10 @@ class DBusProxyAsyncCallbackHandler: public DBusProxyConnection::DBusMessageRepl
std::promise<CallStatus> promise_;
const FunctionType callback_;
+ std::tuple<_ArgTypes...> args_;
};
} // namespace DBus
} // namespace CommonAPI
-#endif // COMMONAPI_DBUS_DBUS_PROXY_ASYNC_CALLBACK_HANDLER_H_
+#endif // COMMONAPI_DBUS_DBUSPROXYASYNCCALLBACKHANDLER_HPP_
diff --git a/include/CommonAPI/DBus/DBusProxyBase.hpp b/include/CommonAPI/DBus/DBusProxyBase.hpp
new file mode 100644
index 0000000..85c746c
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusProxyBase.hpp
@@ -0,0 +1,72 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSPROXYBASE_HPP_
+#define COMMONAPI_DBUS_DBUSPROXYBASE_HPP_
+
+#include <functional>
+#include <memory>
+#include <string>
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/Proxy.hpp>
+#include <CommonAPI/Types.hpp>
+
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusAddress;
+
+class DBusProxyBase
+ : public virtual CommonAPI::Proxy {
+public:
+ COMMONAPI_EXPORT DBusProxyBase(const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection);
+ COMMONAPI_EXPORT virtual ~DBusProxyBase() {}
+
+ COMMONAPI_EXPORT const DBusAddress &getDBusAddress() const;
+ COMMONAPI_EXPORT const std::shared_ptr<DBusProxyConnection> &getDBusConnection() const;
+
+ COMMONAPI_EXPORT DBusMessage createMethodCall(const std::string &_method,
+ const std::string &_signature = "") const;
+
+ COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
+ const std::string& signalName,
+ const std::string& signalSignature,
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
+ const bool justAddFilter = false);
+
+ COMMONAPI_EXPORT 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);
+
+ COMMONAPI_EXPORT bool removeSignalMemberHandler(
+ const DBusProxyConnection::DBusSignalHandlerToken &_token,
+ const DBusProxyConnection::DBusSignalHandler *_handler = NULL);
+
+ COMMONAPI_EXPORT virtual void init() = 0;
+
+ private:
+ COMMONAPI_EXPORT DBusProxyBase(const DBusProxyBase &) = delete;
+
+ DBusAddress dbusAddress_;
+ std::shared_ptr<DBusProxyConnection> connection_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSPROXYBASE_HPP_
diff --git a/src/CommonAPI/DBus/DBusProxyConnection.h b/include/CommonAPI/DBus/DBusProxyConnection.hpp
index d7c88d8..cbef54d 100644
--- a/src/CommonAPI/DBus/DBusProxyConnection.h
+++ b/include/CommonAPI/DBus/DBusProxyConnection.hpp
@@ -1,39 +1,36 @@
-/* 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/.
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#error "Only <CommonAPI/CommonAPI.hpp> 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>
+#ifndef COMMONAPI_DBUS_DBUSPROXYCONNECTION_HPP_
+#define COMMONAPI_DBUS_DBUSPROXYCONNECTION_HPP_
#include <cstdint>
#include <functional>
#include <future>
#include <memory>
+#include <set>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
+#include <CommonAPI/Attribute.hpp>
+#include <CommonAPI/Event.hpp>
+#include <CommonAPI/Types.hpp>
+#include <CommonAPI/DBus/DBusConfig.hpp>
+#include <CommonAPI/DBus/DBusError.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusFunctionalHash.hpp>
+
namespace CommonAPI {
namespace DBus {
-
typedef std::function<void(const DBusMessage&)> DBusMessageHandler;
class DBusDaemonProxy;
@@ -41,48 +38,45 @@ class DBusServiceRegistry;
class DBusObjectManager;
class DBusProxy;
-
class DBusProxyConnection {
public:
class DBusMessageReplyAsyncHandler {
public:
- virtual ~DBusMessageReplyAsyncHandler() { }
+ 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;
+ virtual ~DBusSignalHandler() {}
+ virtual void 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 std::unordered_map<DBusSignalHandlerPath, std::pair<std::shared_ptr<std::recursive_mutex>, std::set<DBusSignalHandler* >>> DBusSignalHandlerTable;
typedef DBusSignalHandlerPath DBusSignalHandlerToken;
typedef Event<AvailabilityStatus> ConnectionStatusEvent;
- virtual ~DBusProxyConnection() { }
+ 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 bool sendDBusMessage(const DBusMessage& dbusMessage) const = 0;
virtual std::future<CallStatus> sendDBusMessageWithReplyAsync(
const DBusMessage& dbusMessage,
std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
- int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;
+ const CommonAPI::CallInfo *_info) const = 0;
virtual DBusMessage sendDBusMessageWithReplyAndBlock(
const DBusMessage& dbusMessage,
DBusError& dbusError,
- int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;
+ const CommonAPI::CallInfo *_info) const = 0;
virtual DBusSignalHandlerToken addSignalMemberHandler(
const std::string& objectPath,
@@ -113,7 +107,6 @@ class DBusProxyConnection {
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;
@@ -128,8 +121,7 @@ class DBusProxyConnection {
virtual bool isObjectPathMessageHandlerSet() = 0;
};
-
} // namespace DBus
} // namespace CommonAPI
-#endif //COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_
+#endif // COMMONAPI_DBUS_DBUSPROXYCONNECTION_HPP_
diff --git a/include/CommonAPI/DBus/DBusProxyHelper.hpp b/include/CommonAPI/DBus/DBusProxyHelper.hpp
new file mode 100644
index 0000000..516d923
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusProxyHelper.hpp
@@ -0,0 +1,258 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSPROXYHELPER_HPP_
+#define COMMONAPI_DBUS_DBUSPROXYHELPER_HPP_
+
+#include <functional>
+#include <future>
+#include <memory>
+#include <string>
+
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusConfig.hpp>
+#include <CommonAPI/DBus/DBusMessage.hpp>
+#include <CommonAPI/DBus/DBusSerializableArguments.hpp>
+#include <CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp>
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+
+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<DBusInputStream, DBusOutputStream, _InArgs...>,
+ _Out<DBusInputStream, DBusOutputStream, _OutArgs...>> {
+
+ template <typename _DBusProxy = DBusProxy>
+ static void callMethod(const _DBusProxy &_proxy,
+ const std::string &_method,
+ const std::string &_signature,
+ const _InArgs&... _in,
+ CommonAPI::CallStatus &_status) {
+
+ if (_proxy.isAvailableBlocking()) {
+ DBusMessage message = _proxy.createMethodCall(_method, _signature);
+ if (sizeof...(_InArgs) > 0) {
+ DBusOutputStream output(message);
+ if (DBusSerializableArguments<_InArgs...>::serialize(output, _in...)) {
+ _status = CallStatus::OUT_OF_MEMORY;
+ return;
+ }
+ output.flush();
+ }
+
+ const bool isSent = _proxy.getDBusConnection()->sendDBusMessage(message);
+ _status = (isSent ? CallStatus::SUCCESS : CallStatus::OUT_OF_MEMORY);
+ } else {
+ _status = CallStatus::NOT_AVAILABLE;
+ }
+ }
+
+ template <typename _DBusProxy = DBusProxy>
+ static void callMethodWithReply(
+ const _DBusProxy &_proxy,
+ DBusMessage &_message,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ CommonAPI::CallStatus &_status,
+ _OutArgs&... _out) {
+
+ if (sizeof...(_InArgs) > 0) {
+ DBusOutputStream output(_message);
+ if (!DBusSerializableArguments<_InArgs...>::serialize(output, _in...)) {
+ _status = CallStatus::OUT_OF_MEMORY;
+ return;
+ }
+ output.flush();
+ }
+
+ DBusError error;
+ DBusMessage reply = _proxy.getDBusConnection()->sendDBusMessageWithReplyAndBlock(_message, error, _info);
+ if (error || !reply.isMethodReturnType()) {
+ _status = CallStatus::REMOTE_ERROR;
+ return;
+ }
+
+ if (sizeof...(_OutArgs) > 0) {
+ DBusInputStream input(reply);
+ if (!DBusSerializableArguments<_OutArgs...>::deserialize(input, _out...)) {
+ _status = CallStatus::REMOTE_ERROR;
+ return;
+ }
+ }
+ _status = CallStatus::SUCCESS;
+ }
+
+ template <typename _DBusProxy = DBusProxy>
+ static void callMethodWithReply(
+ const _DBusProxy &_proxy,
+ const DBusAddress &_address,
+ const char *_method,
+ const char *_signature,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ CommonAPI::CallStatus &_status,
+ _OutArgs&... _out) {
+ if (_proxy.isAvailableBlocking()) {
+ DBusMessage message = DBusMessage::createMethodCall(_address, _method, _signature);
+ callMethodWithReply(_proxy, message, _info, _in..., _status, _out...);
+ } else {
+ _status = CallStatus::NOT_AVAILABLE;
+ }
+ }
+
+ template <typename _DBusProxy = DBusProxy>
+ static void callMethodWithReply(
+ const _DBusProxy &_proxy,
+ const std::string &_interface,
+ const std::string &_method,
+ const std::string &_signature,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ CommonAPI::CallStatus &_status,
+ _OutArgs&... _out) {
+ DBusAddress itsAddress(_proxy.getDBusAddress());
+ itsAddress.setInterface(_interface);
+ callMethodWithReply(
+ _proxy, itsAddress,
+ _method.c_str(), _signature.c_str(),
+ _info,
+ _in..., _status, _out...);
+ }
+
+ template <typename _DBusProxy = DBusProxy>
+ static void callMethodWithReply(
+ const _DBusProxy &_proxy,
+ const std::string &_method,
+ const std::string &_signature,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ CommonAPI::CallStatus &_status,
+ _OutArgs&... _out) {
+ if (_proxy.isAvailableBlocking()) {
+ DBusMessage message = _proxy.createMethodCall(_method, _signature);
+ callMethodWithReply(_proxy, message, _info, _in..., _status, _out...);
+ } else {
+ _status = CallStatus::NOT_AVAILABLE;
+ }
+ }
+
+ template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ static std::future<CallStatus> callMethodAsync(
+ const _DBusProxy &_proxy,
+ DBusMessage &_message,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ _AsyncCallback _callback,
+ std::tuple<_OutArgs...> _out) {
+ if (sizeof...(_InArgs) > 0) {
+ DBusOutputStream output(_message);
+ const bool success = DBusSerializableArguments<
+ _InArgs...
+ >::serialize(output, _in...);
+ if (!success) {
+ std::promise<CallStatus> promise;
+ promise.set_value(CallStatus::OUT_OF_MEMORY);
+ return promise.get_future();
+ }
+ output.flush();
+ }
+
+ return _proxy.getDBusConnection()->sendDBusMessageWithReplyAsync(
+ _message,
+ DBusProxyAsyncCallbackHandler<
+ _OutArgs...
+ >::create(std::move(_callback), _out),
+ _info);
+ }
+
+ template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ static std::future<CallStatus> callMethodAsync(
+ const _DBusProxy &_proxy,
+ const DBusAddress &_address,
+ const std::string &_method,
+ const std::string &_signature,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ _AsyncCallback _callback,
+ std::tuple<_OutArgs...> _out) {
+ if (_proxy.isAvailable()) {
+ DBusMessage message = DBusMessage::createMethodCall(_address, _method, _signature);
+ return callMethodAsync(_proxy, message, _info, _in..., _callback, _out);
+ } else {
+ CallStatus status = CallStatus::NOT_AVAILABLE;
+ callCallbackOnNotAvailable(_callback, typename make_sequence<sizeof...(_OutArgs)>::type(), _out);
+
+ std::promise<CallStatus> promise;
+ promise.set_value(status);
+ return promise.get_future();
+ }
+ }
+
+ template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ static std::future<CallStatus> callMethodAsync(
+ const _DBusProxy &_proxy,
+ const std::string &_interface,
+ const std::string &_method,
+ const std::string &_signature,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ _AsyncCallback _callback,
+ std::tuple<_OutArgs...> _out) {
+ DBusAddress itsAddress(_proxy.getDBusAddress());
+ itsAddress.setInterface(_interface);
+ return callMethodAsync(
+ _proxy, itsAddress,
+ _method, _signature,
+ _info,
+ _in..., _callback, _out);
+ }
+
+ template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ static std::future<CallStatus> callMethodAsync(
+ const _DBusProxy &_proxy,
+ const std::string &_method,
+ const std::string &_signature,
+ const CommonAPI::CallInfo *_info,
+ const _InArgs&... _in,
+ _AsyncCallback _callback,
+ std::tuple<_OutArgs...> _out) {
+ if (_proxy.isAvailable()) {
+ DBusMessage message = _proxy.createMethodCall(_method, _signature);
+ return callMethodAsync(_proxy, message, _info, _in..., _callback, _out);
+ } else {
+ callCallbackOnNotAvailable(
+ _callback, typename make_sequence<sizeof...(_OutArgs)>::type(), _out);
+
+ CallStatus status = CallStatus::NOT_AVAILABLE;
+ std::promise<CallStatus> promise;
+ promise.set_value(status);
+ return promise.get_future();
+ }
+ }
+
+ template <int... _ArgIndices>
+ static void callCallbackOnNotAvailable(std::function<void(CallStatus, _OutArgs&...)> _callback,
+ index_sequence<_ArgIndices...>, std::tuple<_OutArgs...> _out) {
+ const CallStatus status(CallStatus::NOT_AVAILABLE);
+ _callback(status, std::get<_ArgIndices>(_out)...);
+ }
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSPROXYHELPER_HPP_
diff --git a/include/CommonAPI/DBus/DBusProxyManager.hpp b/include/CommonAPI/DBus/DBusProxyManager.hpp
new file mode 100644
index 0000000..a28527a
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusProxyManager.hpp
@@ -0,0 +1,72 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_PROXYMANAGER_HPP_
+#define COMMONAPI_DBUS_PROXYMANAGER_HPP_
+
+#include <functional>
+#include <future>
+#include <string>
+#include <vector>
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/ProxyManager.hpp>
+#include <CommonAPI/DBus/DBusProxy.hpp>
+#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
+#include <CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusProxyManager: public ProxyManager {
+public:
+ COMMONAPI_EXPORT DBusProxyManager(DBusProxy &_proxy,
+ const std::string &_interfaceName);
+
+ COMMONAPI_EXPORT const std::string &getDomain() const;
+ COMMONAPI_EXPORT const std::string &getInterface() const;
+ COMMONAPI_EXPORT const ConnectionId_t &getConnectionId() const;
+
+ COMMONAPI_EXPORT virtual void getAvailableInstances(CommonAPI::CallStatus &, std::vector<std::string> &_instances);
+ COMMONAPI_EXPORT virtual std::future<CallStatus> getAvailableInstancesAsync(GetAvailableInstancesCallback _callback);
+
+ COMMONAPI_EXPORT virtual void getInstanceAvailabilityStatus(const std::string &_address,
+ CallStatus &_callStatus,
+ AvailabilityStatus &_availabilityStatus);
+
+ COMMONAPI_EXPORT virtual std::future<CallStatus> getInstanceAvailabilityStatusAsync(
+ const std::string&,
+ GetInstanceAvailabilityStatusCallback callback);
+
+ COMMONAPI_EXPORT virtual InstanceAvailabilityStatusChangedEvent& getInstanceAvailabilityStatusChangedEvent();
+
+private:
+ COMMONAPI_EXPORT void instancesAsyncCallback(const CommonAPI::CallStatus& status,
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dict,
+ GetAvailableInstancesCallback& call);
+
+ COMMONAPI_EXPORT void instanceAliveAsyncCallback(const AvailabilityStatus &_alive,
+ GetInstanceAvailabilityStatusCallback &_call,
+ std::shared_ptr<std::promise<CallStatus>> &_status);
+
+ COMMONAPI_EXPORT void translateCommonApiAddresses(const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
+ std::vector<std::string> &_instances);
+
+ DBusProxy &proxy_;
+ DBusInstanceAvailabilityStatusChangedEvent instanceAvailabilityStatusEvent_;
+ const std::string interfaceId_;
+ const std::shared_ptr<DBusServiceRegistry> registry_;
+ ConnectionId_t connectionId_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_PROXYMANAGER_HPP_
diff --git a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
new file mode 100644
index 0000000..65c61f9
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
@@ -0,0 +1,56 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSSELECTIVEEVENT_HPP_
+#define COMMONAPI_DBUS_DBUSSELECTIVEEVENT_HPP_
+
+#include <CommonAPI/DBus/DBusEvent.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+template<typename _EventType, typename... _Arguments>
+class DBusSelectiveEvent: public DBusEvent<_EventType, _Arguments...> {
+public:
+ typedef typename DBusEvent<_EventType, _Arguments...>::Listener Listener;
+ typedef DBusEvent<_EventType, _Arguments...> DBusEventBase;
+
+ DBusSelectiveEvent(DBusProxy &_proxy,
+ const char *_name, const char *_signature,
+ std::tuple<_Arguments...> _arguments)
+ : DBusEventBase(_proxy, _name, _signature, _arguments) {
+ }
+
+ DBusSelectiveEvent(DBusProxy &_proxy,
+ const char *_name, const char *_signature,
+ const char *_path, const char *_interface,
+ std::tuple<_Arguments...> _arguments)
+ : DBusEventBase(_proxy, _name, _signature, _path, _interface, _arguments) {
+ }
+
+ virtual ~DBusSelectiveEvent() {}
+
+protected:
+ void onFirstListenerAdded(const Listener &) {
+ bool success;
+ this->subscription_
+ = static_cast<DBusProxy&>(this->proxy_).subscribeForSelectiveBroadcastOnConnection(
+ success, this->path_, this->interface_, this->name_, this->signature_, this);
+ }
+
+ void onLastListenerRemoved(const Listener &) {
+ static_cast<DBusProxy&>(this->proxy_).unsubscribeFromSelectiveBroadcast(
+ this->name_, this->subscription_, this);
+ }
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSSELECTIVEEVENT_HPP_
diff --git a/include/CommonAPI/DBus/DBusSerializableArguments.hpp b/include/CommonAPI/DBus/DBusSerializableArguments.hpp
new file mode 100644
index 0000000..f763ce5
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusSerializableArguments.hpp
@@ -0,0 +1,30 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUS_SERIALIZABLEARGUMENTS_HPP_
+#define COMMONAPI_DBUS_DBUS_SERIALIZABLEARGUMENTS_HPP_
+
+#include <CommonAPI/SerializableArguments.hpp>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+template<typename... _Arguments>
+using DBusSerializableArguments = CommonAPI::SerializableArguments<
+ DBusInputStream,
+ DBusOutputStream,
+ _Arguments...
+ >;
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSSERIALIZABLEARGUMENTS_HPP_
diff --git a/src/CommonAPI/DBus/DBusServiceRegistry.h b/include/CommonAPI/DBus/DBusServiceRegistry.hpp
index 4c90091..3dbcf1b 100644
--- a/src/CommonAPI/DBus/DBusServiceRegistry.h
+++ b/include/CommonAPI/DBus/DBusServiceRegistry.hpp
@@ -1,43 +1,36 @@
-/* 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/.
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#error "Only <CommonAPI/CommonAPI.hpp> 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"
+#ifndef COMMONAPI_DBUS_DBUSSERVICEREGISTRY_HPP_
+#define COMMONAPI_DBUS_DBUSSERVICEREGISTRY_HPP_
+#include <algorithm>
+#include <condition_variable>
+#include <future>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <set>
+#include <string>
#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>
+#include <pugixml/pugixml.hpp>
+
+#include <CommonAPI/Attribute.hpp>
+#include <CommonAPI/Proxy.hpp>
+#include <CommonAPI/Types.hpp>
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+#include <CommonAPI/DBus/DBusFactory.hpp>
namespace CommonAPI {
namespace DBus {
@@ -45,10 +38,11 @@ namespace DBus {
typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;
typedef Event<std::string, std::string, std::string>::Subscription NameOwnerChangedEventSubscription;
-//connectionName, objectPath
+// Connection name, Object path
typedef std::pair<std::string, std::string> DBusInstanceId;
-class DBusProxyConnection;
+class DBusAddress;
+class DBusAddressTranslator;
class DBusDaemonProxy;
class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegistry>,
@@ -63,16 +57,16 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
};
// template class DBusServiceListener<> { typedef functor; typedef list; typedef subscription }
- typedef std::function<SubscriptionStatus(const AvailabilityStatus& availabilityStatus)> DBusServiceListener;
+ typedef std::function<void(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::function<void(const std::vector<std::string>& interfaces,
+ const AvailabilityStatus& availabilityStatus)> DBusManagedInterfaceListener;
typedef std::list<DBusManagedInterfaceListener> DBusManagedInterfaceListenerList;
typedef DBusManagedInterfaceListenerList::iterator DBusManagedInterfaceSubscription;
+ static std::shared_ptr<DBusServiceRegistry> get(std::shared_ptr<DBusProxyConnection> _connection);
DBusServiceRegistry(std::shared_ptr<DBusProxyConnection> dbusProxyConnection);
@@ -83,38 +77,36 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
void init();
+ DBusServiceSubscription subscribeAvailabilityListener(const std::string &_address,
+ DBusServiceListener _listener);
- DBusServiceSubscription subscribeAvailabilityListener(const std::string& commonApiAddress,
- DBusServiceListener serviceListener);
-
- void unsubscribeAvailabilityListener(const std::string& commonApiAddress,
- DBusServiceSubscription& listenerSubscription);
+ void unsubscribeAvailabilityListener(const std::string &_address,
+ DBusServiceSubscription &_listener);
- bool isServiceInstanceAlive(const std::string& dbusInterfaceName,
- const std::string& dbusConnectionName,
- const std::string& dbusObjectPath);
+ 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 std::vector<std::string> getAvailableServiceInstances(const std::string &_interface,
+ const std::string &_domain = "local");
- virtual void getAvailableServiceInstancesAsync(Factory::GetAvailableServiceInstancesCallback callback,
- const std::string& interfaceName,
- const std::string& domainName = "local");
+ virtual void getAvailableServiceInstancesAsync(CommonAPI::Factory::AvailableInstancesCbk_t _cbk,
+ const std::string &_interface,
+ const std::string &_domain = "local");
-
- virtual SubscriptionStatus onSignalDBusMessage(const DBusMessage&);
+ virtual void onSignalDBusMessage(const DBusMessage&);
private:
struct DBusInterfaceNameListenersRecord {
- DBusInterfaceNameListenersRecord(): state(DBusRecordState::UNKNOWN) {
+ DBusInterfaceNameListenersRecord()
+ : state(DBusRecordState::UNKNOWN) {
}
- DBusInterfaceNameListenersRecord(DBusInterfaceNameListenersRecord&& other):
- state(other.state),
- listenerList(std::move(other.listenerList))
- {
+ DBusInterfaceNameListenersRecord(DBusInterfaceNameListenersRecord &&_other)
+ : state(_other.state),
+ listenerList(std::move(_other.listenerList)) {
}
DBusRecordState state;
@@ -124,23 +116,24 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
typedef std::unordered_map<std::string, DBusInterfaceNameListenersRecord> DBusInterfaceNameListenersMap;
struct DBusServiceListenersRecord {
- DBusServiceListenersRecord(): uniqueBusNameState(DBusRecordState::UNKNOWN),
- mutexOnResolve() {
+ 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(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::string uniqueBusName;
std::promise<DBusRecordState> promiseOnResolve;
std::shared_future<DBusRecordState> futureOnResolve;
@@ -153,17 +146,16 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
struct DBusObjectPathCache {
- DBusObjectPathCache(): referenceCount(0), state(DBusRecordState::UNKNOWN) {
+ 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(DBusObjectPathCache&& other)
+ : referenceCount(other.referenceCount),
+ state(other.state),
+ promiseOnResolve(std::move(other.promiseOnResolve)),
+ dbusInterfaceNamesCache(std::move(other.dbusInterfaceNamesCache)) {
}
~DBusObjectPathCache() {}
@@ -176,15 +168,16 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
};
struct DBusUniqueNameRecord {
- DBusUniqueNameRecord(): objectPathsState(DBusRecordState::UNKNOWN) {
+ 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))
- {}
+ 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;
@@ -198,21 +191,19 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
// 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);
+ 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);
+ DBusRecordState resolveDBusInterfaceNameState(const DBusAddress &_address,
+ DBusServiceListenersRecord &_record);
DBusObjectPathCache& getDBusObjectPathCacheReference(const std::string& dbusObjectPath,
@@ -248,11 +239,11 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
const std::string& fullObjectPath,
const std::string& dbusServiceUniqueName);
- SubscriptionStatus onDBusDaemonProxyStatusEvent(const AvailabilityStatus& availabilityStatus);
+ void onDBusDaemonProxyStatusEvent(const AvailabilityStatus& availabilityStatus);
- SubscriptionStatus onDBusDaemonProxyNameOwnerChangedEvent(const std::string& name,
- const std::string& oldOwner,
- const std::string& newOwner);
+ void onDBusDaemonProxyNameOwnerChangedEvent(const std::string& name,
+ const std::string& oldOwner,
+ const std::string& newOwner);
std::shared_ptr<DBusDaemonProxy> dbusDaemonProxy_;
bool initialized_;
@@ -265,7 +256,7 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
void onDBusServiceAvailable(const std::string& dbusServiceName, const std::string& dbusServiceUniqueName);
- void onDBusServiceNotAvailable(DBusServiceListenersRecord& dbusServiceListenersRecord);
+ void onDBusServiceNotAvailable(DBusServiceListenersRecord& dbusServiceListenersRecord, const std::string &_serviceName = "");
void notifyDBusServiceListeners(const DBusUniqueNameRecord& dbusUniqueNameRecord,
@@ -284,7 +275,7 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
const bool& isDBusInterfaceNameAvailable);
- void removeUniqueName(const DBusUniqueNamesMapIterator& dbusUniqueName);
+ void removeUniqueName(const DBusUniqueNamesMapIterator &_dbusUniqueName, const std::string &_serviceName);
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);
@@ -297,11 +288,10 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
std::mutex mutexObjectPathsResolveCount;
int objectPathsToResolve;
-
void fetchAllServiceNames();
- inline const bool isDBusServiceName(const std::string& serviceName) {
- return (serviceName.length() > 0 && serviceName[0] != ':');
+ inline const bool isDBusServiceName(const std::string &_name) {
+ return (_name.length() > 0 && _name[0] != ':');
};
@@ -310,10 +300,16 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
}
std::thread::id notificationThread_;
+
+private:
+ typedef std::map<std::shared_ptr<DBusProxyConnection>, std::shared_ptr<DBusServiceRegistry>> RegistryMap_t;
+ static RegistryMap_t registries_;
+ static std::mutex registriesMutex_;
+ std::shared_ptr<DBusAddressTranslator> translator_;
};
} // namespace DBus
} // namespace CommonAPI
-#endif // COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_
+#endif // COMMONAPI_DBUS_DBUSSERVICEREGISTRY_HPP_
diff --git a/include/CommonAPI/DBus/DBusStubAdapter.hpp b/include/CommonAPI/DBus/DBusStubAdapter.hpp
new file mode 100644
index 0000000..5d1657b
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusStubAdapter.hpp
@@ -0,0 +1,59 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSSTUBADAPTER_HPP_
+#define COMMONAPI_DBUS_DBUSSTUBADAPTER_HPP_
+
+#include <memory>
+
+#include <CommonAPI/Export.hpp>
+#include <CommonAPI/Stub.hpp>
+#include <CommonAPI/DBus/DBusAddress.hpp>
+#include <CommonAPI/DBus/DBusInterfaceHandler.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusProxyConnection;
+
+class DBusStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public DBusInterfaceHandler {
+ public:
+ COMMONAPI_EXPORT DBusStubAdapter(const DBusAddress &_dbusAddress,
+ const std::shared_ptr<DBusProxyConnection> &_connection,
+ const bool isManagingInterface);
+
+ COMMONAPI_EXPORT virtual ~DBusStubAdapter();
+
+ COMMONAPI_EXPORT virtual void init(std::shared_ptr<DBusStubAdapter> _instance);
+ COMMONAPI_EXPORT virtual void deinit();
+
+ COMMONAPI_EXPORT const DBusAddress &getDBusAddress() const;
+ COMMONAPI_EXPORT const std::shared_ptr<DBusProxyConnection> &getDBusConnection() const;
+
+ COMMONAPI_EXPORT const bool isManaging() const;
+
+ COMMONAPI_EXPORT virtual const char* getMethodsDBusIntrospectionXmlData() const = 0;
+ COMMONAPI_EXPORT virtual bool onInterfaceDBusMessage(const DBusMessage &_message) = 0;
+
+ COMMONAPI_EXPORT virtual void deactivateManagedInstances() = 0;
+ COMMONAPI_EXPORT virtual const bool hasFreedesktopProperties();
+ COMMONAPI_EXPORT virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const DBusMessage &_message) = 0;
+
+ protected:
+ DBusAddress dbusAddress_;
+ const std::shared_ptr<DBusProxyConnection> connection_;
+ const bool isManaging_;
+};
+
+} // namespace dbus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSSTUBADAPTER_HPP_
diff --git a/src/CommonAPI/DBus/DBusStubAdapterHelper.h b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
index dbac232..56e5021 100644
--- a/src/CommonAPI/DBus/DBusStubAdapterHelper.h
+++ b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
@@ -1,31 +1,28 @@
-/* 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/.
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#error "Only <CommonAPI/CommonAPI.hpp> 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_
+#ifndef COMMONAPI_DBUS_DBUSSTUBADAPTERHELPER_HPP_
+#define COMMONAPI_DBUS_DBUSSTUBADAPTERHELPER_HPP_
-#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 <memory>
#include <tuple>
#include <unordered_map>
+#include <map>
+
+#include <CommonAPI/Variant.hpp>
+#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusOutputStream.hpp>
+#include <CommonAPI/DBus/DBusHelper.hpp>
+#include <CommonAPI/DBus/DBusSerializableArguments.hpp>
+#include <CommonAPI/DBus/DBusClientId.hpp>
namespace CommonAPI {
namespace DBus {
@@ -35,9 +32,6 @@ public:
virtual ~StubDispatcherBase() { }
};
-template <typename _StubClass>
-class DBusGetFreedesktopAttributeStubDispatcherBase;
-
struct DBusAttributeDispatcherStruct {
StubDispatcherBase* getter;
StubDispatcherBase* setter;
@@ -57,7 +51,8 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
typedef typename _StubClass::RemoteEventHandlerType RemoteEventHandlerType;
class StubDispatcher: public StubDispatcherBase {
- public:
+ public:
+ virtual ~StubDispatcher() {}
virtual bool dispatchDBusMessage(const DBusMessage& dbusMessage,
const std::shared_ptr<_StubClass>& stub,
DBusStubAdapterHelper<_StubClass>& dbusStubAdapterHelper) = 0;
@@ -66,17 +61,13 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
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) {
+ DBusStubAdapterHelper(const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection,
+ const std::shared_ptr<_StubClass> &_stub,
+ const bool _isManaging):
+ DBusStubAdapter(_address, _connection, _isManaging),
+ stub_(_stub),
+ remoteEventHandler_(nullptr) {
}
virtual ~DBusStubAdapterHelper() {
@@ -87,7 +78,7 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
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);
+ remoteEventHandler_ = stub_->initStubAdapter(stubAdapter);
}
virtual void deinit() {
@@ -102,8 +93,8 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
protected:
virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) {
- const char* interfaceMemberName = dbusMessage.getMemberName();
- const char* interfaceMemberSignature = dbusMessage.getSignatureString();
+ const char* interfaceMemberName = dbusMessage.getMember();
+ const char* interfaceMemberSignature = dbusMessage.getSignature();
assert(interfaceMemberName);
assert(interfaceMemberSignature);
@@ -112,26 +103,23 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
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) {
+ if (foundInterfaceMemberHandler) {
StubDispatcher* stubDispatcher = static_cast<StubDispatcher*>(findIterator->second);
- dbusMessageHandled = stubDispatcher->dispatchDBusMessage(dbusMessage, stubSafety, *this);
+ dbusMessageHandled = stubDispatcher->dispatchDBusMessage(dbusMessage, stub_, *this);
}
return dbusMessageHandled;
}
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const DBusMessage& dbusMessage) {
- DBusInputStream dbusInputStream(dbusMessage);
+ virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const DBusMessage &_message) {
+ DBusInputStream input(_message);
- 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);
+ if (_message.hasMemberName("Get")) {
+ return handleFreedesktopGet(_message, input);
+ } else if (_message.hasMemberName("Set")) {
+ return handleFreedesktopSet(_message, input);
+ } else if (_message.hasMemberName("GetAll")) {
+ return handleFreedesktopGetAll(_message, input);
}
return false;
@@ -140,34 +128,28 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
virtual const StubDispatcherTable& getStubDispatcherTable() = 0;
virtual const StubAttributeTable& getStubAttributeTable() = 0;
- std::weak_ptr<_StubClass> stub_;
+ std::shared_ptr<_StubClass> stub_;
RemoteEventHandlerType* remoteEventHandler_;
+
private:
- bool handleFreedesktopGet(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
+ bool handleFreedesktopGet(const DBusMessage &_message, DBusInputStream &_input) {
std::string interfaceName;
std::string attributeName;
- dbusInputStream >> interfaceName;
- dbusInputStream >> attributeName;
+ _input >> interfaceName;
+ _input >> attributeName;
- if (dbusInputStream.hasError()) {
+ if (_input.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;
+ StubDispatcher* getterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.getter);
+ assert(getterDispatcher != NULL); // all attributes have at least a getter
+ return (getterDispatcher->dispatchDBusMessage(_message, stub_, *this));
}
bool handleFreedesktopSet(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
@@ -181,24 +163,16 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
}
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);
+ StubDispatcher *setterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.setter);
+ if (setterDispatcher == NULL) { // readonly attributes do not have a setter
+ return false;
+ }
- if(setterDispatcher == NULL) { // readonly attributes do not have a setter
- return false;
- }
-
- return(setterDispatcher->dispatchDBusMessage(dbusMessage, stubSafety, *this));
- }
-
- return false;
+ return setterDispatcher->dispatchDBusMessage(dbusMessage, stub_, *this);
}
bool handleFreedesktopGetAll(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
@@ -211,15 +185,14 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
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) {
+ if (stub_) {
DBusGetFreedesktopAttributeStubDispatcherBase<_StubClass>* const getterDispatcher = dynamic_cast<DBusGetFreedesktopAttributeStubDispatcherBase<_StubClass>*>(attributeDispatcherIterator->second.getter);
if(getterDispatcher == NULL) { // readonly attributes do not have a setter
@@ -227,11 +200,12 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
}
dbusOutputStream << attributeDispatcherIterator->first;
- getterDispatcher->dispatchDBusMessageAndAppendReply(dbusMessage, stubSafety, dbusOutputStream, clientId);
+ getterDispatcher->dispatchDBusMessageAndAppendReply(dbusMessage, stub_, dbusOutputStream, clientId);
}
}
dbusOutputStream.endWriteVector();
+ */
dbusOutputStream.flush();
return getDBusConnection()->sendDBusMessage(dbusMessageReply);
}
@@ -241,7 +215,7 @@ template< class >
struct DBusStubSignalHelper;
template<template<class ...> class _In, class... _InArgs>
-struct DBusStubSignalHelper<_In<_InArgs...>> {
+struct DBusStubSignalHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>> {
static inline bool sendSignal(const char* objectPath,
const char* interfaceName,
@@ -269,32 +243,33 @@ struct DBusStubSignalHelper<_In<_InArgs...>> {
}
template <typename _DBusStub = DBusStubAdapter>
- static bool sendSignal(const _DBusStub& dbusStub,
- const char* signalName,
- const char* signalSignature,
+ static bool sendSignal(const _DBusStub &_stub,
+ const char *_name,
+ const char *_signature,
const _InArgs&... inArgs) {
- return(sendSignal(dbusStub.getObjectPath().c_str(),
- dbusStub.getInterfaceName().c_str(),
- signalName,
- signalSignature,
- dbusStub.getDBusConnection(),
+ return(sendSignal(_stub.getDBusAddress().getObjectPath().c_str(),
+ _stub.getDBusAddress().getInterface().c_str(),
+ _name,
+ _signature,
+ _stub.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);
+ static bool sendSignal(const char *_target,
+ const _DBusStub &_stub,
+ const char *_name,
+ const char *_signature,
+ const _InArgs&... inArgs) {
+ DBusMessage dbusMessage
+ = DBusMessage::createSignal(
+ _stub.getDBusAddress().getObjectPath().c_str(),
+ _stub.getDBusAddress().getInterface().c_str(),
+ _name,
+ _signature);
+
+ dbusMessage.setDestination(_target);
if (sizeof...(_InArgs) > 0) {
DBusOutputStream outputStream(dbusMessage);
@@ -305,74 +280,10 @@ struct DBusStubSignalHelper<_In<_InArgs...>> {
outputStream.flush();
}
- const bool dbusMessageSent = dbusStub.getDBusConnection()->sendDBusMessage(dbusMessage);
- return dbusMessageSent;
+ return _stub.getDBusConnection()->sendDBusMessage(dbusMessage);
}
};
-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;
@@ -407,7 +318,7 @@ class DBusMethodStubDispatcher<_StubClass, _In<_InArgs...> >: public DBusStubAda
return false;
}
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
+ std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
(stub.get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(argTuple))...);
@@ -418,7 +329,7 @@ class DBusMethodStubDispatcher<_StubClass, _In<_InArgs...> >: public DBusStubAda
};
-template< class, class, class >
+template< class, class, class>
class DBusMethodWithReplyStubDispatcher;
template <
@@ -429,31 +340,39 @@ class DBusMethodWithReplyStubDispatcher<_StubClass, _In<_InArgs...>, _Out<_OutAr
public DBusStubAdapterHelper<_StubClass>::StubDispatcher {
public:
typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef void (_StubClass::*_StubFunctor)(std::shared_ptr<CommonAPI::ClientId>, _InArgs..., _OutArgs&...);
+ typedef std::function<void (_OutArgs...)> ReplyType_t;
+ typedef void (_StubClass::*_StubFunctor)(
+ std::shared_ptr<CommonAPI::ClientId>, _InArgs..., ReplyType_t);
- DBusMethodWithReplyStubDispatcher(_StubFunctor stubFunctor, const char* dbusReplySignature):
+ DBusMethodWithReplyStubDispatcher(_StubFunctor stubFunctor, const char* dbusReplySignature, std::tuple<_InArgs..., _OutArgs...> _args):
stubFunctor_(stubFunctor),
- dbusReplySignature_(dbusReplySignature) {
+ dbusReplySignature_(dbusReplySignature),
+ args_(_args),
+ currentCall_(0) {
}
bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- std::tuple<_InArgs..., _OutArgs...> argTuple;
+ connection_ = dbusStubAdapterHelper.getDBusConnection();
return handleDBusMessage(
dbusMessage,
stub,
dbusStubAdapterHelper,
typename make_sequence_range<sizeof...(_InArgs), 0>::type(),
- typename make_sequence_range<sizeof...(_OutArgs), sizeof...(_InArgs)>::type(),argTuple);
+ typename make_sequence_range<sizeof...(_OutArgs), sizeof...(_InArgs)>::type(), args_);
}
- private:
+
+ bool sendReply(CommonAPI::CallId_t _call, std::tuple<_OutArgs...> args = std::make_tuple()) {
+ return sendReplyInternal(_call, typename make_sequence_range<sizeof...(_OutArgs), 0>::type(), args);
+ }
+
+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 {
-
+ std::tuple<_InArgs..., _OutArgs...> argTuple) {
if (sizeof...(_InArgs) > 0) {
DBusInputStream dbusInputStream(dbusMessage);
const bool success = DBusSerializableArguments<_InArgs...>::deserialize(dbusInputStream, std::get<_InArgIndices>(argTuple)...);
@@ -461,26 +380,60 @@ class DBusMethodWithReplyStubDispatcher<_StubClass, _In<_InArgs...>, _Out<_OutAr
return false;
}
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
+ std::shared_ptr<DBusClientId> clientId
+ = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
+ DBusMessage reply = dbusMessage.createMethodReturn(dbusReplySignature_);
- (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();
+ CommonAPI::CallId_t call;
+ {
+ std::lock_guard<std::mutex> lock(mutex_);
+ call = currentCall_++;
+ pending_[call] = reply;
}
- return dbusStubAdapterHelper.getDBusConnection()->sendDBusMessage(dbusMessageReply);
- }
+ (stub.get()->*stubFunctor_)(
+ clientId,
+ std::move(std::get<_InArgIndices>(argTuple))...,
+ [call, this](_OutArgs... _args){
+ this->sendReply(call, std::make_tuple(_args...));
+ }
+ );
+
+ return true;
+ }
+
+ template<int... _OutArgIndices>
+ bool sendReplyInternal(CommonAPI::CallId_t _call,
+ index_sequence<_OutArgIndices...>,
+ std::tuple<_OutArgs...> args) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ auto reply = pending_.find(_call);
+ if (reply != pending_.end()) {
+ if (sizeof...(_OutArgs) > 0) {
+ DBusOutputStream output(reply->second);
+ if (!DBusSerializableArguments<_OutArgs...>::serialize(
+ output, std::get<_OutArgIndices>(args)...)) {
+ pending_.erase(_call);
+ return false;
+ }
+ output.flush();
+ }
+ bool isSuccessful = connection_->sendDBusMessage(reply->second);
+ pending_.erase(_call);
+ return isSuccessful;
+ }
+ return false;
+ }
_StubFunctor stubFunctor_;
const char* dbusReplySignature_;
+ std::tuple<_InArgs..., _OutArgs...> args_;
+
+ CommonAPI::CallId_t currentCall_;
+ std::map<CommonAPI::CallId_t, DBusMessage> pending_;
+ std::mutex mutex_; // protects pending_
+
+ std::shared_ptr<DBusProxyConnection> connection_;
};
template< class, class, class, class >
@@ -529,7 +482,7 @@ class DBusMethodWithReplyAdapterDispatcher<_StubClass, _StubAdapterClass, _In<_I
return false;
}
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
+ std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
(stub->StubType::getStubAdapter().get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(argTuple))..., std::get<_OutArgIndices>(argTuple)...);
DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(dbusReplySignature_);
@@ -551,15 +504,16 @@ class DBusMethodWithReplyAdapterDispatcher<_StubClass, _StubAdapterClass, _In<_I
};
-template <typename _StubClass, typename _AttributeType>
+template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
class DBusGetAttributeStubDispatcher: public virtual DBusStubAdapterHelper<_StubClass>::StubDispatcher {
public:
typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
typedef const _AttributeType& (_StubClass::*GetStubFunctor)(std::shared_ptr<CommonAPI::ClientId>);
- DBusGetAttributeStubDispatcher(GetStubFunctor getStubFunctor, const char* dbusSignature):
- getStubFunctor_(getStubFunctor),
- dbusSignature_(dbusSignature) {
+ DBusGetAttributeStubDispatcher(GetStubFunctor _getStubFunctor, const char *_signature, _AttributeDepl *_depl = nullptr):
+ getStubFunctor_(_getStubFunctor),
+ signature_(_signature),
+ depl_(_depl) {
}
virtual ~DBusGetAttributeStubDispatcher() {};
@@ -569,81 +523,39 @@ class DBusGetAttributeStubDispatcher: public virtual DBusStubAdapterHelper<_Stub
}
protected:
virtual bool sendAttributeValueReply(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(dbusSignature_);
+ DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(signature_);
DBusOutputStream dbusOutputStream(dbusMessageReply);
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
+ std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
- dbusOutputStream << (stub.get()->*getStubFunctor_)(clientId);
+ dbusOutputStream << CommonAPI::Deployable<_AttributeType, _AttributeDepl>((stub.get()->*getStubFunctor_)(clientId), depl_);
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);
- }
+ GetStubFunctor getStubFunctor_;
+ const char* signature_;
+ _AttributeDepl *depl_;
};
-
-template <typename _StubClass, typename _AttributeType>
-class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatcher<_StubClass, _AttributeType> {
+template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl> {
public:
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
+ typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
typedef typename DBusStubAdapterHelperType::RemoteEventHandlerType RemoteEventHandlerType;
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>::GetStubFunctor GetStubFunctor;
+ typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::GetStubFunctor GetStubFunctor;
typedef bool (RemoteEventHandlerType::*OnRemoteSetFunctor)(std::shared_ptr<CommonAPI::ClientId>, _AttributeType);
typedef void (RemoteEventHandlerType::*OnRemoteChangedFunctor)();
DBusSetAttributeStubDispatcher(GetStubFunctor getStubFunctor,
OnRemoteSetFunctor onRemoteSetFunctor,
OnRemoteChangedFunctor onRemoteChangedFunctor,
- const char* dbusSignature) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor, dbusSignature),
+ const char* dbusSignature,
+ _AttributeDepl *_depl = nullptr) :
+ DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(getStubFunctor, dbusSignature, _depl),
onRemoteSetFunctor_(onRemoteSetFunctor),
onRemoteChangedFunctor_(onRemoteChangedFunctor) {
}
@@ -663,18 +575,18 @@ class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatc
}
protected:
- virtual _AttributeType retreiveAttributeValue(const DBusMessage& dbusMessage, bool& errorOccured) {
+ virtual _AttributeType retrieveAttributeValue(const DBusMessage& dbusMessage, bool& errorOccured) {
errorOccured = false;
DBusInputStream dbusInputStream(dbusMessage);
- _AttributeType attributeValue;
+ CommonAPI::Deployable<_AttributeType, _AttributeDepl> attributeValue(this->depl_);
dbusInputStream >> attributeValue;
if (dbusInputStream.hasError()) {
errorOccured = true;
}
- return attributeValue;
+ return attributeValue.getValue();
}
inline bool setAttributeValue(const DBusMessage& dbusMessage,
@@ -682,15 +594,16 @@ class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatc
DBusStubAdapterHelperType& dbusStubAdapterHelper,
bool& attributeValueChanged) {
bool errorOccured;
- _AttributeType attributeValue = retreiveAttributeValue(dbusMessage, errorOccured);
+ CommonAPI::Deployable<_AttributeType, _AttributeDepl> attributeValue(
+ retrieveAttributeValue(dbusMessage, errorOccured), this->depl_);
if(errorOccured) {
return false;
}
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
+ std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
- attributeValueChanged = (dbusStubAdapterHelper.getRemoteEventHandler()->*onRemoteSetFunctor_)(clientId, std::move(attributeValue));
+ attributeValueChanged = (dbusStubAdapterHelper.getRemoteEventHandler()->*onRemoteSetFunctor_)(clientId, std::move(attributeValue.getValue()));
return this->sendAttributeValueReply(dbusMessage, stub, dbusStubAdapterHelper);
}
@@ -707,60 +620,14 @@ class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatc
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> {
+template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+class DBusSetObservableAttributeStubDispatcher: public virtual DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl> {
public:
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
+ typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::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 DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::GetStubFunctor GetStubFunctor;
+ typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::OnRemoteSetFunctor OnRemoteSetFunctor;
+ typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::OnRemoteChangedFunctor OnRemoteChangedFunctor;
typedef typename CommonAPI::Stub<StubAdapterType, typename _StubClass::RemoteEventType> StubType;
typedef void (StubAdapterType::*FireChangedFunctor)(const _AttributeType&);
@@ -768,13 +635,13 @@ class DBusSetObservableAttributeStubDispatcher: public virtual DBusSetAttributeS
OnRemoteSetFunctor onRemoteSetFunctor,
OnRemoteChangedFunctor onRemoteChangedFunctor,
FireChangedFunctor fireChangedFunctor,
- const char* dbusSignature) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor, dbusSignature),
- DBusSetAttributeStubDispatcher<_StubClass, _AttributeType>(getStubFunctor,
- onRemoteSetFunctor,
- onRemoteChangedFunctor,
- dbusSignature),
- fireChangedFunctor_(fireChangedFunctor) {
+ const char* dbusSignature,
+ _AttributeDepl *_depl = nullptr)
+ : DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(
+ getStubFunctor, dbusSignature, _depl),
+ DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(
+ getStubFunctor, onRemoteSetFunctor, onRemoteChangedFunctor, dbusSignature, _depl),
+ fireChangedFunctor_(fireChangedFunctor) {
}
virtual ~DBusSetObservableAttributeStubDispatcher() {};
@@ -785,7 +652,7 @@ class DBusSetObservableAttributeStubDispatcher: public virtual DBusSetAttributeS
return false;
if (attributeValueChanged) {
- std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName()));
+ std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
fireAttributeValueChanged(clientId, dbusStubAdapterHelper, stub);
this->notifyOnRemoteChanged(dbusStubAdapterHelper);
}
@@ -801,38 +668,7 @@ protected:
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_
+#endif // COMMONAPI_DBUS_DBUSSTUBADAPTERHELPER_HPP_
diff --git a/include/CommonAPI/DBus/DBusTypeOutputStream.hpp b/include/CommonAPI/DBus/DBusTypeOutputStream.hpp
new file mode 100644
index 0000000..3ba7cf7
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusTypeOutputStream.hpp
@@ -0,0 +1,153 @@
+// 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/.
+
+#ifndef COMMONAPI_DBUS_DBUSTYPEOUTPUTSTREAM_H_
+#define COMMONAPI_DBUS_DBUSTYPEOUTPUTSTREAM_H_
+
+#include <CommonAPI/TypeOutputStream.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusTypeOutputStream: public TypeOutputStream<DBusTypeOutputStream> {
+public:
+ DBusTypeOutputStream() : signature_("") {}
+
+ TypeOutputStream &writeType(const bool &_type) {
+ signature_.append("b");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const int8_t &) {
+ signature_.append("y");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const int16_t &) {
+ signature_.append("n");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const int32_t &) {
+ signature_.append("i");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const int64_t &) {
+ signature_.append("x");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const uint8_t &) {
+ signature_.append("y");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const uint16_t &) {
+ signature_.append("q");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const uint32_t &) {
+ signature_.append("u");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const uint64_t &) {
+ signature_.append("t");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const float &) {
+ signature_.append("d");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const double &) {
+ signature_.append("d");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const std::string &) {
+ signature_.append("s");
+ return (*this);
+ }
+
+ TypeOutputStream &writeType() {
+ signature_.append("ay");
+ return (*this);
+ }
+
+ TypeOutputStream &writeVersionType() {
+ signature_.append("(uu)");
+ return (*this);
+ }
+
+ template<typename... _Types>
+ TypeOutputStream &writeType(const Struct<_Types...> &_value) {
+ signature_.append("(");
+ const auto itsSize(std::tuple_size<std::tuple<_Types...>>::value);
+ StructTypeWriter<itsSize-1, DBusTypeOutputStream, Struct<_Types...>>{}
+ (*this, _value);
+ signature_.append(")");
+ return (*this);
+ }
+
+ template<class _PolymorphicStruct>
+ TypeOutputStream &writeType(const std::shared_ptr<_PolymorphicStruct> &_value) {
+ signature_.append("(");
+ _value->writeType(*this);
+ signature_.append(")");
+ return (*this);
+ }
+
+ template<typename... _Types>
+ TypeOutputStream &writeType(const Variant<_Types...> &_value) {
+ signature_.append("(yv)");
+ return (*this);
+ }
+
+ template<typename _Deployment, typename... _Types>
+ TypeOutputStream &writeType(const Variant<_Types...> &_value, const _Deployment *_depl) {
+ if (_depl != nullptr && _depl->isFreeDesktop_) {
+ signature_.append("v");
+ } else {
+ signature_.append("(yv)");
+ }
+ TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(*this);
+ ApplyVoidVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
+ Variant<_Types...>, _Types...>::visit(typeVisitor, _value);
+ return (*this);
+ }
+
+ template<typename _ElementType>
+ TypeOutputStream &writeType(const std::vector<_ElementType> &_value) {
+ signature_.append("a");
+ return (*this);
+ }
+
+ template<typename _KeyType, typename _ValueType, typename _HasherType>
+ TypeOutputStream &writeType(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value) {
+ signature_.append("a{");
+ _KeyType dummyKey;
+ writeType(dummyKey);
+ _ValueType dummyValue;
+ writeType(dummyValue);
+ signature_.append("}");
+ return (*this);
+ }
+
+ inline std::string getSignature() {
+ return std::move(signature_);
+ }
+
+private:
+ std::string signature_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSTYPEOUTPUTSTREAM_HPP_
diff --git a/include/CommonAPI/DBus/DBusTypes.hpp b/include/CommonAPI/DBus/DBusTypes.hpp
new file mode 100644
index 0000000..4c723c4
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusTypes.hpp
@@ -0,0 +1,37 @@
+// 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/.
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef COMMONAPI_DBUS_DBUSTYPES_HPP_
+#define COMMONAPI_DBUS_DBUSTYPES_HPP_
+
+#include <string>
+#include <unordered_map>
+
+#include <dbus/dbus.h>
+
+namespace CommonAPI {
+namespace DBus {
+
+typedef std::unordered_map<std::string, bool> DBusPropertiesChangedDict;
+typedef std::unordered_map<std::string,
+ DBusPropertiesChangedDict> DBusInterfacesAndPropertiesDict;
+typedef std::unordered_map<std::string,
+ DBusInterfacesAndPropertiesDict> DBusObjectPathAndInterfacesDict;
+
+enum class DBusType_t {
+ SESSION = DBUS_BUS_SESSION,
+ SYSTEM = DBUS_BUS_SYSTEM,
+ STARTER = DBUS_BUS_STARTER,
+ WRAPPED
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUSTYPES_HPP_
diff --git a/src/CommonAPI/DBus/DBusUtils.h b/include/CommonAPI/DBus/DBusUtils.hpp
index 3b74ef5..ba8826d 100644
--- a/src/CommonAPI/DBus/DBusUtils.h
+++ b/include/CommonAPI/DBus/DBusUtils.hpp
@@ -1,16 +1,14 @@
-/* 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/.
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
+#error "Only <CommonAPI/CommonAPI.hpp> can be included directly, this file may disappear or change contents."
#endif
-#ifndef DBUSUTILS_H_
-#define DBUSUTILS_H_
+#ifndef COMMONAPI_DBUS_DBUSUTILS_HPP_
+#define COMMONAPI_DBUS_DBUSUTILS_HPP_
#include <future>
@@ -33,7 +31,7 @@ inline bool checkReady<std::future_status>(std::future_status& returnedValue) {
return returnedValue == std::future_status::ready;
}
-} //namespace DBus
-} //namespace CommonAPI
+} // namespace DBus
+} // namespace CommonAPI
-#endif /* DBUSUTILS_H_ */
+#endif // COMMONAPI_DBUS_DBUSUTILS_HPP_
diff --git a/src/murmurhash/MurmurHash3.h b/include/murmurhash/MurmurHash3.h
index 54e9d3f..54e9d3f 100644
--- a/src/murmurhash/MurmurHash3.h
+++ b/include/murmurhash/MurmurHash3.h
diff --git a/src/pugixml/pugiconfig.hpp b/include/pugixml/pugiconfig.hpp
index 5a63fd4..5a63fd4 100644
--- a/src/pugixml/pugiconfig.hpp
+++ b/include/pugixml/pugiconfig.hpp
diff --git a/src/pugixml/pugixml.hpp b/include/pugixml/pugixml.hpp
index 77b4dcf..77b4dcf 100644
--- a/src/pugixml/pugixml.hpp
+++ b/include/pugixml/pugixml.hpp
diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4
deleted file mode 100644
index 0d96c07..0000000
--- a/m4/ax_cxx_compile_stdcxx_11.m4
+++ /dev/null
@@ -1,107 +0,0 @@
-# ============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
-# ============================================================================
-#
-# SYNOPSIS
-#
-# AX_CXX_COMPILE_STDCXX_11([ext|noext])
-#
-# DESCRIPTION
-#
-# Check for baseline language coverage in the compiler for the C++11
-# standard; if necessary, add switches to CXXFLAGS to enable support.
-# Errors out if no mode that supports C++11 baseline syntax can be found.
-# The argument, if specified, indicates whether you insist on an extended
-# mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11).
-# If neither is specified, you get whatever works, with preference for an
-# extended mode.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 1
-
-m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
- template <typename T>
- struct check
- {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };
-
- typedef check<check<bool>> right_angle_brackets;
-
- int a;
- decltype(a) b;
-
- typedef check<int> check_type;
- check_type c;
- check_type&& cr = static_cast<check_type&&>(c);
-])
-
-AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
- m4_if([$1], [], [],
- [$1], [ext], [],
- [$1], [noext], [],
- [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
- AC_LANG_ASSERT([C++])dnl
- ac_success=no
- AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
- ax_cv_cxx_compile_cxx11,
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [ax_cv_cxx_compile_cxx11=yes],
- [ax_cv_cxx_compile_cxx11=no])])
- if test x$ax_cv_cxx_compile_cxx11 = xyes; then
- ac_success=yes
- fi
-
- m4_if([$1], [noext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=gnu++11 -std=gnu++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- m4_if([$1], [ext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=c++11 -std=c++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- if test x$ac_success = xno; then
- AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
- fi
-])
diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
deleted file mode 100644
index 44b22b0..0000000
--- a/m4/ax_prog_doxygen.m4
+++ /dev/null
@@ -1,532 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# DX_INIT_DOXYGEN(PROJECT-NAME, DOXYFILE-PATH, [OUTPUT-DIR])
-# DX_DOXYGEN_FEATURE(ON|OFF)
-# DX_DOT_FEATURE(ON|OFF)
-# DX_HTML_FEATURE(ON|OFF)
-# DX_CHM_FEATURE(ON|OFF)
-# DX_CHI_FEATURE(ON|OFF)
-# DX_MAN_FEATURE(ON|OFF)
-# DX_RTF_FEATURE(ON|OFF)
-# DX_XML_FEATURE(ON|OFF)
-# DX_PDF_FEATURE(ON|OFF)
-# DX_PS_FEATURE(ON|OFF)
-#
-# DESCRIPTION
-#
-# The DX_*_FEATURE macros control the default setting for the given
-# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
-# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
-# help (for MS users), 'CHI' for generating a seperate .chi file by the
-# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
-# output formats. The environment variable DOXYGEN_PAPER_SIZE may be
-# specified to override the default 'a4wide' paper size.
-#
-# By default, HTML, PDF and PS documentation is generated as this seems to
-# be the most popular and portable combination. MAN pages created by
-# Doxygen are usually problematic, though by picking an appropriate subset
-# and doing some massaging they might be better than nothing. CHM and RTF
-# are specific for MS (note that you can't generate both HTML and CHM at
-# the same time). The XML is rather useless unless you apply specialized
-# post-processing to it.
-#
-# The macros mainly control the default state of the feature. The use can
-# override the default by specifying --enable or --disable. The macros
-# ensure that contradictory flags are not given (e.g.,
-# --enable-doxygen-html and --enable-doxygen-chm,
-# --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each
-# feature will be automatically disabled (with a warning) if the required
-# programs are missing.
-#
-# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN
-# with the following parameters: a one-word name for the project for use
-# as a filename base etc., an optional configuration file name (the
-# default is 'Doxyfile', the same as Doxygen's default), and an optional
-# output directory name (the default is 'doxygen-doc').
-#
-# Automake Support
-#
-# The following is a template aminclude.am file for use with Automake.
-# Make targets and variables values are controlled by the various
-# DX_COND_* conditionals set by autoconf.
-#
-# The provided targets are:
-#
-# doxygen-doc: Generate all doxygen documentation.
-#
-# doxygen-run: Run doxygen, which will generate some of the
-# documentation (HTML, CHM, CHI, MAN, RTF, XML)
-# but will not do the post processing required
-# for the rest of it (PS, PDF, and some MAN).
-#
-# doxygen-man: Rename some doxygen generated man pages.
-#
-# doxygen-ps: Generate doxygen PostScript documentation.
-#
-# doxygen-pdf: Generate doxygen PDF documentation.
-#
-# Note that by default these are not integrated into the automake targets.
-# If doxygen is used to generate man pages, you can achieve this
-# integration by setting man3_MANS to the list of man pages generated and
-# then adding the dependency:
-#
-# $(man3_MANS): doxygen-doc
-#
-# This will cause make to run doxygen and generate all the documentation.
-#
-# The following variable is intended for use in Makefile.am:
-#
-# DX_CLEANFILES = everything to clean.
-#
-# Then add this variable to MOSTLYCLEANFILES.
-#
-# ----- begin aminclude.am -------------------------------------
-#
-# ## --------------------------------- ##
-# ## Format-independent Doxygen rules. ##
-# ## --------------------------------- ##
-#
-# if DX_COND_doc
-#
-# ## ------------------------------- ##
-# ## Rules specific for HTML output. ##
-# ## ------------------------------- ##
-#
-# if DX_COND_html
-#
-# DX_CLEAN_HTML = @DX_DOCDIR@/html
-#
-# endif DX_COND_html
-#
-# ## ------------------------------ ##
-# ## Rules specific for CHM output. ##
-# ## ------------------------------ ##
-#
-# if DX_COND_chm
-#
-# DX_CLEAN_CHM = @DX_DOCDIR@/chm
-#
-# if DX_COND_chi
-#
-# DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
-#
-# endif DX_COND_chi
-#
-# endif DX_COND_chm
-#
-# ## ------------------------------ ##
-# ## Rules specific for MAN output. ##
-# ## ------------------------------ ##
-#
-# if DX_COND_man
-#
-# DX_CLEAN_MAN = @DX_DOCDIR@/man
-#
-# endif DX_COND_man
-#
-# ## ------------------------------ ##
-# ## Rules specific for RTF output. ##
-# ## ------------------------------ ##
-#
-# if DX_COND_rtf
-#
-# DX_CLEAN_RTF = @DX_DOCDIR@/rtf
-#
-# endif DX_COND_rtf
-#
-# ## ------------------------------ ##
-# ## Rules specific for XML output. ##
-# ## ------------------------------ ##
-#
-# if DX_COND_xml
-#
-# DX_CLEAN_XML = @DX_DOCDIR@/xml
-#
-# endif DX_COND_xml
-#
-# ## ----------------------------- ##
-# ## Rules specific for PS output. ##
-# ## ----------------------------- ##
-#
-# if DX_COND_ps
-#
-# DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
-#
-# DX_PS_GOAL = doxygen-ps
-#
-# doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
-#
-# @DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
-# cd @DX_DOCDIR@/latex; \
-# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
-# $(DX_LATEX) refman.tex; \
-# $(MAKEINDEX_PATH) refman.idx; \
-# $(DX_LATEX) refman.tex; \
-# countdown=5; \
-# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
-# refman.log > /dev/null 2>&1 \
-# && test $$countdown -gt 0; do \
-# $(DX_LATEX) refman.tex; \
-# countdown=`expr $$countdown - 1`; \
-# done; \
-# $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
-#
-# endif DX_COND_ps
-#
-# ## ------------------------------ ##
-# ## Rules specific for PDF output. ##
-# ## ------------------------------ ##
-#
-# if DX_COND_pdf
-#
-# DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
-#
-# DX_PDF_GOAL = doxygen-pdf
-#
-# doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
-#
-# @DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
-# cd @DX_DOCDIR@/latex; \
-# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
-# $(DX_PDFLATEX) refman.tex; \
-# $(DX_MAKEINDEX) refman.idx; \
-# $(DX_PDFLATEX) refman.tex; \
-# countdown=5; \
-# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
-# refman.log > /dev/null 2>&1 \
-# && test $$countdown -gt 0; do \
-# $(DX_PDFLATEX) refman.tex; \
-# countdown=`expr $$countdown - 1`; \
-# done; \
-# mv refman.pdf ../@PACKAGE@.pdf
-#
-# endif DX_COND_pdf
-#
-# ## ------------------------------------------------- ##
-# ## Rules specific for LaTeX (shared for PS and PDF). ##
-# ## ------------------------------------------------- ##
-#
-# if DX_COND_latex
-#
-# DX_CLEAN_LATEX = @DX_DOCDIR@/latex
-#
-# endif DX_COND_latex
-#
-# .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
-#
-# .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-#
-# doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
-#
-# doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-#
-# @DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
-# rm -rf @DX_DOCDIR@
-# $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
-#
-# DX_CLEANFILES = \
-# @DX_DOCDIR@/@PACKAGE@.tag \
-# -r \
-# $(DX_CLEAN_HTML) \
-# $(DX_CLEAN_CHM) \
-# $(DX_CLEAN_CHI) \
-# $(DX_CLEAN_MAN) \
-# $(DX_CLEAN_RTF) \
-# $(DX_CLEAN_XML) \
-# $(DX_CLEAN_PS) \
-# $(DX_CLEAN_PDF) \
-# $(DX_CLEAN_LATEX)
-#
-# endif DX_COND_doc
-#
-# ----- end aminclude.am ---------------------------------------
-#
-# LICENSE
-#
-# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 12
-
-## ----------##
-## Defaults. ##
-## ----------##
-
-DX_ENV=""
-AC_DEFUN([DX_FEATURE_doc], ON)
-AC_DEFUN([DX_FEATURE_dot], OFF)
-AC_DEFUN([DX_FEATURE_man], OFF)
-AC_DEFUN([DX_FEATURE_html], ON)
-AC_DEFUN([DX_FEATURE_chm], OFF)
-AC_DEFUN([DX_FEATURE_chi], OFF)
-AC_DEFUN([DX_FEATURE_rtf], OFF)
-AC_DEFUN([DX_FEATURE_xml], OFF)
-AC_DEFUN([DX_FEATURE_pdf], ON)
-AC_DEFUN([DX_FEATURE_ps], ON)
-
-## --------------- ##
-## Private macros. ##
-## --------------- ##
-
-# DX_ENV_APPEND(VARIABLE, VALUE)
-# ------------------------------
-# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
-AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
-
-# DX_DIRNAME_EXPR
-# ---------------
-# Expand into a shell expression prints the directory part of a path.
-AC_DEFUN([DX_DIRNAME_EXPR],
- [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
-
-# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
-# -------------------------------------
-# Expands according to the M4 (static) status of the feature.
-AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
-
-# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
-# ----------------------------------
-# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
-AC_DEFUN([DX_REQUIRE_PROG], [
-AC_PATH_TOOL([$1], [$2])
-if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
- AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
- AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
-fi
-])
-
-# DX_TEST_FEATURE(FEATURE)
-# ------------------------
-# Expand to a shell expression testing whether the feature is active.
-AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
-
-# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
-# -------------------------------------------------
-# Verify that a required features has the right state before trying to turn on
-# the DX_CURRENT_FEATURE.
-AC_DEFUN([DX_CHECK_DEPEND], [
-test "$DX_FLAG_$1" = "$2" \
-|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
- requires, contradicts) doxygen-DX_CURRENT_FEATURE])
-])
-
-# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
-# ----------------------------------------------------------
-# Turn off the DX_CURRENT_FEATURE if the required feature is off.
-AC_DEFUN([DX_CLEAR_DEPEND], [
-test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
-])
-
-# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
-# CHECK_DEPEND, CLEAR_DEPEND,
-# REQUIRE, DO-IF-ON, DO-IF-OFF)
-# --------------------------------------------
-# Parse the command-line option controlling a feature. CHECK_DEPEND is called
-# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
-# otherwise CLEAR_DEPEND is called to turn off the default state if a required
-# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
-# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
-# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
-AC_DEFUN([DX_ARG_ABLE], [
- AC_DEFUN([DX_CURRENT_FEATURE], [$1])
- AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
- AC_ARG_ENABLE(doxygen-$1,
- [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
- [--enable-doxygen-$1]),
- DX_IF_FEATURE([$1], [don't $2], [$2]))],
- [
-case "$enableval" in
-#(
-y|Y|yes|Yes|YES)
- AC_SUBST([DX_FLAG_$1], 1)
- $3
-;; #(
-n|N|no|No|NO)
- AC_SUBST([DX_FLAG_$1], 0)
-;; #(
-*)
- AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
-;;
-esac
-], [
-AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
-$4
-])
-if DX_TEST_FEATURE([$1]); then
- $5
- :
-fi
-AM_CONDITIONAL(DX_COND_$1, DX_TEST_FEATURE([$1]))
-if DX_TEST_FEATURE([$1]); then
- $6
- :
-else
- $7
- :
-fi
-])
-
-## -------------- ##
-## Public macros. ##
-## -------------- ##
-
-# DX_XXX_FEATURE(DEFAULT_STATE)
-# -----------------------------
-AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
-AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])])
-AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
-AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
-AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
-AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
-AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
-AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
-
-# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
-# ---------------------------------------------------------
-# PROJECT also serves as the base name for the documentation files.
-# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
-AC_DEFUN([DX_INIT_DOXYGEN], [
-
-# Files:
-AC_SUBST([DX_PROJECT], [$1])
-AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
-AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
-
-# Environment variables used inside doxygen.cfg:
-DX_ENV_APPEND(SRCDIR, $srcdir)
-DX_ENV_APPEND(PROJECT, $DX_PROJECT)
-DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
-DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
-
-# Doxygen itself:
-DX_ARG_ABLE(doc, [generate any doxygen documentation],
- [],
- [],
- [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
- DX_REQUIRE_PROG([DX_PERL], perl)],
- [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
-
-# Dot for graphics:
-DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_DOT], dot)],
- [DX_ENV_APPEND(HAVE_DOT, YES)
- DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
- [DX_ENV_APPEND(HAVE_DOT, NO)])
-
-# Man pages generation:
-DX_ARG_ABLE(man, [generate doxygen manual pages],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_MAN, YES)],
- [DX_ENV_APPEND(GENERATE_MAN, NO)])
-
-# RTF file generation:
-DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_RTF, YES)],
- [DX_ENV_APPEND(GENERATE_RTF, NO)])
-
-# XML file generation:
-DX_ARG_ABLE(xml, [generate doxygen XML documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_XML, YES)],
- [DX_ENV_APPEND(GENERATE_XML, NO)])
-
-# (Compressed) HTML help generation:
-DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_HHC], hhc)],
- [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
- DX_ENV_APPEND(GENERATE_HTML, YES)
- DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
- [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
-
-# Seperate CHI file generation.
-DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
- [DX_CHECK_DEPEND(chm, 1)],
- [DX_CLEAR_DEPEND(chm, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_CHI, YES)],
- [DX_ENV_APPEND(GENERATE_CHI, NO)])
-
-# Plain HTML pages generation:
-DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
- [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
- [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
- [],
- [DX_ENV_APPEND(GENERATE_HTML, YES)],
- [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
-
-# PostScript file generation:
-DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_LATEX], latex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_DVIPS], dvips)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# PDF file generation:
-DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# LaTeX generation for PS and/or PDF:
-AM_CONDITIONAL(DX_COND_latex, DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf))
-if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
- DX_ENV_APPEND(GENERATE_LATEX, YES)
-else
- DX_ENV_APPEND(GENERATE_LATEX, NO)
-fi
-
-# Paper size for PS and/or PDF:
-AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
- [a4wide (default), a4, letter, legal or executive])
-case "$DOXYGEN_PAPER_SIZE" in
-#(
-"")
- AC_SUBST(DOXYGEN_PAPER_SIZE, "")
-;; #(
-a4wide|a4|letter|legal|executive)
- DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
-;; #(
-*)
- AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
-;;
-esac
-
-#For debugging:
-#echo DX_FLAG_doc=$DX_FLAG_doc
-#echo DX_FLAG_dot=$DX_FLAG_dot
-#echo DX_FLAG_man=$DX_FLAG_man
-#echo DX_FLAG_html=$DX_FLAG_html
-#echo DX_FLAG_chm=$DX_FLAG_chm
-#echo DX_FLAG_chi=$DX_FLAG_chi
-#echo DX_FLAG_rtf=$DX_FLAG_rtf
-#echo DX_FLAG_xml=$DX_FLAG_xml
-#echo DX_FLAG_pdf=$DX_FLAG_pdf
-#echo DX_FLAG_ps=$DX_FLAG_ps
-#echo DX_ENV=$DX_ENV
-])
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/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/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/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/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/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/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/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/dbus-DBusMessage-add-support-for-custom-marshaling.patch b/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
index 5f225f3..78b073c 100644
--- a/dbus-DBusMessage-add-support-for-custom-marshaling.patch
+++ b/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
@@ -1,75 +1,23 @@
-From 467a2e307462b02865b35397c572b6048c2934e2 Mon Sep 17 00:00:00 2001
-From: Aleksandar Kanchev <kanchev@itestra.com>
-Date: Mon, 9 Jul 2012 18:09:04 +0200
-Subject: [PATCH] DBusMessage: add support for custom marshaling
+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.
-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 | 143 +++++++++++++++++++++++++++++++++++----------------
- dbus/dbus-message.h | 13 +++++
- dbus/dbus-string.c | 16 ++++++
- dbus/dbus-string.h | 4 ++
- 4 files changed, 132 insertions(+), 44 deletions(-)
+ 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 24ef5ac..fbacfba 100644
+index 43cb1be..d34663a 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
-@@ -356,50 +356,6 @@ set_or_delete_string_field (DBusMessage *message,
- &value);
- }
-
--#if 0
--/* Probably we don't need to use this */
--/**
-- * 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
-- */
--static 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));
-- /* 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);
--
-- return set_or_delete_string_field (message,
-- DBUS_HEADER_FIELD_SIGNATURE,
-- DBUS_TYPE_SIGNATURE,
-- signature);
--}
--#endif
--
- /* Message Cache
- *
- * We cache some DBusMessage to reduce the overhead of allocating
-@@ -3370,6 +3326,47 @@ dbus_message_get_sender (DBusMessage *message)
+@@ -3445,6 +3445,47 @@ dbus_message_get_sender (DBusMessage *message)
}
/**
@@ -117,7 +65,7 @@ index 24ef5ac..fbacfba 100644
* 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
-@@ -4519,6 +4516,64 @@ dbus_message_type_to_string (int type)
+@@ -4632,6 +4673,64 @@ dbus_message_type_to_string (int type)
}
/**
@@ -183,7 +131,7 @@ index 24ef5ac..fbacfba 100644
* specification.
*
diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h
-index 5500492..55388ac 100644
+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,
@@ -196,28 +144,29 @@ index 5500492..55388ac 100644
const char* dbus_message_get_signature (DBusMessage *message);
DBUS_EXPORT
void dbus_message_set_no_reply (DBusMessage *message,
-@@ -264,6 +267,16 @@ void dbus_message_iter_abandon_container (DBusMessageIter *iter,
- DBusMessageIter *sub);
-
+@@ -262,6 +265,17 @@ dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter,
DBUS_EXPORT
-+char* dbus_message_get_body (DBusMessage *message);
+ void dbus_message_iter_abandon_container (DBusMessageIter *iter,
+ DBusMessageIter *sub);
+DBUS_EXPORT
-+dbus_bool_t dbus_message_set_body_length (DBusMessage *message,
-+ int length);
++char* dbus_message_get_body (DBusMessage *message);
++
+DBUS_EXPORT
-+int dbus_message_get_body_length (DBusMessage *message);
++dbus_bool_t dbus_message_set_body_length (DBusMessage *message,
++ int length);
+DBUS_EXPORT
-+int dbus_message_get_body_allocated (DBusMessage *message);
++int dbus_message_get_body_length (DBusMessage *message);
+
+DBUS_EXPORT
- void dbus_message_lock (DBusMessage *message);
++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 e2eb93b..d8628ba 100644
+index 0f63612..a084eca 100644
--- a/dbus/dbus-string.c
+++ b/dbus/dbus-string.c
-@@ -848,6 +848,22 @@ _dbus_string_get_length (const DBusString *str)
+@@ -730,6 +730,22 @@ _dbus_string_get_length (const DBusString *str)
}
#endif /* !_dbus_string_get_length */
@@ -241,10 +190,10 @@ index e2eb93b..d8628ba 100644
* 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 2f1ed31..490aea6 100644
+index 86fb8c3..bfa2a39 100644
--- a/dbus/dbus-string.h
+++ b/dbus/dbus-string.h
-@@ -62,6 +62,7 @@ struct DBusString
+@@ -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)
@@ -252,16 +201,17 @@ index 2f1ed31..490aea6 100644
#define _dbus_string_set_byte(s, i, b) ((((unsigned char*)(((DBusString*)(s))->dummy1))[(i)]) = (unsigned char) (b))
#define _dbus_string_get_byte(s, i) (((const unsigned char*)(((DBusString*)(s))->dummy1))[(i)])
#define _dbus_string_get_const_data(s) ((const char*)(((DBusString*)(s))->dummy1))
-@@ -131,6 +132,9 @@ void _dbus_string_copy_to_buffer_with_nul (const DBusString *str,
- #ifndef _dbus_string_get_length
+@@ -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.7.10.2
+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/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/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 {