diff options
author | Johannes Schanda <schanda@itestra.de> | 2013-09-17 13:58:27 +0200 |
---|---|---|
committer | Philip Rauwolf <rauwolf@itestra.de> | 2013-09-18 18:43:20 +0200 |
commit | cdddda28ea0c93c73dacafa17bf03f7f9bb4572a (patch) | |
tree | f0d590ec163f764f9d6128bbd4feef36869223c3 /src/test/commonapi/tests | |
parent | bee917e24eb806eb8ee7239fd563b9df6987d74b (diff) | |
download | genivi-common-api-dbus-runtime-cdddda28ea0c93c73dacafa17bf03f7f9bb4572a.tar.gz |
Add managed services2.1.0
- Add proxy manager for controling client side of managed proxies
- Add object manager for controling managed stubs
- rework service registry and serviec publishing to use same code paths
as managed objects
- Unmanaged objects are now managed by the "/" object manager
- Connection names are now only claimed after all object are activated
- isAvailableBlocking public api on proxies
- Proxies now require init to be called to allow for immediate callbacks
on availability form the registry
- Changed default commonp address transformation to use object path as
base of instance
- Fix issues with selective
- Add pugixml for xml parsing to properly understand introspection
ressponses
- adds creating factory to objects held by proxy and stub adapter so
that childeren can be safely constructed
Change-Id: I8f2e660043d5e0348933513d39f332b7032288b1
Diffstat (limited to 'src/test/commonapi/tests')
43 files changed, 2953 insertions, 205 deletions
diff --git a/src/test/commonapi/tests/DerivedTypeCollection.cpp b/src/test/commonapi/tests/DerivedTypeCollection.cpp index 5b5ca7b..865ebae 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.cpp +++ b/src/test/commonapi/tests/DerivedTypeCollection.cpp @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #include "DerivedTypeCollection.h" @@ -12,6 +14,8 @@ namespace commonapi { namespace tests { namespace DerivedTypeCollection { + + TestStructExtended::TestStructExtended(const PredefinedTypeCollection::TestString& testStringValue, const uint16_t& uintValueValue, const TestEnumExtended2& testEnumExtended2Value): TestStruct(testStringValue, uintValueValue), testEnumExtended2(testEnumExtended2Value) @@ -38,6 +42,14 @@ void TestStructExtended::writeToOutputStream(CommonAPI::OutputStream& outputStre TestStruct::writeToOutputStream(outputStream); outputStream << testEnumExtended2; } + + + + + + + + TestStruct::TestStruct(const PredefinedTypeCollection::TestString& testStringValue, const uint16_t& uintValueValue): testString(testStringValue), uintValue(uintValueValue) diff --git a/src/test/commonapi/tests/DerivedTypeCollection.h b/src/test/commonapi/tests/DerivedTypeCollection.h index 0ca1d79..52687f6 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.h +++ b/src/test/commonapi/tests/DerivedTypeCollection.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Derived_Type_Collection_H_ #define COMMONAPI_TESTS_Derived_Type_Collection_H_ @@ -31,8 +33,14 @@ namespace tests { namespace DerivedTypeCollection { struct TestStruct: CommonAPI::SerializableStruct { - PredefinedTypeCollection::TestString testString; - uint16_t uintValue; + /** + * the name of the property + */ + PredefinedTypeCollection::TestString testString; + /** + * the actual value + */ + uint16_t uintValue; TestStruct() = default; TestStruct(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue); @@ -46,33 +54,46 @@ namespace DerivedTypeCollection { typeOutputStream.writeUInt16Type(); } }; - typedef std::vector<TestStruct> TestArrayTestStruct; - typedef std::unordered_map<uint32_t, TestArrayTestStruct> TestMap; - + /** + * Common errors. + */ enum class TestEnum: int32_t { + /** + * default + */ E_UNKNOWN = 0x0, + /** + * no error - positive reply + */ E_OK = 0x1, + /** + * value out of range + */ E_OUT_OF_RANGE = 0x2, + /** + * not used + */ E_NOT_USED = 0x3 }; // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1 struct TestEnumComparator; - enum class TestEnumExtended: int32_t { E_UNKNOWN = TestEnum::E_UNKNOWN, E_OK = TestEnum::E_OK, E_OUT_OF_RANGE = TestEnum::E_OUT_OF_RANGE, E_NOT_USED = TestEnum::E_NOT_USED , + /** + * new error + */ E_NEW = 0x4 }; // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1 struct TestEnumExtendedComparator; - enum class TestEnumExtended2: int32_t { E_UNKNOWN = TestEnum::E_UNKNOWN, E_OK = TestEnum::E_OK, @@ -81,14 +102,16 @@ namespace DerivedTypeCollection { E_NEW = TestEnumExtended::E_NEW , + /** + * new error + */ E_NEW2 = 0x5 }; // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1 struct TestEnumExtended2Comparator; - struct TestStructExtended: TestStruct { - TestEnumExtended2 testEnumExtended2; + TestEnumExtended2 testEnumExtended2; TestStructExtended() = default; TestStructExtended(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue, const TestEnumExtended2& testEnumExtended2); @@ -102,10 +125,11 @@ namespace DerivedTypeCollection { typeOutputStream.writeInt32Type(); } }; - typedef std::unordered_map<TestEnum, std::string> TestEnumMap; - enum class TestEnumMissingValue: int32_t { + /** + * default + */ E1 = 0xa, E2, E3 = 2 @@ -113,9 +137,7 @@ namespace DerivedTypeCollection { // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1 struct TestEnumMissingValueComparator; - typedef std::vector<uint64_t> TestArrayUInt64; - bool operator==(const TestStructExtended& lhs, const TestStructExtended& rhs); inline bool operator!=(const TestStructExtended& lhs, const TestStructExtended& rhs) { diff --git a/src/test/commonapi/tests/PredefinedTypeCollection.h b/src/test/commonapi/tests/PredefinedTypeCollection.h index 3cf55ff..5f534b0 100644 --- a/src/test/commonapi/tests/PredefinedTypeCollection.h +++ b/src/test/commonapi/tests/PredefinedTypeCollection.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Predefined_Type_Collection_H_ #define COMMONAPI_TESTS_Predefined_Type_Collection_H_ @@ -26,31 +28,18 @@ namespace tests { namespace PredefinedTypeCollection { typedef uint8_t TestUInt8; - typedef uint16_t TestUInt16; - typedef uint32_t TestUInt32; - typedef uint64_t TestUInt64; - typedef int8_t TestInt8; - typedef int16_t TestInt16; - typedef int32_t TestInt32; - typedef int64_t TestInt64; - typedef bool TestBoolean; - typedef CommonAPI::ByteBuffer TestByteBuffer; - typedef double TestDouble; - typedef float TestFloat; - typedef std::string TestString; - diff --git a/src/test/commonapi/tests/TestInterface.h b/src/test/commonapi/tests/TestInterface.h index c38b541..5099bd0 100644 --- a/src/test/commonapi/tests/TestInterface.h +++ b/src/test/commonapi/tests/TestInterface.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Test_Interface_H_ #define COMMONAPI_TESTS_Test_Interface_H_ diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp index e20db65..4dcaed5 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #include "TestInterfaceDBusProxy.h" @@ -11,12 +13,13 @@ namespace commonapi { namespace tests { std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& interfaceName, const std::string& busName, const std::string& objectPath, const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) { - return std::make_shared<TestInterfaceDBusProxy>(commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); + return std::make_shared<TestInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } __attribute__((constructor)) void registerTestInterfaceDBusProxy(void) { @@ -25,20 +28,21 @@ __attribute__((constructor)) void registerTestInterfaceDBusProxy(void) { } TestInterfaceDBusProxy::TestInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& interfaceName, const std::string& busName, const std::string& objectPath, const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection): - CommonAPI::DBus::DBusProxy(commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection) -, testPredefinedTypeAttribute_(*this, "onTestPredefinedTypeAttributeAttributeChanged", "setTestPredefinedTypeAttributeAttribute", "u", "getTestPredefinedTypeAttributeAttribute"), - testDerivedStructAttribute_(*this, "onTestDerivedStructAttributeAttributeChanged", "setTestDerivedStructAttributeAttribute", "(sqi)", "getTestDerivedStructAttributeAttribute"), - testDerivedArrayAttribute_(*this, "onTestDerivedArrayAttributeAttributeChanged", "setTestDerivedArrayAttributeAttribute", "at", "getTestDerivedArrayAttributeAttribute") + CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection) +,testPredefinedTypeAttribute_(*this, "onTestPredefinedTypeAttributeAttributeChanged", "setTestPredefinedTypeAttributeAttribute", "u", "getTestPredefinedTypeAttributeAttribute"), +testDerivedStructAttribute_(*this, "onTestDerivedStructAttributeAttributeChanged", "setTestDerivedStructAttributeAttribute", "(sqi)", "getTestDerivedStructAttributeAttribute"), +testDerivedArrayAttribute_(*this, "onTestDerivedArrayAttributeAttributeChanged", "setTestDerivedArrayAttributeAttribute", "at", "getTestDerivedArrayAttributeAttribute") , testPredefinedTypeBroadcast_(*this, "TestPredefinedTypeBroadcast", "us"), - testSelectiveBroadcastSelective_(*this, "TestSelectiveBroadcast", ""), - testBroadcastWithOutArgsSelective_(*this, "TestBroadcastWithOutArgs", "us") - { -} + testSelectiveBroadcastSelective_(*this, "TestSelectiveBroadcast", ""), + testBroadcastWithOutArgsSelective_(*this, "TestBroadcastWithOutArgs", "us") + { + } TestInterfaceDBusProxy::TestPredefinedTypeAttributeAttribute& TestInterfaceDBusProxy::getTestPredefinedTypeAttributeAttribute() { return testPredefinedTypeAttribute_; @@ -155,6 +159,7 @@ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testDerivedTypeMethod } + void TestInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const { ownVersionMajor = 1; ownVersionMinor = 0; diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.h b/src/test/commonapi/tests/TestInterfaceDBusProxy.h index 86d8fb3..3974b09 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_H_ #define COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_H_ @@ -31,6 +33,7 @@ namespace tests { class TestInterfaceDBusProxy: virtual public TestInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy { public: TestInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& interfaceName, const std::string& busName, @@ -57,19 +60,23 @@ class TestInterfaceDBusProxy: virtual public TestInterfaceProxyBase, virtual pub virtual std::future<CommonAPI::CallStatus> testVoidDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value, const DerivedTypeCollection::TestMap& testMapValue, TestVoidDerivedTypeMethodAsyncCallback callback); virtual void testDerivedTypeMethod(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, CommonAPI::CallStatus& callStatus, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue); virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, TestDerivedTypeMethodAsyncCallback callback); + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_; - CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedStructAttributeAttribute>> testDerivedStructAttribute_; - CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedArrayAttributeAttribute>> testDerivedArrayAttribute_; + CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_; + CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedStructAttributeAttribute>> testDerivedStructAttribute_; + CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedArrayAttributeAttribute>> testDerivedArrayAttribute_; CommonAPI::DBus::DBusEvent<TestPredefinedTypeBroadcastEvent> testPredefinedTypeBroadcast_; CommonAPI::DBus::DBusSelectiveEvent<TestSelectiveBroadcastSelectiveEvent> testSelectiveBroadcastSelective_; CommonAPI::DBus::DBusSelectiveEvent<TestBroadcastWithOutArgsSelectiveEvent> testBroadcastWithOutArgsSelective_; + }; + + } // namespace tests } // namespace commonapi diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp index ffe1005..74dedd8 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* 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> @@ -12,13 +14,14 @@ 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>(commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); + return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { @@ -27,13 +30,28 @@ __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { } 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(commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub)) { + TestInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub), + NULL) + { + subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); + subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); +} + +TestInterfaceDBusStubAdapter::~TestInterfaceDBusStubAdapter() { + deactivateManagedInstances(); + deinit(); + stub_.reset(); +} + +void TestInterfaceDBusStubAdapter::deactivateManagedInstances() { } const char* TestInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { @@ -229,24 +247,29 @@ static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< void TestInterfaceDBusStubAdapter::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 != NULL) + if(dbusClientId) { - CommonAPI::DBus::DBusMessage dbusMethodCall = dbusClientId->createMessage(getObjectPath(), getInterfaceName(), "TestSelectiveBroadcast"); - getDBusConnection()->sendDBusMessage(dbusMethodCall); + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestSelectiveBroadcast", + "" + ); } } -void TestInterfaceDBusStubAdapter::sendTestSelectiveBroadcastSelective(const CommonAPI::ClientIdList* receivers) { - const CommonAPI::ClientIdList* actualReceiverList; +void TestInterfaceDBusStubAdapter::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { + std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; actualReceiverList = receivers; if(receivers == NULL) - actualReceiverList = &subscribersForTestSelectiveBroadcastSelective_; + actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) { - if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_.find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_.end()) { + if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { fireTestSelectiveBroadcastSelective(*clientIdIterator); } } @@ -255,7 +278,7 @@ void TestInterfaceDBusStubAdapter::sendTestSelectiveBroadcastSelective(const Com void TestInterfaceDBusStubAdapter::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); if (ok) { - subscribersForTestSelectiveBroadcastSelective_.insert(clientId); + subscribersForTestSelectiveBroadcastSelective_->insert(clientId); stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); success = true; } else { @@ -265,12 +288,12 @@ void TestInterfaceDBusStubAdapter::subscribeForTestSelectiveBroadcastSelective(c void TestInterfaceDBusStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestSelectiveBroadcastSelective_.erase(clientId); + subscribersForTestSelectiveBroadcastSelective_->erase(clientId); stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); } -CommonAPI::ClientIdList* const TestInterfaceDBusStubAdapter::getSubscribersForTestSelectiveBroadcastSelective() { - return &subscribersForTestSelectiveBroadcastSelective_; +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapter::getSubscribersForTestSelectiveBroadcastSelective() { + return subscribersForTestSelectiveBroadcastSelective_; } static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< @@ -291,24 +314,30 @@ static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< void TestInterfaceDBusStubAdapter::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 != NULL) + if(dbusClientId) { - CommonAPI::DBus::DBusMessage dbusMethodCall = dbusClientId->createMessage(getObjectPath(), getInterfaceName(), "TestBroadcastWithOutArgs"); - getDBusConnection()->sendDBusMessage(dbusMethodCall); + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestBroadcastWithOutArgs", + "us", + uint32Value, stringValue + ); } } -void TestInterfaceDBusStubAdapter::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const CommonAPI::ClientIdList* receivers) { - const CommonAPI::ClientIdList* actualReceiverList; +void TestInterfaceDBusStubAdapter::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_; + actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) { - if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_.find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_.end()) { + if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue); } } @@ -317,7 +346,7 @@ void TestInterfaceDBusStubAdapter::sendTestBroadcastWithOutArgsSelective(const u void TestInterfaceDBusStubAdapter::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); if (ok) { - subscribersForTestBroadcastWithOutArgsSelective_.insert(clientId); + subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); success = true; } else { @@ -327,12 +356,12 @@ void TestInterfaceDBusStubAdapter::subscribeForTestBroadcastWithOutArgsSelective void TestInterfaceDBusStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestBroadcastWithOutArgsSelective_.erase(clientId); + subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); } -CommonAPI::ClientIdList* const TestInterfaceDBusStubAdapter::getSubscribersForTestBroadcastWithOutArgsSelective() { - return &subscribersForTestBroadcastWithOutArgsSelective_; +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapter::getSubscribersForTestBroadcastWithOutArgsSelective() { + return subscribersForTestBroadcastWithOutArgsSelective_; } @@ -359,5 +388,6 @@ const TestInterfaceDBusStubAdapter::StubDispatcherTable& TestInterfaceDBusStubAd return stubDispatcherTable; } + } // namespace tests } // namespace commonapi diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h index 9a9022d..d83081c 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_H_ #define COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_H_ @@ -15,7 +17,9 @@ #endif #include <CommonAPI/DBus/DBusStubAdapterHelper.h> +#include <CommonAPI/DBus/DBusStubAdapter.h> #include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusServicePublisher.h> #undef COMMONAPI_INTERNAL_COMPILATION @@ -27,6 +31,7 @@ typedef CommonAPI::DBus::DBusStubAdapterHelper<TestInterfaceStub> TestInterfaceD class TestInterfaceDBusStubAdapter: public TestInterfaceStubAdapter, public TestInterfaceDBusStubAdapterHelper { public: TestInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& dbusInterfaceName, const std::string& dbusBusName, @@ -34,26 +39,33 @@ class TestInterfaceDBusStubAdapter: public TestInterfaceStubAdapter, public Test const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, const std::shared_ptr<CommonAPI::StubBase>& stub); + ~TestInterfaceDBusStubAdapter(); + void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value); void fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value); void fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value); void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue); void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId); - void sendTestSelectiveBroadcastSelective(const CommonAPI::ClientIdList* receivers = NULL); + void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL); void subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success); void unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId); - CommonAPI::ClientIdList* const getSubscribersForTestSelectiveBroadcastSelective(); + std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective(); void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue); - void sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const CommonAPI::ClientIdList* receivers = NULL); + void sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL); void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success); void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId); - CommonAPI::ClientIdList* const getSubscribersForTestBroadcastWithOutArgsSelective(); + std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective(); + const StubDispatcherTable& getStubDispatcherTable(); + + void deactivateManagedInstances(); protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; + + private: }; } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceProxy.h b/src/test/commonapi/tests/TestInterfaceProxy.h index e206944..3aede95 100644 --- a/src/test/commonapi/tests/TestInterfaceProxy.h +++ b/src/test/commonapi/tests/TestInterfaceProxy.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Test_Interface_PROXY_H_ #define COMMONAPI_TESTS_Test_Interface_PROXY_H_ @@ -28,28 +30,40 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~TestInterfaceProxy(); - /// Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute. + /** + * Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute. + */ virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() { return delegate_->getTestPredefinedTypeAttributeAttribute(); } - /// Returns the wrapper class that provides access to the attribute TestDerivedStructAttribute. + /** + * Returns the wrapper class that provides access to the attribute TestDerivedStructAttribute. + */ virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() { return delegate_->getTestDerivedStructAttributeAttribute(); } - /// Returns the wrapper class that provides access to the attribute TestDerivedArrayAttribute. + /** + * Returns the wrapper class that provides access to the attribute TestDerivedArrayAttribute. + */ virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() { return delegate_->getTestDerivedArrayAttributeAttribute(); } - // Returns the wrapper class that provides access to the broadcast TestPredefinedTypeBroadcast. + /** + * Returns the wrapper class that provides access to the broadcast TestPredefinedTypeBroadcast. + */ virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent() { return delegate_->getTestPredefinedTypeBroadcastEvent(); } - // Returns the wrapper class that provides access to the broadcast TestSelectiveBroadcast. + /** + * Returns the wrapper class that provides access to the broadcast TestSelectiveBroadcast. + */ virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent() { return delegate_->getTestSelectiveBroadcastSelectiveEvent(); } - // Returns the wrapper class that provides access to the broadcast TestBroadcastWithOutArgs. + /** + * Returns the wrapper class that provides access to the broadcast TestBroadcastWithOutArgs. + */ virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent() { return delegate_->getTestBroadcastWithOutArgsSelectiveEvent(); } @@ -76,7 +90,7 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter /** * Calls testVoidPredefinedTypeMethod with synchronous semantics. * - * All const parameters are input parameters to this method. + * All const parameters are input parameters to this method. * The CallStatus will be filled when the method returns and indicate either * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus * will be set. @@ -96,8 +110,8 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter /** * Calls testPredefinedTypeMethod with synchronous semantics. * - * All const parameters are input parameters to this method. - * All non-const parameters will be filled with the returned values. + * All const parameters are input parameters to this method. + * All non-const parameters will be filled with the returned values. * The CallStatus will be filled when the method returns and indicate either * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus * will be set. @@ -117,7 +131,7 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter /** * Calls testVoidDerivedTypeMethod with synchronous semantics. * - * All const parameters are input parameters to this method. + * All const parameters are input parameters to this method. * The CallStatus will be filled when the method returns and indicate either * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus * will be set. @@ -137,8 +151,8 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter /** * Calls testDerivedTypeMethod with synchronous semantics. * - * All const parameters are input parameters to this method. - * All non-const parameters will be filled with the returned values. + * All const parameters are input parameters to this method. + * All non-const parameters will be filled with the returned values. * The CallStatus will be filled when the method returns and indicate either * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus * will be set. @@ -155,23 +169,39 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue, const DerivedTypeCollection::TestMap& testMapInValue, TestDerivedTypeMethodAsyncCallback callback); + - /// Returns the CommonAPI address of the remote partner this proxy communicates with. + /** + * Returns the CommonAPI address of the remote partner this proxy communicates with. + */ virtual std::string getAddress() const; - /// Returns the domain of the remote partner this proxy communicates with. + /** + * Returns the domain of the remote partner this proxy communicates with. + */ virtual const std::string& getDomain() const; - /// Returns the service ID of the remote partner this proxy communicates with. + /** + * Returns the service ID of the remote partner this proxy communicates with. + */ virtual const std::string& getServiceId() const; - /// Returns the instance ID of the remote partner this proxy communicates with. + /** + * Returns the instance ID of the remote partner this proxy communicates with. + */ virtual const std::string& getInstanceId() const; - /// Returns true if the remote partner for this proxy is available. + /** + * Returns true if the remote partner for this proxy is currently known to be available. + */ virtual bool isAvailable() const; /** + * Returns true if the remote partner for this proxy is available. + */ + virtual bool isAvailableBlocking() const; + + /** * Returns the wrapper class that is used to (de-)register for notifications about * the availability of the remote partner of this proxy. */ @@ -332,6 +362,11 @@ bool TestInterfaceProxy<_AttributeExtensions...>::isAvailable() const { } template <typename ... _AttributeExtensions> +bool TestInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const { + return delegate_->isAvailableBlocking(); +} + +template <typename ... _AttributeExtensions> CommonAPI::ProxyStatusEvent& TestInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() { return delegate_->getProxyStatusEvent(); } @@ -341,6 +376,8 @@ CommonAPI::InterfaceVersionAttribute& TestInterfaceProxy<_AttributeExtensions... return delegate_->getInterfaceVersionAttribute(); } + + } // namespace tests } // namespace commonapi @@ -356,5 +393,4 @@ struct DefaultAttributeProxyFactoryHelper<commonapi::tests::TestInterfaceProxy, }; } - #endif // COMMONAPI_TESTS_Test_Interface_PROXY_H_ diff --git a/src/test/commonapi/tests/TestInterfaceProxyBase.h b/src/test/commonapi/tests/TestInterfaceProxyBase.h index 715df5c..619e27e 100644 --- a/src/test/commonapi/tests/TestInterfaceProxyBase.h +++ b/src/test/commonapi/tests/TestInterfaceProxyBase.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Test_Interface_PROXY_BASE_H_ #define COMMONAPI_TESTS_Test_Interface_PROXY_BASE_H_ diff --git a/src/test/commonapi/tests/TestInterfaceStub.h b/src/test/commonapi/tests/TestInterfaceStub.h index 59ef632..282dca5 100644 --- a/src/test/commonapi/tests/TestInterfaceStub.h +++ b/src/test/commonapi/tests/TestInterfaceStub.h @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Test_Interface_STUB_H_ #define COMMONAPI_TESTS_Test_Interface_STUB_H_ @@ -57,26 +59,30 @@ class TestInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public Te * Instead, the "fire<broadcastName>Event" methods of the stub should be used. */ virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - virtual void sendTestSelectiveBroadcastSelective(const CommonAPI::ClientIdList* receivers = NULL) = 0; + virtual void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0; virtual void subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) = 0; virtual void unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - virtual CommonAPI::ClientIdList* const getSubscribersForTestSelectiveBroadcastSelective() = 0; + virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective() = 0; /** * Sends a selective broadcast event for TestBroadcastWithOutArgs. Should not be called directly. * Instead, the "fire<broadcastName>Event" methods of the stub should be used. */ virtual void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) = 0; - virtual void sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const CommonAPI::ClientIdList* receivers = NULL) = 0; + virtual void sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0; virtual void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) = 0; virtual void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - virtual CommonAPI::ClientIdList* const getSubscribersForTestBroadcastWithOutArgsSelective() = 0; + virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective() = 0; + + + virtual void deactivateManagedInstances() = 0; + protected: /** * Defines properties for storing the ClientIds of clients / proxies that have * subscribed to the selective broadcasts */ - CommonAPI::ClientIdList subscribersForTestSelectiveBroadcastSelective_; - CommonAPI::ClientIdList subscribersForTestBroadcastWithOutArgsSelective_; + std::shared_ptr<CommonAPI::ClientIdList> subscribersForTestSelectiveBroadcastSelective_; + std::shared_ptr<CommonAPI::ClientIdList> subscribersForTestBroadcastWithOutArgsSelective_; }; @@ -97,19 +103,19 @@ class TestInterfaceStubRemoteEvent { virtual ~TestInterfaceStubRemoteEvent() { } /// Verification callback for remote set requests on the attribute TestPredefinedTypeAttribute - virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t TestPredefinedTypeAttribute) = 0; - /// Action callback for remote set requests on the attribute TestPredefinedTypeAttribute - virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged() = 0; + virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t TestPredefinedTypeAttribute) = 0; + /// Action callback for remote set requests on the attribute TestPredefinedTypeAttribute + virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged() = 0; /// Verification callback for remote set requests on the attribute TestDerivedStructAttribute - virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended TestDerivedStructAttribute) = 0; - /// Action callback for remote set requests on the attribute TestDerivedStructAttribute - virtual void onRemoteTestDerivedStructAttributeAttributeChanged() = 0; + virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended TestDerivedStructAttribute) = 0; + /// Action callback for remote set requests on the attribute TestDerivedStructAttribute + virtual void onRemoteTestDerivedStructAttributeAttributeChanged() = 0; /// Verification callback for remote set requests on the attribute TestDerivedArrayAttribute - virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 TestDerivedArrayAttribute) = 0; - /// Action callback for remote set requests on the attribute TestDerivedArrayAttribute - virtual void onRemoteTestDerivedArrayAttributeAttributeChanged() = 0; + virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 TestDerivedArrayAttribute) = 0; + /// Action callback for remote set requests on the attribute TestDerivedArrayAttribute + virtual void onRemoteTestDerivedArrayAttributeAttributeChanged() = 0; }; @@ -148,9 +154,9 @@ class TestInterfaceStub : public CommonAPI::Stub<TestInterfaceStubAdapter , Test * The ClientIds must all be out of the set of subscribed clients. * If no ClientIds are given, the selective broadcast is sent to all subscribed clients. */ - virtual void fireTestSelectiveBroadcastSelective(const CommonAPI::ClientIdList* receivers = NULL) = 0; + virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0; /// retreives the list of all subscribed clients for TestSelectiveBroadcast - virtual CommonAPI::ClientIdList* const getSubscribersForTestSelectiveBroadcastSelective() = 0; + virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective() = 0; /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts. virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) = 0; /// Hook method for reacting accepting or denying new subscriptions @@ -160,13 +166,14 @@ class TestInterfaceStub : public CommonAPI::Stub<TestInterfaceStubAdapter , Test * The ClientIds must all be out of the set of subscribed clients. * If no ClientIds are given, the selective broadcast is sent to all subscribed clients. */ - virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const CommonAPI::ClientIdList* receivers = NULL) = 0; + virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL) = 0; /// retreives the list of all subscribed clients for TestBroadcastWithOutArgs - virtual CommonAPI::ClientIdList* const getSubscribersForTestBroadcastWithOutArgsSelective() = 0; + virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective() = 0; /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts. virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) = 0; /// Hook method for reacting accepting or denying new subscriptions virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; + }; } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp index e68bf40..e53fe6a 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp @@ -1,9 +1,11 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #include <commonapi/tests/TestInterfaceStubDefault.h> @@ -29,16 +31,9 @@ const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribut void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(uint32_t value) { const bool valueChanged = trySetTestPredefinedTypeAttributeAttribute(std::move(value)); - if (valueChanged) + if (valueChanged) { stubAdapter_->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_); -} - -void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) { - setTestPredefinedTypeAttributeAttribute(value); -} - -void TestInterfaceStubDefault::onRemoteTestPredefinedTypeAttributeAttributeChanged() { - // No operation in default + } } bool TestInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t value) { @@ -54,18 +49,26 @@ bool TestInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeReque return true; } -bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t value) { - return defaultStub_->trySetTestPredefinedTypeAttributeAttribute(std::move(value)); +void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) { + setTestPredefinedTypeAttributeAttribute(value); } -bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) { - return onRemoteSetTestPredefinedTypeAttributeAttribute(value); +void TestInterfaceStubDefault::onRemoteTestPredefinedTypeAttributeAttributeChanged() { + // No operation in default } void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestPredefinedTypeAttributeAttributeChanged() { defaultStub_->onRemoteTestPredefinedTypeAttributeAttributeChanged(); } +bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t value) { + return defaultStub_->trySetTestPredefinedTypeAttributeAttribute(std::move(value)); +} + +bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value) { + return onRemoteSetTestPredefinedTypeAttributeAttribute(value); +} + const DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTestDerivedStructAttributeAttribute() { return testDerivedStructAttributeAttributeValue_; } @@ -76,16 +79,9 @@ const DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTe void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) { const bool valueChanged = trySetTestDerivedStructAttributeAttribute(std::move(value)); - if (valueChanged) + if (valueChanged) { stubAdapter_->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_); -} - -void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) { - setTestDerivedStructAttributeAttribute(value); -} - -void TestInterfaceStubDefault::onRemoteTestDerivedStructAttributeAttributeChanged() { - // No operation in default + } } bool TestInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) { @@ -101,18 +97,26 @@ bool TestInterfaceStubDefault::validateTestDerivedStructAttributeAttributeReques return true; } -bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) { - return defaultStub_->trySetTestDerivedStructAttributeAttribute(std::move(value)); +void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) { + setTestDerivedStructAttributeAttribute(value); } -bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) { - return onRemoteSetTestDerivedStructAttributeAttribute(value); +void TestInterfaceStubDefault::onRemoteTestDerivedStructAttributeAttributeChanged() { + // No operation in default } void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedStructAttributeAttributeChanged() { defaultStub_->onRemoteTestDerivedStructAttributeAttributeChanged(); } +bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value) { + return defaultStub_->trySetTestDerivedStructAttributeAttribute(std::move(value)); +} + +bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestStructExtended value) { + return onRemoteSetTestDerivedStructAttributeAttribute(value); +} + const DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestDerivedArrayAttributeAttribute() { return testDerivedArrayAttributeAttributeValue_; } @@ -123,16 +127,9 @@ const DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestD void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) { const bool valueChanged = trySetTestDerivedArrayAttributeAttribute(std::move(value)); - if (valueChanged) + if (valueChanged) { stubAdapter_->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_); -} - -void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) { - setTestDerivedArrayAttributeAttribute(value); -} - -void TestInterfaceStubDefault::onRemoteTestDerivedArrayAttributeAttributeChanged() { - // No operation in default + } } bool TestInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) { @@ -148,36 +145,64 @@ bool TestInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequest return true; } -bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) { - return defaultStub_->trySetTestDerivedArrayAttributeAttribute(std::move(value)); +void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) { + setTestDerivedArrayAttributeAttribute(value); } -bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) { - return onRemoteSetTestDerivedArrayAttributeAttribute(value); +void TestInterfaceStubDefault::onRemoteTestDerivedArrayAttributeAttributeChanged() { + // No operation in default } void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedArrayAttributeAttributeChanged() { defaultStub_->onRemoteTestDerivedArrayAttributeAttributeChanged(); } +bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value) { + return defaultStub_->trySetTestDerivedArrayAttributeAttribute(std::move(value)); +} + +bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value) { + return onRemoteSetTestDerivedArrayAttributeAttribute(value); +} + void TestInterfaceStubDefault::testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> clientId) { + // Call old style methods in default + testEmptyMethod(); +} +void TestInterfaceStubDefault::testEmptyMethod() { // No operation in default } void TestInterfaceStubDefault::testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32Value, std::string stringValue) { + // Call old style methods in default + testVoidPredefinedTypeMethod(uint32Value, stringValue); +} +void TestInterfaceStubDefault::testVoidPredefinedTypeMethod(uint32_t uint32Value, std::string stringValue) { // No operation in default } void TestInterfaceStubDefault::testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue) { + // Call old style methods in default + testPredefinedTypeMethod(uint32InValue, stringInValue, uint32OutValue, stringOutValue); +} +void TestInterfaceStubDefault::testPredefinedTypeMethod(uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue) { // No operation in default } void TestInterfaceStubDefault::testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue) { + // Call old style methods in default + testVoidDerivedTypeMethod(testEnumExtended2Value, testMapValue); +} +void TestInterfaceStubDefault::testVoidDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue) { // No operation in default } void TestInterfaceStubDefault::testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) { + // Call old style methods in default + testDerivedTypeMethod(testEnumExtended2InValue, testMapInValue, testEnumExtended2OutValue, testMapOutValue); +} +void TestInterfaceStubDefault::testDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue) { // No operation in default } @@ -185,7 +210,7 @@ void TestInterfaceStubDefault::testDerivedTypeMethod(const std::shared_ptr<Commo void TestInterfaceStubDefault::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { stubAdapter_->fireTestPredefinedTypeBroadcastEvent(uint32Value, stringValue); } -void TestInterfaceStubDefault::fireTestSelectiveBroadcastSelective(const CommonAPI::ClientIdList* receivers) { +void TestInterfaceStubDefault::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { stubAdapter_->sendTestSelectiveBroadcastSelective(receivers); } void TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) { @@ -195,11 +220,11 @@ bool TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionRequ // Accept in default return true; } -CommonAPI::ClientIdList* const TestInterfaceStubDefault::getSubscribersForTestSelectiveBroadcastSelective() { +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestSelectiveBroadcastSelective() { return(stubAdapter_->getSubscribersForTestSelectiveBroadcastSelective()); } -void TestInterfaceStubDefault::fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const CommonAPI::ClientIdList* receivers) { +void TestInterfaceStubDefault::fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) { stubAdapter_->sendTestBroadcastWithOutArgsSelective(uint32Value, stringValue, receivers); } void TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) { @@ -209,11 +234,12 @@ bool TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionRe // Accept in default return true; } -CommonAPI::ClientIdList* const TestInterfaceStubDefault::getSubscribersForTestBroadcastWithOutArgsSelective() { +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestBroadcastWithOutArgsSelective() { return(stubAdapter_->getSubscribersForTestBroadcastWithOutArgsSelective()); } + TestInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestInterfaceStubDefault* defaultStub): defaultStub_(defaultStub) { } diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.h b/src/test/commonapi/tests/TestInterfaceStubDefault.h index 0128b8e..33853f7 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.h +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.h @@ -1,14 +1,17 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. * -* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this -* file, You can obtain one at http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. */ #ifndef COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_H_ #define COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_H_ #include <commonapi/tests/TestInterfaceStub.h> +#include <sstream> namespace commonapi { namespace tests { @@ -43,40 +46,46 @@ class TestInterfaceStubDefault : public TestInterfaceStub { virtual void setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestArrayUInt64 value); virtual void testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void testEmptyMethod(); virtual void testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32Value, std::string stringValue); + virtual void testVoidPredefinedTypeMethod(uint32_t uint32Value, std::string stringValue); virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue); + virtual void testPredefinedTypeMethod(uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue); virtual void testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue); + virtual void testVoidDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue); virtual void testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue); + virtual void testDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue); virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue); - virtual void fireTestSelectiveBroadcastSelective(const CommonAPI::ClientIdList* receivers = NULL); - virtual CommonAPI::ClientIdList* const getSubscribersForTestSelectiveBroadcastSelective(); + virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL); + virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective(); /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts. virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event); /// Hook method for reacting accepting or denying new subscriptions virtual bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId); - virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const CommonAPI::ClientIdList* receivers = NULL); - virtual CommonAPI::ClientIdList* const getSubscribersForTestBroadcastWithOutArgsSelective(); + virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL); + virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective(); /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts. virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event); /// Hook method for reacting accepting or denying new subscriptions virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId); + protected: - virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged(); virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t value); virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t& value); - virtual void onRemoteTestDerivedStructAttributeAttributeChanged(); + virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged(); virtual bool trySetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value); virtual bool validateTestDerivedStructAttributeAttributeRequestedValue(const DerivedTypeCollection::TestStructExtended& value); - virtual void onRemoteTestDerivedArrayAttributeAttributeChanged(); + virtual void onRemoteTestDerivedStructAttributeAttributeChanged(); virtual bool trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value); virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value); + virtual void onRemoteTestDerivedArrayAttributeAttributeChanged(); std::shared_ptr<TestInterfaceStubAdapter> stubAdapter_; private: class RemoteEventHandler: public TestInterfaceStubRemoteEvent { diff --git a/src/test/commonapi/tests/managed/BranchInterface.h b/src/test/commonapi/tests/managed/BranchInterface.h new file mode 100644 index 0000000..80b5138 --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterface.h @@ -0,0 +1,90 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_H_ +#define COMMONAPI_TESTS_MANAGED_Branch_Interface_H_ + + + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/InputStream.h> +#include <CommonAPI/OutputStream.h> +#include <CommonAPI/types.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class BranchInterface { + public: + virtual ~BranchInterface() { } + + static inline const char* getInterfaceId(); + static inline CommonAPI::Version getInterfaceVersion(); + enum class testBranchMethodError: int32_t { + OK, + NOTOK + }; + + // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1 + struct testBranchMethodErrorComparator; +}; + +const char* BranchInterface::getInterfaceId() { + static const char* interfaceId = "commonapi.tests.managed.BranchInterface"; + return interfaceId; +} + +CommonAPI::Version BranchInterface::getInterfaceVersion() { + return CommonAPI::Version(1, 0); +} + +inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, BranchInterface::testBranchMethodError& enumValue) { + return inputStream.readEnumValue<int32_t>(enumValue); +} + +inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const BranchInterface::testBranchMethodError& enumValue) { + return outputStream.writeEnumValue(static_cast<int32_t>(enumValue)); +} + +struct BranchInterface::testBranchMethodErrorComparator { + inline bool operator()(const testBranchMethodError& lhs, const testBranchMethodError& rhs) const { + return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs); + } +}; + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +namespace CommonAPI { + +} + + +namespace std { + //hashes for types + + //hashes for error types + //Hash for testBranchMethodError + template<> + struct hash<commonapi::tests::managed::BranchInterface::testBranchMethodError> { + inline size_t operator()(const commonapi::tests::managed::BranchInterface::testBranchMethodError& testBranchMethodError) const { + return static_cast<int32_t>(testBranchMethodError); + } + }; +} + +#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_H_ diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp new file mode 100644 index 0000000..f056c50 --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp @@ -0,0 +1,74 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "BranchInterfaceDBusProxy.h" + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusProxy> createBranchInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) { + return std::make_shared<BranchInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); +} + +__attribute__((constructor)) void registerBranchInterfaceDBusProxy(void) { + CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(BranchInterface::getInterfaceId(), + &createBranchInterfaceDBusProxy); +} + +BranchInterfaceDBusProxy::BranchInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection): + CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection) + { + } + + + +void BranchInterfaceDBusProxy::testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) { + CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>, + CommonAPI::DBus::DBusSerializableArguments<BranchInterface::testBranchMethodError, int32_t, std::string> >::callMethodWithReply( + *this, + "testBranchMethod", + "is", + inInt, inString, + callStatus, + methodError + , outInt, outString); +} +std::future<CommonAPI::CallStatus> BranchInterfaceDBusProxy::testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback) { + return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>, + CommonAPI::DBus::DBusSerializableArguments<BranchInterface::testBranchMethodError, int32_t, std::string> >::callMethodAsync( + *this, + "testBranchMethod", + "is", + inInt, inString, + std::move(callback)); +} + + + +void BranchInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const { + ownVersionMajor = 1; + ownVersionMinor = 0; +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h new file mode 100644 index 0000000..a5eac7b --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h @@ -0,0 +1,61 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_H_ + +#include <commonapi/tests/managed/BranchInterfaceProxyBase.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusProxy.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +#include <string> + +namespace commonapi { +namespace tests { +namespace managed { + +class BranchInterfaceDBusProxy: virtual public BranchInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy { + public: + BranchInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection); + + virtual ~BranchInterfaceDBusProxy() { } + + + + virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); + virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback); + + + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; + + private: + + +}; + + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp new file mode 100644 index 0000000..b9c846b --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp @@ -0,0 +1,89 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* 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); +} + +BranchInterfaceDBusStubAdapter::BranchInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + BranchInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<BranchInterfaceStub>(stub), + NULL) + { +} + +BranchInterfaceDBusStubAdapter::~BranchInterfaceDBusStubAdapter() { + deactivateManagedInstances(); + deinit(); + stub_.reset(); +} + +void BranchInterfaceDBusStubAdapter::deactivateManagedInstances() { +} + +const char* BranchInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { + static const char* 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; +} + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + BranchInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> + > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + + + +const BranchInterfaceDBusStubAdapter::StubDispatcherTable& BranchInterfaceDBusStubAdapter::getStubDispatcherTable() { + static const BranchInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { + { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } + }; + return stubDispatcherTable; +} + + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h new file mode 100644 index 0000000..df42f7b --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h @@ -0,0 +1,62 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_H_ +#define COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_H_ + +#include <commonapi/tests/managed/BranchInterfaceStub.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusStubAdapterHelper.h> +#include <CommonAPI/DBus/DBusStubAdapter.h> +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusServicePublisher.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +typedef CommonAPI::DBus::DBusStubAdapterHelper<BranchInterfaceStub> BranchInterfaceDBusStubAdapterHelper; + +class BranchInterfaceDBusStubAdapter: public BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper { + public: + BranchInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub); + + ~BranchInterfaceDBusStubAdapter(); + + + + + const StubDispatcherTable& getStubDispatcherTable(); + + void deactivateManagedInstances(); + + protected: + virtual const char* getMethodsDBusIntrospectionXmlData() const; + + private: +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_H_ diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h new file mode 100644 index 0000000..9bbbc77 --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h @@ -0,0 +1,174 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_H_ + +#include "BranchInterfaceProxyBase.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +template <typename ... _AttributeExtensions> +class BranchInterfaceProxy: virtual public BranchInterface, virtual public BranchInterfaceProxyBase, public _AttributeExtensions... { + public: + BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); + ~BranchInterfaceProxy(); + + + + /** + * Calls testBranchMethod with synchronous semantics. + * + * All const parameters are input parameters to this method. + * All non-const parameters will be filled with the returned values. + * The CallStatus will be filled when the method returns and indicate either + * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus + * will be set. + */ + virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); + /** + * Calls testBranchMethod with asynchronous semantics. + * + * The provided callback will be called when the reply to this call arrives or + * an error occurs during the call. The CallStatus will indicate either "SUCCESS" + * or which type of error has occurred. In case of any error, ONLY the CallStatus + * will have a defined value. + * The std::future returned by this method will be fulfilled at arrival of the reply. + * It will provide the same value for CallStatus as will be handed to the callback. + */ + virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback); + + + /** + * Returns the CommonAPI address of the remote partner this proxy communicates with. + */ + virtual std::string getAddress() const; + + /** + * Returns the domain of the remote partner this proxy communicates with. + */ + virtual const std::string& getDomain() const; + + /** + * Returns the service ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getServiceId() const; + + /** + * Returns the instance ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getInstanceId() const; + + /** + * Returns true if the remote partner for this proxy is currently known to be available. + */ + virtual bool isAvailable() const; + + /** + * Returns true if the remote partner for this proxy is available. + */ + virtual bool isAvailableBlocking() const; + + /** + * Returns the wrapper class that is used to (de-)register for notifications about + * the availability of the remote partner of this proxy. + */ + virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent(); + + /** + * Returns the wrapper class that is used to access version information of the remote + * partner of this proxy. + */ + virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute(); + + private: + std::shared_ptr<BranchInterfaceProxyBase> delegate_; +}; + + +// +// BranchInterfaceProxy Implementation +// +template <typename ... _AttributeExtensions> +BranchInterfaceProxy<_AttributeExtensions...>::BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate): + delegate_(std::dynamic_pointer_cast<BranchInterfaceProxyBase>(delegate)), + _AttributeExtensions(*(std::dynamic_pointer_cast<BranchInterfaceProxyBase>(delegate)))... { +} + +template <typename ... _AttributeExtensions> +BranchInterfaceProxy<_AttributeExtensions...>::~BranchInterfaceProxy() { +} + +template <typename ... _AttributeExtensions> +void BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) { + delegate_->testBranchMethod(inInt, inString, callStatus, methodError, outInt, outString); +} + +template <typename ... _AttributeExtensions> +std::future<CommonAPI::CallStatus> BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback) { + return delegate_->testBranchMethodAsync(inInt, inString, callback); +} + +template <typename ... _AttributeExtensions> +std::string BranchInterfaceProxy<_AttributeExtensions...>::getAddress() const { + return delegate_->getAddress(); +} + +template <typename ... _AttributeExtensions> +const std::string& BranchInterfaceProxy<_AttributeExtensions...>::getDomain() const { + return delegate_->getDomain(); +} + +template <typename ... _AttributeExtensions> +const std::string& BranchInterfaceProxy<_AttributeExtensions...>::getServiceId() const { + return delegate_->getServiceId(); +} + +template <typename ... _AttributeExtensions> +const std::string& BranchInterfaceProxy<_AttributeExtensions...>::getInstanceId() const { + return delegate_->getInstanceId(); +} + +template <typename ... _AttributeExtensions> +bool BranchInterfaceProxy<_AttributeExtensions...>::isAvailable() const { + return delegate_->isAvailable(); +} + +template <typename ... _AttributeExtensions> +bool BranchInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const { + return delegate_->isAvailableBlocking(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::ProxyStatusEvent& BranchInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() { + return delegate_->getProxyStatusEvent(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::InterfaceVersionAttribute& BranchInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() { + return delegate_->getInterfaceVersionAttribute(); +} + + + +} // namespace managed +} // namespace tests +} // namespace commonapi + + +#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h new file mode 100644 index 0000000..5a6a613 --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h @@ -0,0 +1,47 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_H_ +#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_H_ + +#include "BranchInterface.h" + + + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#include <CommonAPI/Proxy.h> +#include <functional> +#include <future> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class BranchInterfaceProxyBase: virtual public CommonAPI::Proxy { + public: + + typedef std::function<void(const CommonAPI::CallStatus&, const BranchInterface::testBranchMethodError&, const int32_t&, const std::string&)> TestBranchMethodAsyncCallback; + + + + virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) = 0; + virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback) = 0; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_H_ diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStub.h b/src/test/commonapi/tests/managed/BranchInterfaceStub.h new file mode 100644 index 0000000..8f90cfa --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceStub.h @@ -0,0 +1,91 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_H_ +#define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_H_ + + + + +#include "BranchInterface.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#include <CommonAPI/Stub.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +/** + * Receives messages from remote and handles all dispatching of deserialized calls + * to a stub for the service BranchInterface. Also provides means to send broadcasts + * and attribute-changed-notifications of observable attributes as defined by this service. + * An application developer should not need to bother with this class. + */ +class BranchInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public BranchInterface { + public: + + + + virtual void deactivateManagedInstances() = 0; + +protected: + /** + * Defines properties for storing the ClientIds of clients / proxies that have + * subscribed to the selective broadcasts + */ +}; + + +/** + * Defines the necessary callbacks to handle remote set events related to the attributes + * defined in the IDL description for BranchInterface. + * For each attribute two callbacks are defined: + * - a verification callback that allows to verify the requested value and to prevent setting + * e.g. an invalid value ("onRemoteSet<AttributeName>"). + * - an action callback to do local work after the attribute value has been changed + * ("onRemote<AttributeName>Changed"). + * + * This class and the one below are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class BranchInterfaceStubRemoteEvent { + public: + virtual ~BranchInterfaceStubRemoteEvent() { } + +}; + + +/** + * Defines the interface that must be implemented by any class that should provide + * the service BranchInterface to remote clients. + * This class and the one above are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class BranchInterfaceStub : public CommonAPI::Stub<BranchInterfaceStubAdapter , BranchInterfaceStubRemoteEvent> { + public: + virtual ~BranchInterfaceStub() { } + + + /// 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; + +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_H_ diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp new file mode 100644 index 0000000..1fa2a8f --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp @@ -0,0 +1,43 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include <commonapi/tests/managed/BranchInterfaceStubDefault.h> + +namespace commonapi { +namespace tests { +namespace managed { + +BranchInterfaceStubDefault::BranchInterfaceStubDefault(): + remoteEventHandler_(this) { +} + +BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter) { + stubAdapter_ = stubAdapter; + return &remoteEventHandler_; +} + + +void BranchInterfaceStubDefault::testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) { + // Call old style methods in default + testBranchMethod(inInt, inString, methodError, outInt, outString); +} +void BranchInterfaceStubDefault::testBranchMethod(int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) { + // No operation in default +} + + + + +BranchInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(BranchInterfaceStubDefault* defaultStub): + defaultStub_(defaultStub) { +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h new file mode 100644 index 0000000..b2dab45 --- /dev/null +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h @@ -0,0 +1,63 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_H_ +#define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_H_ + +#include <commonapi/tests/managed/BranchInterfaceStub.h> +#include <sstream> + +namespace commonapi { +namespace tests { +namespace managed { + +/** + * Provides a default implementation for BranchInterfaceStubRemoteEvent and + * BranchInterfaceStub. Method callbacks have an empty implementation, + * remote set calls on attributes will always change the value of the attribute + * to the one received. + * + * Override this stub if you only want to provide a subset of the functionality + * that would be defined for this service, and/or if you do not need any non-default + * behaviour. + */ +class BranchInterfaceStubDefault : public BranchInterfaceStub { + public: + BranchInterfaceStubDefault(); + + BranchInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter); + + + 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: + std::shared_ptr<BranchInterfaceStubAdapter> stubAdapter_; + private: + class RemoteEventHandler: public BranchInterfaceStubRemoteEvent { + public: + RemoteEventHandler(BranchInterfaceStubDefault* defaultStub); + + + private: + BranchInterfaceStubDefault* defaultStub_; + }; + + RemoteEventHandler remoteEventHandler_; + +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_H_ diff --git a/src/test/commonapi/tests/managed/LeafInterface.h b/src/test/commonapi/tests/managed/LeafInterface.h new file mode 100644 index 0000000..1aaad3d --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterface.h @@ -0,0 +1,90 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_H_ +#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_H_ + + + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/InputStream.h> +#include <CommonAPI/OutputStream.h> +#include <CommonAPI/types.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class LeafInterface { + public: + virtual ~LeafInterface() { } + + static inline const char* getInterfaceId(); + static inline CommonAPI::Version getInterfaceVersion(); + enum class testLeafMethodError: int32_t { + OK, + NOTOK + }; + + // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1 + struct testLeafMethodErrorComparator; +}; + +const char* LeafInterface::getInterfaceId() { + static const char* interfaceId = "commonapi.tests.managed.LeafInterface"; + return interfaceId; +} + +CommonAPI::Version LeafInterface::getInterfaceVersion() { + return CommonAPI::Version(1, 0); +} + +inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, LeafInterface::testLeafMethodError& enumValue) { + return inputStream.readEnumValue<int32_t>(enumValue); +} + +inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const LeafInterface::testLeafMethodError& enumValue) { + return outputStream.writeEnumValue(static_cast<int32_t>(enumValue)); +} + +struct LeafInterface::testLeafMethodErrorComparator { + inline bool operator()(const testLeafMethodError& lhs, const testLeafMethodError& rhs) const { + return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs); + } +}; + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +namespace CommonAPI { + +} + + +namespace std { + //hashes for types + + //hashes for error types + //Hash for testLeafMethodError + template<> + struct hash<commonapi::tests::managed::LeafInterface::testLeafMethodError> { + inline size_t operator()(const commonapi::tests::managed::LeafInterface::testLeafMethodError& testLeafMethodError) const { + return static_cast<int32_t>(testLeafMethodError); + } + }; +} + +#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_H_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp new file mode 100644 index 0000000..a87c019 --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp @@ -0,0 +1,74 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "LeafInterfaceDBusProxy.h" + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusProxy> createLeafInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) { + return std::make_shared<LeafInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); +} + +__attribute__((constructor)) void registerLeafInterfaceDBusProxy(void) { + CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(LeafInterface::getInterfaceId(), + &createLeafInterfaceDBusProxy); +} + +LeafInterfaceDBusProxy::LeafInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection): + CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection) + { + } + + + +void LeafInterfaceDBusProxy::testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) { + CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>, + CommonAPI::DBus::DBusSerializableArguments<LeafInterface::testLeafMethodError, int32_t, std::string> >::callMethodWithReply( + *this, + "testLeafMethod", + "is", + inInt, inString, + callStatus, + methodError + , outInt, outString); +} +std::future<CommonAPI::CallStatus> LeafInterfaceDBusProxy::testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback) { + return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>, + CommonAPI::DBus::DBusSerializableArguments<LeafInterface::testLeafMethodError, int32_t, std::string> >::callMethodAsync( + *this, + "testLeafMethod", + "is", + inInt, inString, + std::move(callback)); +} + + + +void LeafInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const { + ownVersionMajor = 1; + ownVersionMinor = 0; +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h new file mode 100644 index 0000000..8653db4 --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h @@ -0,0 +1,61 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_H_ + +#include <commonapi/tests/managed/LeafInterfaceProxyBase.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusProxy.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +#include <string> + +namespace commonapi { +namespace tests { +namespace managed { + +class LeafInterfaceDBusProxy: virtual public LeafInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy { + public: + LeafInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection); + + virtual ~LeafInterfaceDBusProxy() { } + + + + virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); + virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback); + + + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; + + private: + + +}; + + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp new file mode 100644 index 0000000..2ff0d48 --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp @@ -0,0 +1,89 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* 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); +} + +LeafInterfaceDBusStubAdapter::LeafInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + LeafInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<LeafInterfaceStub>(stub), + NULL) + { +} + +LeafInterfaceDBusStubAdapter::~LeafInterfaceDBusStubAdapter() { + deactivateManagedInstances(); + deinit(); + stub_.reset(); +} + +void LeafInterfaceDBusStubAdapter::deactivateManagedInstances() { +} + +const char* LeafInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { + static const char* 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; +} + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + LeafInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> + > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + + + +const LeafInterfaceDBusStubAdapter::StubDispatcherTable& LeafInterfaceDBusStubAdapter::getStubDispatcherTable() { + static const LeafInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { + { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } + }; + return stubDispatcherTable; +} + + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h new file mode 100644 index 0000000..f67cc26 --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h @@ -0,0 +1,62 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_H_ +#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_H_ + +#include <commonapi/tests/managed/LeafInterfaceStub.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusStubAdapterHelper.h> +#include <CommonAPI/DBus/DBusStubAdapter.h> +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusServicePublisher.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +typedef CommonAPI::DBus::DBusStubAdapterHelper<LeafInterfaceStub> LeafInterfaceDBusStubAdapterHelper; + +class LeafInterfaceDBusStubAdapter: public LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper { + public: + LeafInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub); + + ~LeafInterfaceDBusStubAdapter(); + + + + + const StubDispatcherTable& getStubDispatcherTable(); + + void deactivateManagedInstances(); + + protected: + virtual const char* getMethodsDBusIntrospectionXmlData() const; + + private: +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_H_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h new file mode 100644 index 0000000..6001346 --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h @@ -0,0 +1,174 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_H_ + +#include "LeafInterfaceProxyBase.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +template <typename ... _AttributeExtensions> +class LeafInterfaceProxy: virtual public LeafInterface, virtual public LeafInterfaceProxyBase, public _AttributeExtensions... { + public: + LeafInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); + ~LeafInterfaceProxy(); + + + + /** + * Calls testLeafMethod with synchronous semantics. + * + * All const parameters are input parameters to this method. + * All non-const parameters will be filled with the returned values. + * The CallStatus will be filled when the method returns and indicate either + * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus + * will be set. + */ + virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); + /** + * Calls testLeafMethod with asynchronous semantics. + * + * The provided callback will be called when the reply to this call arrives or + * an error occurs during the call. The CallStatus will indicate either "SUCCESS" + * or which type of error has occurred. In case of any error, ONLY the CallStatus + * will have a defined value. + * The std::future returned by this method will be fulfilled at arrival of the reply. + * It will provide the same value for CallStatus as will be handed to the callback. + */ + virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback); + + + /** + * Returns the CommonAPI address of the remote partner this proxy communicates with. + */ + virtual std::string getAddress() const; + + /** + * Returns the domain of the remote partner this proxy communicates with. + */ + virtual const std::string& getDomain() const; + + /** + * Returns the service ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getServiceId() const; + + /** + * Returns the instance ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getInstanceId() const; + + /** + * Returns true if the remote partner for this proxy is currently known to be available. + */ + virtual bool isAvailable() const; + + /** + * Returns true if the remote partner for this proxy is available. + */ + virtual bool isAvailableBlocking() const; + + /** + * Returns the wrapper class that is used to (de-)register for notifications about + * the availability of the remote partner of this proxy. + */ + virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent(); + + /** + * Returns the wrapper class that is used to access version information of the remote + * partner of this proxy. + */ + virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute(); + + private: + std::shared_ptr<LeafInterfaceProxyBase> delegate_; +}; + + +// +// LeafInterfaceProxy Implementation +// +template <typename ... _AttributeExtensions> +LeafInterfaceProxy<_AttributeExtensions...>::LeafInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate): + delegate_(std::dynamic_pointer_cast<LeafInterfaceProxyBase>(delegate)), + _AttributeExtensions(*(std::dynamic_pointer_cast<LeafInterfaceProxyBase>(delegate)))... { +} + +template <typename ... _AttributeExtensions> +LeafInterfaceProxy<_AttributeExtensions...>::~LeafInterfaceProxy() { +} + +template <typename ... _AttributeExtensions> +void LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) { + delegate_->testLeafMethod(inInt, inString, callStatus, methodError, outInt, outString); +} + +template <typename ... _AttributeExtensions> +std::future<CommonAPI::CallStatus> LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback) { + return delegate_->testLeafMethodAsync(inInt, inString, callback); +} + +template <typename ... _AttributeExtensions> +std::string LeafInterfaceProxy<_AttributeExtensions...>::getAddress() const { + return delegate_->getAddress(); +} + +template <typename ... _AttributeExtensions> +const std::string& LeafInterfaceProxy<_AttributeExtensions...>::getDomain() const { + return delegate_->getDomain(); +} + +template <typename ... _AttributeExtensions> +const std::string& LeafInterfaceProxy<_AttributeExtensions...>::getServiceId() const { + return delegate_->getServiceId(); +} + +template <typename ... _AttributeExtensions> +const std::string& LeafInterfaceProxy<_AttributeExtensions...>::getInstanceId() const { + return delegate_->getInstanceId(); +} + +template <typename ... _AttributeExtensions> +bool LeafInterfaceProxy<_AttributeExtensions...>::isAvailable() const { + return delegate_->isAvailable(); +} + +template <typename ... _AttributeExtensions> +bool LeafInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const { + return delegate_->isAvailableBlocking(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::ProxyStatusEvent& LeafInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() { + return delegate_->getProxyStatusEvent(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::InterfaceVersionAttribute& LeafInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() { + return delegate_->getInterfaceVersionAttribute(); +} + + + +} // namespace managed +} // namespace tests +} // namespace commonapi + + +#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h b/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h new file mode 100644 index 0000000..a4eb7cb --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h @@ -0,0 +1,47 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_H_ +#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_H_ + +#include "LeafInterface.h" + + + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#include <CommonAPI/Proxy.h> +#include <functional> +#include <future> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class LeafInterfaceProxyBase: virtual public CommonAPI::Proxy { + public: + + typedef std::function<void(const CommonAPI::CallStatus&, const LeafInterface::testLeafMethodError&, const int32_t&, const std::string&)> TestLeafMethodAsyncCallback; + + + + virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) = 0; + virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback) = 0; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_H_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/commonapi/tests/managed/LeafInterfaceStub.h new file mode 100644 index 0000000..c41ecaa --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceStub.h @@ -0,0 +1,91 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_H_ +#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_H_ + + + + +#include "LeafInterface.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#include <CommonAPI/Stub.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +/** + * Receives messages from remote and handles all dispatching of deserialized calls + * to a stub for the service LeafInterface. Also provides means to send broadcasts + * and attribute-changed-notifications of observable attributes as defined by this service. + * An application developer should not need to bother with this class. + */ +class LeafInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public LeafInterface { + public: + + + + virtual void deactivateManagedInstances() = 0; + +protected: + /** + * Defines properties for storing the ClientIds of clients / proxies that have + * subscribed to the selective broadcasts + */ +}; + + +/** + * Defines the necessary callbacks to handle remote set events related to the attributes + * defined in the IDL description for LeafInterface. + * For each attribute two callbacks are defined: + * - a verification callback that allows to verify the requested value and to prevent setting + * e.g. an invalid value ("onRemoteSet<AttributeName>"). + * - an action callback to do local work after the attribute value has been changed + * ("onRemote<AttributeName>Changed"). + * + * This class and the one below are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class LeafInterfaceStubRemoteEvent { + public: + virtual ~LeafInterfaceStubRemoteEvent() { } + +}; + + +/** + * Defines the interface that must be implemented by any class that should provide + * the service LeafInterface to remote clients. + * This class and the one above are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class LeafInterfaceStub : public CommonAPI::Stub<LeafInterfaceStubAdapter , LeafInterfaceStubRemoteEvent> { + public: + virtual ~LeafInterfaceStub() { } + + + /// 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; + +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_H_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp new file mode 100644 index 0000000..2ce07be --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp @@ -0,0 +1,43 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. +*/ +#include <commonapi/tests/managed/LeafInterfaceStubDefault.h> + +namespace commonapi { +namespace tests { +namespace managed { + +LeafInterfaceStubDefault::LeafInterfaceStubDefault(): + remoteEventHandler_(this) { +} + +LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter) { + stubAdapter_ = stubAdapter; + return &remoteEventHandler_; +} + + +void LeafInterfaceStubDefault::testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) { + // Call old style methods in default + testLeafMethod(inInt, inString, methodError, outInt, outString); +} +void LeafInterfaceStubDefault::testLeafMethod(int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) { + // No operation in default +} + + + + +LeafInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LeafInterfaceStubDefault* defaultStub): + defaultStub_(defaultStub) { +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h new file mode 100644 index 0000000..ee324c3 --- /dev/null +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h @@ -0,0 +1,63 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_H_ +#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_H_ + +#include <commonapi/tests/managed/LeafInterfaceStub.h> +#include <sstream> + +namespace commonapi { +namespace tests { +namespace managed { + +/** + * Provides a default implementation for LeafInterfaceStubRemoteEvent and + * LeafInterfaceStub. Method callbacks have an empty implementation, + * remote set calls on attributes will always change the value of the attribute + * to the one received. + * + * Override this stub if you only want to provide a subset of the functionality + * that would be defined for this service, and/or if you do not need any non-default + * behaviour. + */ +class LeafInterfaceStubDefault : public LeafInterfaceStub { + public: + LeafInterfaceStubDefault(); + + LeafInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter); + + + virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); + virtual void testLeafMethod(int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); + + + + + protected: + std::shared_ptr<LeafInterfaceStubAdapter> stubAdapter_; + private: + class RemoteEventHandler: public LeafInterfaceStubRemoteEvent { + public: + RemoteEventHandler(LeafInterfaceStubDefault* defaultStub); + + + private: + LeafInterfaceStubDefault* defaultStub_; + }; + + RemoteEventHandler remoteEventHandler_; + +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_H_ diff --git a/src/test/commonapi/tests/managed/RootInterface.h b/src/test/commonapi/tests/managed/RootInterface.h new file mode 100644 index 0000000..398e60c --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterface.h @@ -0,0 +1,91 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_H_ +#define COMMONAPI_TESTS_MANAGED_Root_Interface_H_ + + +#include <set> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/InputStream.h> +#include <CommonAPI/OutputStream.h> +#include <CommonAPI/types.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class RootInterface { + public: + virtual ~RootInterface() { } + + static inline const char* getInterfaceId(); + static inline CommonAPI::Version getInterfaceVersion(); + enum class testRootMethodError: int32_t { + OK, + NOTOK + }; + + // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1 + struct testRootMethodErrorComparator; +}; + +const char* RootInterface::getInterfaceId() { + static const char* interfaceId = "commonapi.tests.managed.RootInterface"; + return interfaceId; +} + +CommonAPI::Version RootInterface::getInterfaceVersion() { + return CommonAPI::Version(1, 0); +} + +inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, RootInterface::testRootMethodError& enumValue) { + return inputStream.readEnumValue<int32_t>(enumValue); +} + +inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const RootInterface::testRootMethodError& enumValue) { + return outputStream.writeEnumValue(static_cast<int32_t>(enumValue)); +} + +struct RootInterface::testRootMethodErrorComparator { + inline bool operator()(const testRootMethodError& lhs, const testRootMethodError& rhs) const { + return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs); + } +}; + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +namespace CommonAPI { + +} + + +namespace std { + //hashes for types + + //hashes for error types + //Hash for testRootMethodError + template<> + struct hash<commonapi::tests::managed::RootInterface::testRootMethodError> { + inline size_t operator()(const commonapi::tests::managed::RootInterface::testRootMethodError& testRootMethodError) const { + return static_cast<int32_t>(testRootMethodError); + } + }; +} + +#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_H_ diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp new file mode 100644 index 0000000..4d74952 --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp @@ -0,0 +1,82 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "RootInterfaceDBusProxy.h" + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusProxy> createRootInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) { + return std::make_shared<RootInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); +} + +__attribute__((constructor)) void registerRootInterfaceDBusProxy(void) { + CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(RootInterface::getInterfaceId(), + &createRootInterfaceDBusProxy); +} + +RootInterfaceDBusProxy::RootInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection): + CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection) +, proxyManagerLeafInterface_(*this, "commonapi.tests.managed.LeafInterface", factory), + proxyManagerBranchInterface_(*this, "commonapi.tests.managed.BranchInterface", factory) + { + } + + + +void RootInterfaceDBusProxy::testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) { + CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>, + CommonAPI::DBus::DBusSerializableArguments<RootInterface::testRootMethodError, int32_t, std::string> >::callMethodWithReply( + *this, + "testRootMethod", + "is", + inInt, inString, + callStatus, + methodError + , outInt, outString); +} +std::future<CommonAPI::CallStatus> RootInterfaceDBusProxy::testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback) { + return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<int32_t, std::string>, + CommonAPI::DBus::DBusSerializableArguments<RootInterface::testRootMethodError, int32_t, std::string> >::callMethodAsync( + *this, + "testRootMethod", + "is", + inInt, inString, + std::move(callback)); +} + +CommonAPI::ProxyManager& RootInterfaceDBusProxy::getProxyManagerLeafInterface() { + return proxyManagerLeafInterface_; +} +CommonAPI::ProxyManager& RootInterfaceDBusProxy::getProxyManagerBranchInterface() { + return proxyManagerBranchInterface_; +} + + +void RootInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const { + ownVersionMajor = 1; + ownVersionMinor = 0; +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h new file mode 100644 index 0000000..5aaf63f --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h @@ -0,0 +1,66 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_H_ + +#include <commonapi/tests/managed/RootInterfaceProxyBase.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusProxy.h> +#include <CommonAPI/DBus/DBusProxyManager.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +#include <string> + +namespace commonapi { +namespace tests { +namespace managed { + +class RootInterfaceDBusProxy: virtual public RootInterfaceProxyBase, virtual public CommonAPI::DBus::DBusProxy { + public: + RootInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection); + + virtual ~RootInterfaceDBusProxy() { } + + + + virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); + virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback); + + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); + virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface(); + + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; + + private: + + + CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_; + CommonAPI::DBus::DBusProxyManager proxyManagerBranchInterface_; +}; + + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp new file mode 100644 index 0000000..1a3a6dc --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp @@ -0,0 +1,203 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* 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); +} + +RootInterfaceDBusStubAdapter::RootInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + RootInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<RootInterfaceStub>(stub), + new CommonAPI::DBus::DBusObjectManagerStub(dbusObjectPath, dbusConnection)) + { +} + +RootInterfaceDBusStubAdapter::~RootInterfaceDBusStubAdapter() { + deactivateManagedInstances(); + deinit(); + stub_.reset(); +} + +void RootInterfaceDBusStubAdapter::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* RootInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { + static const char* 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; +} + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + RootInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<RootInterface::testRootMethodError, int32_t, std::string> + > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + + + +const RootInterfaceDBusStubAdapter::StubDispatcherTable& RootInterfaceDBusStubAdapter::getStubDispatcherTable() { + static const RootInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { + { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } + }; + return stubDispatcherTable; +} + + +bool RootInterfaceDBusStubAdapter::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 ok = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (ok) { + bool isServiceExportSuccessful = managerStub->exportDBusStubAdapter(dbusStubAdapter.get()); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool RootInterfaceDBusStubAdapter::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> adapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (adapter != nullptr) { + managerStub->unexportDBusStubAdapter(adapter.get()); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& RootInterfaceDBusStubAdapter::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; +} + +bool RootInterfaceDBusStubAdapter::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 ok = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (ok) { + bool isServiceExportSuccessful = managerStub->exportDBusStubAdapter(dbusStubAdapter.get()); + if (isServiceExportSuccessful) { + registeredBranchInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool RootInterfaceDBusStubAdapter::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> adapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (adapter != nullptr) { + managerStub->unexportDBusStubAdapter(adapter.get()); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredBranchInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& RootInterfaceDBusStubAdapter::getBranchInterfaceInstances() { + return registeredBranchInterfaceInstances; +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h new file mode 100644 index 0000000..a3fd482 --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h @@ -0,0 +1,70 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_H_ +#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_H_ + +#include <commonapi/tests/managed/RootInterfaceStub.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusStubAdapterHelper.h> +#include <CommonAPI/DBus/DBusStubAdapter.h> +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusServicePublisher.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +typedef CommonAPI::DBus::DBusStubAdapterHelper<RootInterfaceStub> RootInterfaceDBusStubAdapterHelper; + +class RootInterfaceDBusStubAdapter: public RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper { + public: + RootInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub); + + ~RootInterfaceDBusStubAdapter(); + + + + bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); + bool deregisterManagedStubLeafInterface(const std::string&); + std::set<std::string>& getLeafInterfaceInstances(); + bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&); + bool deregisterManagedStubBranchInterface(const std::string&); + std::set<std::string>& getBranchInterfaceInstances(); + + const StubDispatcherTable& getStubDispatcherTable(); + + void deactivateManagedInstances(); + + protected: + virtual const char* getMethodsDBusIntrospectionXmlData() const; + + private: + std::set<std::string> registeredLeafInterfaceInstances; + std::set<std::string> registeredBranchInterfaceInstances; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_H_ diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxy.h b/src/test/commonapi/tests/managed/RootInterfaceProxy.h new file mode 100644 index 0000000..17f570a --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceProxy.h @@ -0,0 +1,184 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_H_ + +#include "RootInterfaceProxyBase.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +template <typename ... _AttributeExtensions> +class RootInterfaceProxy: virtual public RootInterface, virtual public RootInterfaceProxyBase, public _AttributeExtensions... { + public: + RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); + ~RootInterfaceProxy(); + + + + /** + * Calls testRootMethod with synchronous semantics. + * + * All const parameters are input parameters to this method. + * All non-const parameters will be filled with the returned values. + * The CallStatus will be filled when the method returns and indicate either + * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus + * will be set. + */ + virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); + /** + * Calls testRootMethod with asynchronous semantics. + * + * The provided callback will be called when the reply to this call arrives or + * an error occurs during the call. The CallStatus will indicate either "SUCCESS" + * or which type of error has occurred. In case of any error, ONLY the CallStatus + * will have a defined value. + * The std::future returned by this method will be fulfilled at arrival of the reply. + * It will provide the same value for CallStatus as will be handed to the callback. + */ + virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback); + + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); + virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface(); + + /** + * Returns the CommonAPI address of the remote partner this proxy communicates with. + */ + virtual std::string getAddress() const; + + /** + * Returns the domain of the remote partner this proxy communicates with. + */ + virtual const std::string& getDomain() const; + + /** + * Returns the service ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getServiceId() const; + + /** + * Returns the instance ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getInstanceId() const; + + /** + * Returns true if the remote partner for this proxy is currently known to be available. + */ + virtual bool isAvailable() const; + + /** + * Returns true if the remote partner for this proxy is available. + */ + virtual bool isAvailableBlocking() const; + + /** + * Returns the wrapper class that is used to (de-)register for notifications about + * the availability of the remote partner of this proxy. + */ + virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent(); + + /** + * Returns the wrapper class that is used to access version information of the remote + * partner of this proxy. + */ + virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute(); + + private: + std::shared_ptr<RootInterfaceProxyBase> delegate_; +}; + + +// +// RootInterfaceProxy Implementation +// +template <typename ... _AttributeExtensions> +RootInterfaceProxy<_AttributeExtensions...>::RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate): + delegate_(std::dynamic_pointer_cast<RootInterfaceProxyBase>(delegate)), + _AttributeExtensions(*(std::dynamic_pointer_cast<RootInterfaceProxyBase>(delegate)))... { +} + +template <typename ... _AttributeExtensions> +RootInterfaceProxy<_AttributeExtensions...>::~RootInterfaceProxy() { +} + +template <typename ... _AttributeExtensions> +void RootInterfaceProxy<_AttributeExtensions...>::testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) { + delegate_->testRootMethod(inInt, inString, callStatus, methodError, outInt, outString); +} + +template <typename ... _AttributeExtensions> +std::future<CommonAPI::CallStatus> RootInterfaceProxy<_AttributeExtensions...>::testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback) { + return delegate_->testRootMethodAsync(inInt, inString, callback); +} + +template <typename ... _AttributeExtensions> +std::string RootInterfaceProxy<_AttributeExtensions...>::getAddress() const { + return delegate_->getAddress(); +} + +template <typename ... _AttributeExtensions> +const std::string& RootInterfaceProxy<_AttributeExtensions...>::getDomain() const { + return delegate_->getDomain(); +} + +template <typename ... _AttributeExtensions> +const std::string& RootInterfaceProxy<_AttributeExtensions...>::getServiceId() const { + return delegate_->getServiceId(); +} + +template <typename ... _AttributeExtensions> +const std::string& RootInterfaceProxy<_AttributeExtensions...>::getInstanceId() const { + return delegate_->getInstanceId(); +} + +template <typename ... _AttributeExtensions> +bool RootInterfaceProxy<_AttributeExtensions...>::isAvailable() const { + return delegate_->isAvailable(); +} + +template <typename ... _AttributeExtensions> +bool RootInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const { + return delegate_->isAvailableBlocking(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::ProxyStatusEvent& RootInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() { + return delegate_->getProxyStatusEvent(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::InterfaceVersionAttribute& RootInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() { + return delegate_->getInterfaceVersionAttribute(); +} + + +template <typename ... _AttributeExtensions> +CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() { + return delegate_->getProxyManagerLeafInterface(); +} +template <typename ... _AttributeExtensions> +CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyManagerBranchInterface() { + return delegate_->getProxyManagerBranchInterface(); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi + + +#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h new file mode 100644 index 0000000..ca8a693 --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h @@ -0,0 +1,52 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_H_ +#define COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_H_ + +#include "RootInterface.h" + + +#include <commonapi/tests/managed/BranchInterfaceStub.h> +#include <commonapi/tests/managed/LeafInterfaceStub.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#include <CommonAPI/ProxyManager.h> +#include <CommonAPI/Proxy.h> +#include <functional> +#include <future> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class RootInterfaceProxyBase: virtual public CommonAPI::Proxy { + public: + + typedef std::function<void(const CommonAPI::CallStatus&, const RootInterface::testRootMethodError&, const int32_t&, const std::string&)> TestRootMethodAsyncCallback; + + + + virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) = 0; + virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback) = 0; + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface() = 0; + virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface() = 0; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_H_ diff --git a/src/test/commonapi/tests/managed/RootInterfaceStub.h b/src/test/commonapi/tests/managed/RootInterfaceStub.h new file mode 100644 index 0000000..c0c5da9 --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceStub.h @@ -0,0 +1,105 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_H_ +#define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_H_ + + + +#include <commonapi/tests/managed/BranchInterfaceStub.h> +#include <commonapi/tests/managed/LeafInterfaceStub.h> + +#include "RootInterface.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#include <CommonAPI/Stub.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +/** + * Receives messages from remote and handles all dispatching of deserialized calls + * to a stub for the service RootInterface. Also provides means to send broadcasts + * and attribute-changed-notifications of observable attributes as defined by this service. + * An application developer should not need to bother with this class. + */ +class RootInterfaceStubAdapter: 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 + * subscribed to the selective broadcasts + */ +}; + + +/** + * Defines the necessary callbacks to handle remote set events related to the attributes + * defined in the IDL description for RootInterface. + * For each attribute two callbacks are defined: + * - a verification callback that allows to verify the requested value and to prevent setting + * e.g. an invalid value ("onRemoteSet<AttributeName>"). + * - an action callback to do local work after the attribute value has been changed + * ("onRemote<AttributeName>Changed"). + * + * This class and the one below are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class RootInterfaceStubRemoteEvent { + public: + virtual ~RootInterfaceStubRemoteEvent() { } + +}; + + +/** + * Defines the interface that must be implemented by any class that should provide + * the service RootInterface to remote clients. + * This class and the one above are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class RootInterfaceStub : public CommonAPI::Stub<RootInterfaceStubAdapter , RootInterfaceStubRemoteEvent> { + public: + virtual ~RootInterfaceStub() { } + + + /// 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; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_H_ diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp new file mode 100644 index 0000000..f4d39d1 --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp @@ -0,0 +1,76 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include <commonapi/tests/managed/RootInterfaceStubDefault.h> + +namespace commonapi { +namespace tests { +namespace managed { + +RootInterfaceStubDefault::RootInterfaceStubDefault(): + autoInstanceCounter_(0), + remoteEventHandler_(this) { +} + +RootInterfaceStubRemoteEvent* RootInterfaceStubDefault::initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter) { + stubAdapter_ = stubAdapter; + return &remoteEventHandler_; +} + + +void RootInterfaceStubDefault::testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) { + // Call old style methods in default + testRootMethod(inInt, inString, methodError, outInt, outString); +} +void RootInterfaceStubDefault::testRootMethod(int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) { + // No operation in default +} + + + +bool RootInterfaceStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub> stub) { + autoInstanceCounter_++; + std::stringstream ss; + ss << stubAdapter_->getInstanceId() << "." << autoInstanceCounter_; + std::string instance = ss.str(); + return stubAdapter_->registerManagedStubLeafInterface(stub, instance); +} +bool RootInterfaceStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + return stubAdapter_->registerManagedStubLeafInterface(stub, instance); +} +bool RootInterfaceStubDefault::deregisterManagedStubLeafInterface(const std::string& instance) { + return stubAdapter_->deregisterManagedStubLeafInterface(instance); +} +std::set<std::string>& RootInterfaceStubDefault::getLeafInterfaceInstances() { + return stubAdapter_->getLeafInterfaceInstances(); +} +bool RootInterfaceStubDefault::registerManagedStubBranchInterfaceAutoInstance(std::shared_ptr<BranchInterfaceStub> stub) { + autoInstanceCounter_++; + std::stringstream ss; + ss << stubAdapter_->getInstanceId() << "." << autoInstanceCounter_; + std::string instance = ss.str(); + return stubAdapter_->registerManagedStubBranchInterface(stub, instance); +} +bool RootInterfaceStubDefault::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) { + return stubAdapter_->registerManagedStubBranchInterface(stub, instance); +} +bool RootInterfaceStubDefault::deregisterManagedStubBranchInterface(const std::string& instance) { + return stubAdapter_->deregisterManagedStubBranchInterface(instance); +} +std::set<std::string>& RootInterfaceStubDefault::getBranchInterfaceInstances() { + return stubAdapter_->getBranchInterfaceInstances(); +} + +RootInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(RootInterfaceStubDefault* defaultStub): + defaultStub_(defaultStub) { +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h new file mode 100644 index 0000000..c2e0620 --- /dev/null +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h @@ -0,0 +1,72 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.0.qualifier. +* Used org.franca.core 0.8.9.201308271211. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_H_ +#define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_H_ + +#include <commonapi/tests/managed/RootInterfaceStub.h> +#include <sstream> + +namespace commonapi { +namespace tests { +namespace managed { + +/** + * Provides a default implementation for RootInterfaceStubRemoteEvent and + * RootInterfaceStub. Method callbacks have an empty implementation, + * remote set calls on attributes will always change the value of the attribute + * to the one received. + * + * Override this stub if you only want to provide a subset of the functionality + * that would be defined for this service, and/or if you do not need any non-default + * behaviour. + */ +class RootInterfaceStubDefault : public RootInterfaceStub { + public: + RootInterfaceStubDefault(); + + RootInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter); + + + 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&); + std::set<std::string>& getLeafInterfaceInstances(); + bool registerManagedStubBranchInterfaceAutoInstance(std::shared_ptr<BranchInterfaceStub>); + bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&); + bool deregisterManagedStubBranchInterface(const std::string&); + std::set<std::string>& getBranchInterfaceInstances(); + + protected: + std::shared_ptr<RootInterfaceStubAdapter> stubAdapter_; + private: + class RemoteEventHandler: public RootInterfaceStubRemoteEvent { + public: + RemoteEventHandler(RootInterfaceStubDefault* defaultStub); + + + private: + RootInterfaceStubDefault* defaultStub_; + }; + + RemoteEventHandler remoteEventHandler_; + uint32_t autoInstanceCounter_; + +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_H_ |