diff options
Diffstat (limited to 'src/test/commonapi')
61 files changed, 1233 insertions, 1348 deletions
diff --git a/src/test/commonapi/tests/DerivedTypeCollection.cpp b/src/test/commonapi/tests/DerivedTypeCollection.cpp index ff24fa3..1e80e6e 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.cpp +++ b/src/test/commonapi/tests/DerivedTypeCollection.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -169,6 +169,7 @@ void TestExtendedPolymorphicStruct::writeToOutputStream(CommonAPI::OutputStream& outputStream << additionalValue; } + StructWithPolymorphicMember::StructWithPolymorphicMember(const uint32_t& numberValueValue, const std::shared_ptr<TestPolymorphicStruct>& polymorphicMemberValue): numberValue(numberValueValue), polymorphicMember(polymorphicMemberValue) @@ -196,8 +197,7 @@ void StructWithPolymorphicMember::writeToOutputStream(CommonAPI::OutputStream& o outputStream << polymorphicMember; } -StructWithEnumKeyMap::StructWithEnumKeyMap(const uint32_t& numberValueValue, const TestEnumMap& testMapValue): - numberValue(numberValueValue), +StructWithEnumKeyMap::StructWithEnumKeyMap(const TestEnumMap& testMapValue): testMap(testMapValue) { } @@ -208,18 +208,15 @@ bool operator==(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs return true; return - lhs.numberValue == rhs.numberValue && lhs.testMap == rhs.testMap ; } void StructWithEnumKeyMap::readFromInputStream(CommonAPI::InputStream& inputStream) { - inputStream >> numberValue; inputStream >> testMap; } void StructWithEnumKeyMap::writeToOutputStream(CommonAPI::OutputStream& outputStream) const { - outputStream << numberValue; outputStream << testMap; } diff --git a/src/test/commonapi/tests/DerivedTypeCollection.h b/src/test/commonapi/tests/DerivedTypeCollection.h index 6f8d196..25d17ee 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.h +++ b/src/test/commonapi/tests/DerivedTypeCollection.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -207,18 +207,16 @@ namespace DerivedTypeCollection { } }; struct StructWithEnumKeyMap: CommonAPI::SerializableStruct { - uint32_t numberValue; TestEnumMap testMap; StructWithEnumKeyMap() = default; - StructWithEnumKeyMap(const uint32_t& numberValue, const TestEnumMap& testMap); + StructWithEnumKeyMap(const TestEnumMap& testMap); virtual void readFromInputStream(CommonAPI::InputStream& inputStream); virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const; static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) { - typeOutputStream.writeUInt32Type(); typeOutputStream.beginWriteMapType(); typeOutputStream.writeInt32Type(); typeOutputStream.writeStringType(); diff --git a/src/test/commonapi/tests/ExtendedInterface.h b/src/test/commonapi/tests/ExtendedInterface.h index 0febbfd..be064ba 100644 --- a/src/test/commonapi/tests/ExtendedInterface.h +++ b/src/test/commonapi/tests/ExtendedInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -53,7 +53,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types } diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp index 7daf324..18691c8 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -53,7 +53,7 @@ void ExtendedInterfaceDBusProxy::TestIntMethodExtended(const uint32_t& inInt, Co *this, "TestIntMethodExtended", "u", - inInt, + inInt, callStatus ); } diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h index aa6329c..4349339 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -11,10 +11,8 @@ #define COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_ #include <commonapi/tests/ExtendedInterfaceProxyBase.h> - #include <commonapi/tests/TestInterfaceDBusProxy.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -45,13 +43,13 @@ class ExtendedInterfaceDBusProxy: virtual public ExtendedInterfaceProxyBase, vir virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus); virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + }; diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp index 6a3cb8c..83b7042 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp @@ -1,104 +1,122 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "ExtendedInterfaceDBusStubAdapter.h" - #include <commonapi/tests/ExtendedInterface.h> - - namespace commonapi { - namespace tests { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<ExtendedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerExtendedInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(ExtendedInterface::getInterfaceId(), - &createExtendedInterfaceDBusStubAdapter); - } - - - - ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - ExtendedInterfaceDBusStubAdapterHelper::deinit(); - ExtendedInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void ExtendedInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - std::string(TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) + - "<method name=\"TestIntMethodExtended\">\n" - "<arg name=\"inInt\" type=\"u\" direction=\"in\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - ExtendedInterfaceStub, - std::tuple<uint32_t>, - std::tuple<> - > testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, ""); - - - - const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& ExtendedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - ExtendedInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<ExtendedInterfaceStub>(stub), - false), - TestInterfaceDBusStubAdapterInternal( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - stub), - stubDispatcherTable_({ - { { "TestIntMethodExtended", "u" }, &commonapi::tests::testIntMethodExtendedStubDispatcher } - }) { - - auto parentDispatcherTable = TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable(); - stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end()); - } - - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "ExtendedInterfaceDBusStubAdapter.h" +#include <commonapi/tests/ExtendedInterface.h> + +namespace commonapi { +namespace tests { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<ExtendedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerExtendedInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(ExtendedInterface::getInterfaceId(), + &createExtendedInterfaceDBusStubAdapter); +} + + + +ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + ExtendedInterfaceDBusStubAdapterHelper::deinit(); + ExtendedInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void ExtendedInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { +} + +const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + std::string(TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) + + "<method name=\"TestIntMethodExtended\">\n" + "<arg name=\"inInt\" type=\"u\" direction=\"in\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + CommonAPI::Version + > getExtendedInterfaceInterfaceVersionStubDispatcher(&ExtendedInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t>, + std::tuple<> + > testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, ""); + + + +const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& ExtendedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + ExtendedInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<ExtendedInterfaceStub>(stub), + false), + TestInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub), + stubDispatcherTable_({ + { { "TestIntMethodExtended", "u" }, &commonapi::tests::testIntMethodExtendedStubDispatcher } + }) { + + auto parentDispatcherTable = TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable(); + stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end()); + + auto interfaceVersionGetter = stubDispatcherTable_.find({ "getInterfaceVersion", "" }); + if(interfaceVersionGetter != stubDispatcherTable_.end()) { + interfaceVersionGetter->second = &commonapi::tests::getExtendedInterfaceInterfaceVersionStubDispatcher; + } else { + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::getExtendedInterfaceInterfaceVersionStubDispatcher }); + } +} + +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h index a708e03..4765d81 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -11,7 +11,6 @@ #define COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_H_ #include <commonapi/tests/ExtendedInterfaceStub.h> - #include <commonapi/tests/TestInterfaceDBusStubAdapter.h> #if !defined (COMMONAPI_INTERNAL_COMPILATION) @@ -44,12 +43,12 @@ class ExtendedInterfaceDBusStubAdapterInternal: public ExtendedInterfaceStubAdap ~ExtendedInterfaceDBusStubAdapterInternal(); - + const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + virtual const std::string getAddress() const { return DBusStubAdapter::getAddress(); } @@ -70,7 +69,6 @@ class ExtendedInterfaceDBusStubAdapterInternal: public ExtendedInterfaceStubAdap return DBusStubAdapter::init(instance); } - virtual void deinit() { return DBusStubAdapter::deinit(); } diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxy.h b/src/test/commonapi/tests/ExtendedInterfaceProxy.h index d2c79a5..161eee4 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceProxy.h +++ b/src/test/commonapi/tests/ExtendedInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -31,9 +31,9 @@ class ExtendedInterfaceProxy: virtual public ExtendedInterface, virtual public E public: ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~ExtendedInterfaceProxy(); - + typedef ExtendedInterface InterfaceType; - + inline static const char* getInterfaceId() { return(ExtendedInterface::getInterfaceId()); } @@ -60,7 +60,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback); - + /** * Returns the CommonAPI address of the remote partner this proxy communicates with. @@ -173,7 +173,6 @@ CommonAPI::InterfaceVersionAttribute& ExtendedInterfaceProxy<_AttributeExtension return delegate_->getInterfaceVersionAttribute(); } - } // namespace tests } // namespace commonapi diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h b/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h index 0cf2e50..a309fb7 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h +++ b/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -11,7 +11,6 @@ #define COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_ #include "ExtendedInterface.h" - #include "TestInterfaceProxyBase.h" diff --git a/src/test/commonapi/tests/ExtendedInterfaceStub.h b/src/test/commonapi/tests/ExtendedInterfaceStub.h index a4f96ea..5d2e791 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStub.h +++ b/src/test/commonapi/tests/ExtendedInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -38,10 +38,9 @@ namespace tests { class ExtendedInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public ExtendedInterface { public: - - + + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -78,16 +77,15 @@ class ExtendedInterfaceStubRemoteEvent { class ExtendedInterfaceStub : public virtual CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>, public virtual TestInterfaceStub { public: virtual ~ExtendedInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method TestIntMethodExtended. virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt) = 0; - - + using CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace tests diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp index 4c5a179..9561418 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,12 @@ namespace commonapi { namespace tests { ExtendedInterfaceStubDefault::ExtendedInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(ExtendedInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& ExtendedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h index 5a0124e..38699b5 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,12 +34,14 @@ public: ExtendedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt); virtual void TestIntMethodExtended(uint32_t inInt); - + protected: private: @@ -54,6 +56,8 @@ private: RemoteEventHandler remoteEventHandler_; + + CommonAPI::Version interfaceVersion_; }; } // namespace tests diff --git a/src/test/commonapi/tests/PredefinedTypeCollection.h b/src/test/commonapi/tests/PredefinedTypeCollection.h index 4e991f2..bc26018 100644 --- a/src/test/commonapi/tests/PredefinedTypeCollection.h +++ b/src/test/commonapi/tests/PredefinedTypeCollection.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * diff --git a/src/test/commonapi/tests/TestInterface.h b/src/test/commonapi/tests/TestInterface.h index 289ec84..6603d3a 100644 --- a/src/test/commonapi/tests/TestInterface.h +++ b/src/test/commonapi/tests/TestInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -52,7 +52,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types } diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp index 95169d9..ef1ca6f 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -87,7 +87,7 @@ void TestInterfaceDBusProxy::testVoidPredefinedTypeMethod(const uint32_t& uint32 *this, "testVoidPredefinedTypeMethod", "us", - uint32Value, stringValue, + uint32Value, stringValue, callStatus ); } @@ -106,7 +106,7 @@ void TestInterfaceDBusProxy::testPredefinedTypeMethod(const uint32_t& uint32InVa *this, "testPredefinedTypeMethod", "us", - uint32InValue, stringInValue, + uint32InValue, stringInValue, callStatus , uint32OutValue, stringOutValue); } @@ -125,7 +125,7 @@ void TestInterfaceDBusProxy::testVoidDerivedTypeMethod(const DerivedTypeCollecti *this, "testVoidDerivedTypeMethod", "ia{ua(sq)}", - testEnumExtended2Value, testMapValue, + testEnumExtended2Value, testMapValue, callStatus ); } @@ -144,7 +144,7 @@ void TestInterfaceDBusProxy::testDerivedTypeMethod(const DerivedTypeCollection:: *this, "testDerivedTypeMethod", "ia{ua(sq)}", - testEnumExtended2InValue, testMapInValue, + testEnumExtended2InValue, testMapInValue, callStatus , testEnumExtended2OutValue, testMapOutValue); } @@ -163,7 +163,7 @@ void TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethod(const std::vecto *this, "TestArrayOfPolymorphicStructMethod", "a(uv)", - inArray, + inArray, callStatus ); } @@ -182,7 +182,7 @@ void TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethod(const DerivedTypeC *this, "TestMapOfPolymorphicStructMethod", "a{y(uv)}", - inMap, + inMap, callStatus ); } @@ -201,7 +201,7 @@ void TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethod(const Derived *this, "TestStructWithPolymorphicMemberMethod", "(u(uv))", - inStruct, + inStruct, callStatus ); } @@ -219,8 +219,8 @@ void TestInterfaceDBusProxy::TestStructWithEnumKeyMapMember(const DerivedTypeCol CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply( *this, "TestStructWithEnumKeyMapMember", - "(ua{is})", - inStruct, + "(a{is})", + inStruct, callStatus ); } @@ -229,7 +229,7 @@ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithEnumKey CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync( *this, "TestStructWithEnumKeyMapMember", - "(ua{is})", + "(a{is})", inStruct, std::move(callback)); } diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.h b/src/test/commonapi/tests/TestInterfaceDBusProxy.h index 01bb38a..0f3b72c 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/TestInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -70,7 +68,7 @@ class TestInterfaceDBusProxy: virtual public TestInterfaceProxyBase, virtual pub virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback callback); virtual void TestStructWithEnumKeyMapMember(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, CommonAPI::CallStatus& callStatus); virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; @@ -82,7 +80,7 @@ class TestInterfaceDBusProxy: virtual public TestInterfaceProxyBase, virtual pub CommonAPI::DBus::DBusEvent<TestPredefinedTypeBroadcastEvent> testPredefinedTypeBroadcast_; CommonAPI::DBus::DBusSelectiveEvent<TestSelectiveBroadcastSelectiveEvent> testSelectiveBroadcastSelective_; CommonAPI::DBus::DBusSelectiveEvent<TestBroadcastWithOutArgsSelectiveEvent> testBroadcastWithOutArgsSelective_; - + }; diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp index 230dfc3..f371d5a 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp @@ -1,6 +1,5 @@ -<<<<<<< Upstream, based on origin/master /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -10,66 +9,39 @@ */ #include "TestInterfaceDBusStubAdapter.h" #include <commonapi/tests/TestInterface.h> -======= - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "TestInterfaceDBusStubAdapter.h" - #include <commonapi/tests/TestInterface.h> ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - namespace commonapi { - namespace tests { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - -<<<<<<< Upstream, based on origin/master + +namespace commonapi { +namespace tests { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), &createTestInterfaceDBusStubAdapter); } -TestInterfaceDBusStubAdapter::TestInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - TestInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub), - false) { - subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); - subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); -} -TestInterfaceDBusStubAdapter::~TestInterfaceDBusStubAdapter() { + +TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() { deactivateManagedInstances(); - deinit(); - stub_.reset(); + TestInterfaceDBusStubAdapterHelper::deinit(); + TestInterfaceDBusStubAdapterHelper::stub_.reset(); } -void TestInterfaceDBusStubAdapter::deactivateManagedInstances() { +void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { } -const char* TestInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { - static const char* introspectionData = +const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = "<method name=\"getInterfaceVersion\">\n" "<arg name=\"value\" type=\"uu\" direction=\"out\" />" "</method>\n" @@ -147,157 +119,59 @@ const char* TestInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() c "<method name=\"TestStructWithEnumKeyMapMember\">\n" "<arg name=\"inStruct\" type=\"(a{is})\" direction=\"in\" />\n" "</method>\n" - + ; - return introspectionData; + return introspectionData.c_str(); } -======= - __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), - &createTestInterfaceDBusStubAdapter); - } ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - CommonAPI::Version - > getInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); - - - TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - TestInterfaceDBusStubAdapterHelper::deinit(); - TestInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"getTestPredefinedTypeAttributeAttribute\">\n" - "<arg name=\"value\" type=\"u\" direction=\"out\" />" - "</method>\n" - "<method name=\"setTestPredefinedTypeAttributeAttribute\">\n" - "<arg name=\"requestedValue\" type=\"u\" direction=\"in\" />\n" - "<arg name=\"setValue\" type=\"u\" direction=\"out\" />\n" - "</method>\n" - "<signal name=\"onTestPredefinedTypeAttributeAttributeChanged\">\n" - "<arg name=\"changedValue\" type=\"u\" />\n" - "</signal>\n" - "<method name=\"getTestDerivedStructAttributeAttribute\">\n" - "<arg name=\"value\" type=\"(sqi)\" direction=\"out\" />" - "</method>\n" - "<method name=\"setTestDerivedStructAttributeAttribute\">\n" - "<arg name=\"requestedValue\" type=\"(sqi)\" direction=\"in\" />\n" - "<arg name=\"setValue\" type=\"(sqi)\" direction=\"out\" />\n" - "</method>\n" - "<signal name=\"onTestDerivedStructAttributeAttributeChanged\">\n" - "<arg name=\"changedValue\" type=\"(sqi)\" />\n" - "</signal>\n" - "<method name=\"getTestDerivedArrayAttributeAttribute\">\n" - "<arg name=\"value\" type=\"at\" direction=\"out\" />" - "</method>\n" - "<method name=\"setTestDerivedArrayAttributeAttribute\">\n" - "<arg name=\"requestedValue\" type=\"at\" direction=\"in\" />\n" - "<arg name=\"setValue\" type=\"at\" direction=\"out\" />\n" - "</method>\n" - "<signal name=\"onTestDerivedArrayAttributeAttributeChanged\">\n" - "<arg name=\"changedValue\" type=\"at\" />\n" - "</signal>\n" - "<signal name=\"TestPredefinedTypeBroadcast\">\n" - "<arg name=\"uint32Value\" type=\"u\" />\n" - "<arg name=\"stringValue\" type=\"s\" />\n" - "</signal>\n" - "<signal name=\"TestSelectiveBroadcast\">\n" - "</signal>\n" - "<signal name=\"TestBroadcastWithOutArgs\">\n" - "<arg name=\"uint32Value\" type=\"u\" />\n" - "<arg name=\"stringValue\" type=\"s\" />\n" - "</signal>\n" - "<method name=\"testEmptyMethod\">\n" - "</method>\n" - "<method name=\"testVoidPredefinedTypeMethod\">\n" - "<arg name=\"uint32Value\" type=\"u\" direction=\"in\" />\n" - "<arg name=\"stringValue\" type=\"s\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"testPredefinedTypeMethod\">\n" - "<arg name=\"uint32InValue\" type=\"u\" direction=\"in\" />\n" - "<arg name=\"stringInValue\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"uint32OutValue\" type=\"u\" direction=\"out\" />\n" - "<arg name=\"stringOutValue\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - "<method name=\"testVoidDerivedTypeMethod\">\n" - "<arg name=\"testEnumExtended2Value\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"testMapValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"testDerivedTypeMethod\">\n" - "<arg name=\"testEnumExtended2InValue\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"testMapInValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n" - "<arg name=\"testEnumExtended2OutValue\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"testMapOutValue\" type=\"a{ua(sq)}\" direction=\"out\" />\n" - "</method>\n" - "<method name=\"TestArrayOfPolymorphicStructMethod\">\n" - "<arg name=\"inArray\" type=\"a(uv)\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"TestMapOfPolymorphicStructMethod\">\n" - "<arg name=\"inMap\" type=\"a{y(uv)}\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"TestStructWithPolymorphicMemberMethod\">\n" - "<arg name=\"inStruct\" type=\"(u(uv))\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"TestStructWithEnumKeyMapMember\">\n" - "<arg name=\"inStruct\" type=\"(ua{is})\" direction=\"in\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - uint32_t - > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); - static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - uint32_t - > setTestPredefinedTypeAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, - "u"); - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestStructExtended - > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); - static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestStructExtended - > setTestDerivedStructAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestDerivedStructAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, - "(sqi)"); - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestArrayUInt64 - > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); - static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestArrayUInt64 - > setTestDerivedArrayAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged, - "at"); - - -<<<<<<< Upstream, based on origin/master + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + CommonAPI::Version + > getTestInterfaceInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > setTestPredefinedTypeAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, + "u"); + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > setTestDerivedStructAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestDerivedStructAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, + "(sqi)"); + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > setTestDerivedArrayAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged, + "at"); + + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<>, @@ -343,231 +217,211 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, std::tuple<> > testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); -======= - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<>, - std::tuple<> - > testEmptyMethodStubDispatcher(&TestInterfaceStub::testEmptyMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<uint32_t, std::string>, - std::tuple<> - > testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<uint32_t, std::string>, - std::tuple<uint32_t, std::string> - > testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us"); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, - std::tuple<> - > testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, - std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> - > testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}"); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>, - std::tuple<> - > testArrayOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestArrayOfPolymorphicStructMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::MapIntToPolymorphic>, - std::tuple<> - > testMapOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestMapOfPolymorphicStructMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>, - std::tuple<> - > testStructWithPolymorphicMemberMethodStubDispatcher(&TestInterfaceStub::TestStructWithPolymorphicMemberMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, - std::tuple<> - > testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>> - ::sendSignal( - *this, - "onTestPredefinedTypeAttributeAttributeChanged", - "u", - value - ); - } - void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>> - ::sendSignal( - *this, - "onTestDerivedStructAttributeAttributeChanged", - "(sqi)", - value - ); - } - void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>> - ::sendSignal( - *this, - "onTestDerivedArrayAttributeAttributeChanged", - "at", - value - ); - } - - void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> - ::sendSignal( - *this, - "TestPredefinedTypeBroadcast", - "us", - uint32Value, stringValue - ); - } - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<bool> - > subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); - - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<> - > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); - - - void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); - - if(dbusClientId) - { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>> - ::sendSignal( - dbusClientId->getDBusId(), - *this, - "TestSelectiveBroadcast", - "" - ); - } - } - - void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { - std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; - actualReceiverList = receivers; - - if(receivers == NULL) - actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; - - for (auto clientIdIterator = actualReceiverList->cbegin(); - clientIdIterator != actualReceiverList->cend(); - clientIdIterator++) { - if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { - fireTestSelectiveBroadcastSelective(*clientIdIterator); - } - } - } - - void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { - bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); - if (ok) { - subscribersForTestSelectiveBroadcastSelective_->insert(clientId); - stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); - success = true; - } else { - success = false; - } - } - - - void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestSelectiveBroadcastSelective_->erase(clientId); - stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); - } - - std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() { - return subscribersForTestSelectiveBroadcastSelective_; - } - - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<bool> - > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); - - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<> - > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); - - - void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) { - std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); - - if(dbusClientId) - { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> - ::sendSignal( - dbusClientId->getDBusId(), - *this, - "TestBroadcastWithOutArgs", - "us", - uint32Value, stringValue - ); - } - } - - void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) { - std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; - actualReceiverList = receivers; - - if(receivers == NULL) - actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; - - for (auto clientIdIterator = actualReceiverList->cbegin(); - clientIdIterator != actualReceiverList->cend(); - clientIdIterator++) { - if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { - fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue); - } - } - } - - void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { - bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); - if (ok) { - subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); - stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); - success = true; - } else { - success = false; - } - } - - - void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); - stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); - } - - std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() { - return subscribersForTestBroadcastWithOutArgsSelective_; - } - - -<<<<<<< Upstream, based on origin/master -const TestInterfaceDBusStubAdapter::StubDispatcherTable& TestInterfaceDBusStubAdapter::getStubDispatcherTable() { - static const TestInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { - { { "getInterfaceVersion", "" }, &commonapi::tests::getInterfaceVersionStubDispatcher }, + +void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>> + ::sendSignal( + *this, + "onTestPredefinedTypeAttributeAttributeChanged", + "u", + value + ); +} +void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>> + ::sendSignal( + *this, + "onTestDerivedStructAttributeAttributeChanged", + "(sqi)", + value + ); +} +void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>> + ::sendSignal( + *this, + "onTestDerivedArrayAttributeAttributeChanged", + "at", + value + ); +} + +void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> + ::sendSignal( + *this, + "TestPredefinedTypeBroadcast", + "us", + uint32Value, stringValue + ); +} +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); + + +void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); + + if(dbusClientId) + { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestSelectiveBroadcast", + "" + ); + } +} + +void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { + std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; + actualReceiverList = receivers; + + if(receivers == NULL) + actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; + + for (auto clientIdIterator = actualReceiverList->cbegin(); + clientIdIterator != actualReceiverList->cend(); + clientIdIterator++) { + if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { + fireTestSelectiveBroadcastSelective(*clientIdIterator); + } + } +} + +void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { + bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); + if (ok) { + subscribersForTestSelectiveBroadcastSelective_->insert(clientId); + stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); + success = true; + } else { + success = false; + } +} + + +void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + subscribersForTestSelectiveBroadcastSelective_->erase(clientId); + stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); +} + +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() { + return subscribersForTestSelectiveBroadcastSelective_; +} + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); + + +void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) { + std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); + + if(dbusClientId) + { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestBroadcastWithOutArgs", + "us", + uint32Value, stringValue + ); + } +} + +void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) { + std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; + actualReceiverList = receivers; + + if(receivers == NULL) + actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; + + for (auto clientIdIterator = actualReceiverList->cbegin(); + clientIdIterator != actualReceiverList->cend(); + clientIdIterator++) { + if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { + fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue); + } + } +} + +void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { + bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); + if (ok) { + subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); + stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); + success = true; + } else { + success = false; + } +} + + +void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); + stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); +} + +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() { + return subscribersForTestBroadcastWithOutArgsSelective_; +} + + +const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + TestInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<TestInterfaceStub>(stub), + false), + stubDispatcherTable_({ { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::getTestPredefinedTypeAttributeAttributeStubDispatcher } , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::setTestPredefinedTypeAttributeAttributeStubDispatcher }, { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::getTestDerivedStructAttributeAttributeStubDispatcher } @@ -589,62 +443,12 @@ const TestInterfaceDBusStubAdapter::StubDispatcherTable& TestInterfaceDBusStubAd { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }, { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } - }; - return stubDispatcherTable; + }) { + subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); + subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::getTestInterfaceInterfaceVersionStubDispatcher }); } -======= - const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - TestInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub), - false), - stubDispatcherTable_({ - { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::getTestPredefinedTypeAttributeAttributeStubDispatcher } - , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::setTestPredefinedTypeAttributeAttributeStubDispatcher }, - { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::getTestDerivedStructAttributeAttributeStubDispatcher } - , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::setTestDerivedStructAttributeAttributeStubDispatcher }, - { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::getTestDerivedArrayAttributeAttributeStubDispatcher } - , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::setTestDerivedArrayAttributeAttributeStubDispatcher } - , - { { "testEmptyMethod", "" }, &commonapi::tests::testEmptyMethodStubDispatcher }, - { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::testVoidPredefinedTypeMethodStubDispatcher }, - { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::testPredefinedTypeMethodStubDispatcher }, - { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testVoidDerivedTypeMethodStubDispatcher }, - { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testDerivedTypeMethodStubDispatcher }, - { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::testArrayOfPolymorphicStructMethodStubDispatcher }, - { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::testMapOfPolymorphicStructMethodStubDispatcher }, - { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::testStructWithPolymorphicMemberMethodStubDispatcher }, - { { "TestStructWithEnumKeyMapMember", "(ua{is})" }, &commonapi::tests::testStructWithEnumKeyMapMemberStubDispatcher } - , - { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::subscribeTestSelectiveBroadcastSelectiveStubDispatcher }, - { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, - { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }, - { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } - }) { - subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); - subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - } - - } // namespace tests - } // namespace commonapi + +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h index 4dc2a81..3c549ad 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/TestInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -57,12 +56,12 @@ class TestInterfaceDBusStubAdapterInternal: public TestInterfaceStubAdapter, pub void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success); void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId); std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective(); - + const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/TestInterfaceProxy.h b/src/test/commonapi/tests/TestInterfaceProxy.h index 35cc04f..8499e8e 100644 --- a/src/test/commonapi/tests/TestInterfaceProxy.h +++ b/src/test/commonapi/tests/TestInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -31,9 +31,9 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter public: TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~TestInterfaceProxy(); - + typedef TestInterface InterfaceType; - + /** * Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute. @@ -254,7 +254,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback); - + /** * Returns the CommonAPI address of the remote partner this proxy communicates with. @@ -497,7 +497,6 @@ CommonAPI::InterfaceVersionAttribute& TestInterfaceProxy<_AttributeExtensions... return delegate_->getInterfaceVersionAttribute(); } - } // namespace tests } // namespace commonapi diff --git a/src/test/commonapi/tests/TestInterfaceProxyBase.h b/src/test/commonapi/tests/TestInterfaceProxyBase.h index 139d9d5..32ff725 100644 --- a/src/test/commonapi/tests/TestInterfaceProxyBase.h +++ b/src/test/commonapi/tests/TestInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,6 @@ #include "TestInterface.h" - #include <commonapi/tests/DerivedTypeCollection.h> #include <commonapi/tests/PredefinedTypeCollection.h> diff --git a/src/test/commonapi/tests/TestInterfaceStub.h b/src/test/commonapi/tests/TestInterfaceStub.h index 301102e..735d60b 100644 --- a/src/test/commonapi/tests/TestInterfaceStub.h +++ b/src/test/commonapi/tests/TestInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -74,10 +74,9 @@ class TestInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public Te virtual void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) = 0; virtual void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective() = 0; - - + + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -130,12 +129,9 @@ class TestInterfaceStubRemoteEvent { */ class TestInterfaceStub : public virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent> { public: - TestInterfaceStub(): interfaceVersion_(TestInterface::getInterfaceVersion()) { } virtual ~TestInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { - return interfaceVersion_; - } /// Provides getter access to the attribute TestPredefinedTypeAttribute virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// Provides getter access to the attribute TestDerivedStructAttribute @@ -187,14 +183,10 @@ public: virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) = 0; /// Hook method for reacting accepting or denying new subscriptions virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - - private: - const CommonAPI::Version interfaceVersion_; - + using CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp index e0c2e05..a206cec 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,12 @@ namespace commonapi { namespace tests { TestInterfaceStubDefault::TestInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(TestInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& TestInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } TestInterfaceStubRemoteEvent* TestInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.h b/src/test/commonapi/tests/TestInterfaceStubDefault.h index e119a59..0b1953e 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.h +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -33,6 +33,8 @@ public: TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(); virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId); virtual void setTestPredefinedTypeAttributeAttribute(uint32_t value); @@ -87,7 +89,7 @@ public: virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event); /// Hook method for reacting accepting or denying new subscriptions virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId); - + protected: virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t value); @@ -126,6 +128,8 @@ private: uint32_t testPredefinedTypeAttributeAttributeValue_; DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_; DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_; + + CommonAPI::Version interfaceVersion_; }; } // namespace tests diff --git a/src/test/commonapi/tests/managed/BranchInterface.h b/src/test/commonapi/tests/managed/BranchInterface.h index 385c656..30749ef 100644 --- a/src/test/commonapi/tests/managed/BranchInterface.h +++ b/src/test/commonapi/tests/managed/BranchInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -77,7 +77,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types //Hash for testBranchMethodError template<> diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp index 8c557c5..98a3664 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -47,7 +47,7 @@ void BranchInterfaceDBusProxy::testBranchMethod(const int32_t& inInt, const std: *this, "testBranchMethod", "is", - inInt, inString, + inInt, inString, callStatus, methodError , outInt, outString); diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h index 89d520e..23e17a2 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/BranchInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -45,13 +43,13 @@ class BranchInterfaceDBusProxy: virtual public BranchInterfaceProxyBase, virtual virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + }; diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp index d4c0a62..3c14d6b 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp @@ -1,99 +1,114 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "BranchInterfaceDBusStubAdapter.h" - #include <commonapi/tests/managed/BranchInterface.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), - &createBranchInterfaceDBusStubAdapter); - } - - - - BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - BranchInterfaceDBusStubAdapterHelper::deinit(); - BranchInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void BranchInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"testBranchMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - BranchInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> - > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); - - - - const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& BranchInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - BranchInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<BranchInterfaceStub>(stub), - false), - stubDispatcherTable_({ - { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "BranchInterfaceDBusStubAdapter.h" +#include <commonapi/tests/managed/BranchInterface.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), + &createBranchInterfaceDBusStubAdapter); +} + + + +BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + BranchInterfaceDBusStubAdapterHelper::deinit(); + BranchInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void BranchInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { +} + +const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + "<method name=\"testBranchMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + BranchInterfaceStub, + CommonAPI::Version + > getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + BranchInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> + > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + + + +const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& BranchInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + BranchInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<BranchInterfaceStub>(stub), + false), + stubDispatcherTable_({ + { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getBranchInterfaceInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h index 21e46a2..a7dde87 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/BranchInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,12 +43,12 @@ class BranchInterfaceDBusStubAdapterInternal: public BranchInterfaceStubAdapter, ~BranchInterfaceDBusStubAdapterInternal(); - + const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h index 6517b8d..828c95a 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -30,9 +30,9 @@ class BranchInterfaceProxy: virtual public BranchInterface, virtual public Branc public: BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~BranchInterfaceProxy(); - + typedef BranchInterface InterfaceType; - + @@ -57,7 +57,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback); - + /** * Returns the CommonAPI address of the remote partner this proxy communicates with. @@ -169,7 +169,6 @@ CommonAPI::InterfaceVersionAttribute& BranchInterfaceProxy<_AttributeExtensions. return delegate_->getInterfaceVersionAttribute(); } - } // namespace managed } // namespace tests diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h index d5a61c1..cbfcf74 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -14,7 +14,6 @@ - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStub.h b/src/test/commonapi/tests/managed/BranchInterfaceStub.h index 160312a..c129327 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStub.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -38,10 +38,9 @@ namespace managed { class BranchInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public BranchInterface { public: - - + + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -78,16 +77,15 @@ class BranchInterfaceStubRemoteEvent { class BranchInterfaceStub : public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> { public: virtual ~BranchInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method testBranchMethod. virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) = 0; - - + using CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp index 039c64c..65a807b 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -14,7 +14,12 @@ namespace tests { namespace managed { BranchInterfaceStubDefault::BranchInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(BranchInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& BranchInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h index 90b0787..c191a83 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,12 +34,14 @@ public: BranchInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); virtual void testBranchMethod(int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); - + protected: private: @@ -54,6 +56,8 @@ private: RemoteEventHandler remoteEventHandler_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterface.h b/src/test/commonapi/tests/managed/LeafInterface.h index d3a05cd..45bf376 100644 --- a/src/test/commonapi/tests/managed/LeafInterface.h +++ b/src/test/commonapi/tests/managed/LeafInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -77,7 +77,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types //Hash for testLeafMethodError template<> diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp index 5c163da..da6cef5 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -47,7 +47,7 @@ void LeafInterfaceDBusProxy::testLeafMethod(const int32_t& inInt, const std::str *this, "testLeafMethod", "is", - inInt, inString, + inInt, inString, callStatus, methodError , outInt, outString); diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h index 17fde80..e257805 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/LeafInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -45,13 +43,13 @@ class LeafInterfaceDBusProxy: virtual public LeafInterfaceProxyBase, virtual pub virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + }; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp index 787d4ec..21441a3 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp @@ -1,99 +1,114 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "LeafInterfaceDBusStubAdapter.h" - #include <commonapi/tests/managed/LeafInterface.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), - &createLeafInterfaceDBusStubAdapter); - } - - - - LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - LeafInterfaceDBusStubAdapterHelper::deinit(); - LeafInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void LeafInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"testLeafMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - LeafInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> - > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); - - - - const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& LeafInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - LeafInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<LeafInterfaceStub>(stub), - false), - stubDispatcherTable_({ - { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "LeafInterfaceDBusStubAdapter.h" +#include <commonapi/tests/managed/LeafInterface.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), + &createLeafInterfaceDBusStubAdapter); +} + + + +LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + LeafInterfaceDBusStubAdapterHelper::deinit(); + LeafInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void LeafInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { +} + +const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + "<method name=\"testLeafMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + LeafInterfaceStub, + CommonAPI::Version + > getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + LeafInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> + > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + + + +const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& LeafInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + LeafInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<LeafInterfaceStub>(stub), + false), + stubDispatcherTable_({ + { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getLeafInterfaceInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h index f60c9b5..f0ecb1f 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/LeafInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,12 +43,12 @@ class LeafInterfaceDBusStubAdapterInternal: public LeafInterfaceStubAdapter, pub ~LeafInterfaceDBusStubAdapterInternal(); - + const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/commonapi/tests/managed/LeafInterfaceStub.h index 95ef485..921e78f 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStub.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStub.h @@ -78,16 +78,15 @@ class LeafInterfaceStubRemoteEvent { class LeafInterfaceStub : public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> { public: virtual ~LeafInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method testLeafMethod. virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) = 0; - using CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp index f653e18..fe18ffc 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp @@ -14,7 +14,12 @@ namespace tests { namespace managed { LeafInterfaceStubDefault::LeafInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(LeafInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& LeafInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h index e9227b8..a13cada 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h @@ -33,6 +33,8 @@ public: LeafInterfaceStubDefault(); LeafInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter); + + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); @@ -54,6 +56,8 @@ private: RemoteEventHandler remoteEventHandler_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterface.h b/src/test/commonapi/tests/managed/RootInterface.h index 7894869..7cd0288 100644 --- a/src/test/commonapi/tests/managed/RootInterface.h +++ b/src/test/commonapi/tests/managed/RootInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -78,7 +78,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types //Hash for testRootMethodError template<> diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp index b7eb845..c9b14e1 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -49,7 +49,7 @@ void RootInterfaceDBusProxy::testRootMethod(const int32_t& inInt, const std::str *this, "testRootMethod", "is", - inInt, inString, + inInt, inString, callStatus, methodError , outInt, outString); diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h index 07f5798..a59ab2e 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/RootInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -46,7 +44,7 @@ class RootInterfaceDBusProxy: virtual public RootInterfaceProxyBase, virtual pub virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback); - + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface(); @@ -54,7 +52,7 @@ class RootInterfaceDBusProxy: virtual public RootInterfaceProxyBase, virtual pub private: - + CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_; CommonAPI::DBus::DBusProxyManager proxyManagerBranchInterface_; }; diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp index 66a9965..0ae8c1f 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp @@ -1,215 +1,230 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "RootInterfaceDBusStubAdapter.h" - #include <commonapi/tests/managed/RootInterface.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), - &createRootInterfaceDBusStubAdapter); - } - - - - RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - RootInterfaceDBusStubAdapterHelper::deinit(); - RootInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); - } - for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); - iter != registeredBranchInterfaceInstances.end(); ++iter) { - deregisterManagedStubBranchInterface(*iter); - } - } - - const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"testRootMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - RootInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<RootInterface::testRootMethodError, int32_t, std::string> - > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); - - - - const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { - if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", - instance, "commonapi.tests.managed.LeafInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredLeafInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; - } - - bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredLeafInterfaceInstances.erase(instance); - return true; - } - } - return false; - } - - std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() { - return registeredLeafInterfaceInstances; - } - - bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) { - if (registeredBranchInterfaceInstances.find(instance) == registeredBranchInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.BranchInterface", - instance, "commonapi.tests.managed.BranchInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredBranchInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; - } - - bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; - if (registeredBranchInterfaceInstances.find(instance) != registeredBranchInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredBranchInterfaceInstances.erase(instance); - return true; - } - } - return false; - } - - std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() { - return registeredBranchInterfaceInstances; - } - - RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - true), - RootInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<RootInterfaceStub>(stub), - true), - stubDispatcherTable_({ - { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "RootInterfaceDBusStubAdapter.h" +#include <commonapi/tests/managed/RootInterface.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), + &createRootInterfaceDBusStubAdapter); +} + + + +RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + RootInterfaceDBusStubAdapterHelper::deinit(); + RootInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); + iter != registeredLeafInterfaceInstances.end(); ++iter) { + deregisterManagedStubLeafInterface(*iter); + } + for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); + iter != registeredBranchInterfaceInstances.end(); ++iter) { + deregisterManagedStubBranchInterface(*iter); + } +} + +const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + "<method name=\"testRootMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + RootInterfaceStub, + CommonAPI::Version + > getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + RootInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<RootInterface::testRootMethodError, int32_t, std::string> + > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + + + +const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", + instance, "commonapi.tests.managed.LeafInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; +} + +bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) { + if (registeredBranchInterfaceInstances.find(instance) == registeredBranchInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.BranchInterface", + instance, "commonapi.tests.managed.BranchInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredBranchInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; + if (registeredBranchInterfaceInstances.find(instance) != registeredBranchInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredBranchInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() { + return registeredBranchInterfaceInstances; +} + +RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + RootInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<RootInterfaceStub>(stub), + true), + stubDispatcherTable_({ + { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getRootInterfaceInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h index 01ef3a4..c46abfa 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/RootInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,7 +43,7 @@ class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, pub ~RootInterfaceDBusStubAdapterInternal(); - + bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); std::set<std::string>& getLeafInterfaceInstances(); @@ -53,9 +52,9 @@ class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, pub std::set<std::string>& getBranchInterfaceInstances(); const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxy.h b/src/test/commonapi/tests/managed/RootInterfaceProxy.h index 672c0d5..076fec7 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -30,9 +30,9 @@ class RootInterfaceProxy: virtual public RootInterface, virtual public RootInter public: RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~RootInterfaceProxy(); - + typedef RootInterface InterfaceType; - + @@ -57,7 +57,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback); - + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface(); @@ -171,7 +171,6 @@ CommonAPI::InterfaceVersionAttribute& RootInterfaceProxy<_AttributeExtensions... return delegate_->getInterfaceVersionAttribute(); } - template <typename ... _AttributeExtensions> CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() { return delegate_->getProxyManagerLeafInterface(); diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h index 550093f..167adc7 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,6 @@ #include "RootInterface.h" - #include <commonapi/tests/managed/BranchInterfaceStub.h> #include <commonapi/tests/managed/LeafInterfaceStub.h> diff --git a/src/test/commonapi/tests/managed/RootInterfaceStub.h b/src/test/commonapi/tests/managed/RootInterfaceStub.h index 0dbd088..3e28cc1 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStub.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -40,16 +40,15 @@ namespace managed { class RootInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public RootInterface { public: - + virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; virtual bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubBranchInterface(const std::string&) = 0; virtual std::set<std::string>& getBranchInterfaceInstances() = 0; - + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -86,22 +85,21 @@ class RootInterfaceStubRemoteEvent { class RootInterfaceStub : public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> { public: virtual ~RootInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method testRootMethod. virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) = 0; - + virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; virtual bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubBranchInterface(const std::string&) = 0; virtual std::set<std::string>& getBranchInterfaceInstances() = 0; - using CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp index cf09dc0..4eb108a 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -15,7 +15,12 @@ namespace managed { RootInterfaceStubDefault::RootInterfaceStubDefault(): autoInstanceCounter_(0), - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(RootInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& RootInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } RootInterfaceStubRemoteEvent* RootInterfaceStubDefault::initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h index 1379a82..9249fc4 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,12 +34,14 @@ public: RootInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); virtual void testRootMethod(int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); - + bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub>); bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); @@ -63,6 +65,8 @@ private: RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRoot.h b/src/test/commonapi/tests/managed/SecondRoot.h index 4104797..2aef3a6 100644 --- a/src/test/commonapi/tests/managed/SecondRoot.h +++ b/src/test/commonapi/tests/managed/SecondRoot.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -55,7 +55,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types } diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp index f43fde1..39bd825 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h index 81f752e..cd75f59 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/SecondRootProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,14 +42,14 @@ class SecondRootDBusProxy: virtual public SecondRootProxyBase, virtual public Co - + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_; }; diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp index fffe746..a6c7c6d 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp @@ -1,145 +1,160 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "SecondRootDBusStubAdapter.h" - #include <commonapi/tests/managed/SecondRoot.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), - &createSecondRootDBusStubAdapter); - } - - - - SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() { - deactivateManagedInstances(); - SecondRootDBusStubAdapterHelper::deinit(); - SecondRootDBusStubAdapterHelper::stub_.reset(); - } - - void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); - } - } - - const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - - "" - ; - return introspectionData.c_str(); - } - - - - - - const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { - if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", - instance, "commonapi.tests.managed.LeafInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredLeafInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; - } - - bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredLeafInterfaceInstances.erase(instance); - return true; - } - } - return false; - } - - std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() { - return registeredLeafInterfaceInstances; - } - - SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - true), - SecondRootDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<SecondRootStub>(stub), - true), - stubDispatcherTable_({ - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "SecondRootDBusStubAdapter.h" +#include <commonapi/tests/managed/SecondRoot.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), + &createSecondRootDBusStubAdapter); +} + + + +SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() { + deactivateManagedInstances(); + SecondRootDBusStubAdapterHelper::deinit(); + SecondRootDBusStubAdapterHelper::stub_.reset(); +} + +void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() { + for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); + iter != registeredLeafInterfaceInstances.end(); ++iter) { + deregisterManagedStubLeafInterface(*iter); + } +} + +const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + + "" + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + SecondRootStub, + CommonAPI::Version + > getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu"); + + + + + +const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", + instance, "commonapi.tests.managed.LeafInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; +} + +SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + SecondRootDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<SecondRootStub>(stub), + true), + stubDispatcherTable_({ + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getSecondRootInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h index fc646db..ba5f2ac 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/SecondRootStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,15 +43,15 @@ class SecondRootDBusStubAdapterInternal: public SecondRootStubAdapter, public Se ~SecondRootDBusStubAdapterInternal(); - + bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); std::set<std::string>& getLeafInterfaceInstances(); const SecondRootDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/SecondRootProxy.h b/src/test/commonapi/tests/managed/SecondRootProxy.h index fa0cb20..1efb856 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -30,13 +30,13 @@ class SecondRootProxy: virtual public SecondRoot, virtual public SecondRootProxy public: SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~SecondRootProxy(); - + typedef SecondRoot InterfaceType; - - + + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); /** @@ -140,7 +140,6 @@ CommonAPI::InterfaceVersionAttribute& SecondRootProxy<_AttributeExtensions...>:: return delegate_->getInterfaceVersionAttribute(); } - template <typename ... _AttributeExtensions> CommonAPI::ProxyManager& SecondRootProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() { return delegate_->getProxyManagerLeafInterface(); diff --git a/src/test/commonapi/tests/managed/SecondRootProxyBase.h b/src/test/commonapi/tests/managed/SecondRootProxyBase.h index 8006139..68cd1fa 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxyBase.h +++ b/src/test/commonapi/tests/managed/SecondRootProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,6 @@ #include "SecondRoot.h" - #include <commonapi/tests/managed/LeafInterfaceStub.h> #if !defined (COMMONAPI_INTERNAL_COMPILATION) diff --git a/src/test/commonapi/tests/managed/SecondRootStub.h b/src/test/commonapi/tests/managed/SecondRootStub.h index 98a73cb..5b1d449 100644 --- a/src/test/commonapi/tests/managed/SecondRootStub.h +++ b/src/test/commonapi/tests/managed/SecondRootStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -38,13 +38,12 @@ namespace managed { class SecondRootStubAdapter: virtual public CommonAPI::StubAdapter, public SecondRoot { public: - + virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; - + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -81,17 +80,16 @@ class SecondRootStubRemoteEvent { class SecondRootStub : public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> { public: virtual ~SecondRootStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; + - virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; - using CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp index 51feea1..bda4c2e 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -15,7 +15,12 @@ namespace managed { SecondRootStubDefault::SecondRootStubDefault(): autoInstanceCounter_(0), - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(SecondRoot::getInterfaceVersion()) { +} + +const CommonAPI::Version& SecondRootStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } SecondRootStubRemoteEvent* SecondRootStubDefault::initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.h b/src/test/commonapi/tests/managed/SecondRootStubDefault.h index daaca19..55cdd3d 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.h +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,9 +34,11 @@ public: SecondRootStubRemoteEvent* initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + + - bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub>); bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); @@ -56,6 +58,8 @@ private: RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed |