/* * This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 3.1.2.v201507021046. * Used org.franca.core 0.9.1.201412191134. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. * If a copy of the MPL was not distributed with this file, You can obtain one at * http://mozilla.org/MPL/2.0/. */ #include #include namespace v1_0 { namespace commonapi { namespace tests { std::shared_ptr createTestInterfaceDBusStubAdapter( const CommonAPI::DBus::DBusAddress &_address, const std::shared_ptr &_connection, const std::shared_ptr &_stub) { return std::make_shared(_address, _connection, _stub); } INITIALIZER(registerTestInterfaceDBusStubAdapter) { CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod( TestInterface::getInterface(), &createTestInterfaceDBusStubAdapter); } TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() { deactivateManagedInstances(); TestInterfaceDBusStubAdapterHelper::deinit(); } void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { } const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { static const std::string introspectionData = "\n" "" "\n" "\n" "" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" ; return introspectionData.c_str(); } CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, CommonAPI::Version > TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, uint32_t > TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute , "u" ); CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< TestInterfaceStub, uint32_t > TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged ,&TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged ,"u" ); CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, ::commonapi::tests::DerivedTypeCollection::TestStructExtended, ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t > TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestDerivedStructAttributeAttribute , "(sqi)" ); CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< TestInterfaceStub, ::commonapi::tests::DerivedTypeCollection::TestStructExtended, ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t > TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestDerivedStructAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged ,&TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged ,"(sqi)" ); CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64, ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t > TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestDerivedArrayAttributeAttribute , "at" ); CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< TestInterfaceStub, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64, ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t > TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged ,&TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged ,"at" ); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<>, std::tuple<>, std::tuple<>, std::tuple<> > TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher( &TestInterfaceStub::testEmptyMethod, "", std::make_tuple(), std::make_tuple()); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple, std::tuple<>, std::tuple, std::tuple<> > TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher( &TestInterfaceStub::testVoidPredefinedTypeMethod, "", std::make_tuple(static_cast(nullptr), static_cast(nullptr)), std::make_tuple()); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple, std::tuple, std::tuple, std::tuple > TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher( &TestInterfaceStub::testPredefinedTypeMethod, "us", std::make_tuple(static_cast(nullptr), static_cast(nullptr)), std::make_tuple(static_cast(nullptr), static_cast(nullptr))); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>, std::tuple<>, std::tuple, std::tuple<> > TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher( &TestInterfaceStub::testVoidDerivedTypeMethod, "", std::make_tuple(static_cast(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)), std::make_tuple()); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>, std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>, std::tuple, std::tuple > TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher( &TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}", std::make_tuple(static_cast(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)), std::make_tuple(static_cast(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr))); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple>>, std::tuple<>, std::tuple>, std::tuple<> > TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher( &TestInterfaceStub::TestArrayOfPolymorphicStructMethod, "", std::make_tuple(static_cast*>(nullptr)), std::make_tuple()); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>, std::tuple<>, std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>, std::tuple<> > TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher( &TestInterfaceStub::TestMapOfPolymorphicStructMethod, "", std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t*>(nullptr)), std::make_tuple()); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>, std::tuple<>, std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>, std::tuple<> > TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher( &TestInterfaceStub::TestStructWithPolymorphicMemberMethod, "", std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t*>(nullptr)), std::make_tuple()); CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>, std::tuple<>, std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>, std::tuple<> > TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher( &TestInterfaceStub::TestStructWithEnumKeyMapMember, "", std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t*>(nullptr)), std::make_tuple()); void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { CommonAPI::DBus::DBusStubSignalHelper> ::sendSignal( *this, "onTestPredefinedTypeAttributeAttributeChanged", "u", value ); } void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value) { CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestStructExtended, ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t> deployedValue(value, static_cast<::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t*>(nullptr)); CommonAPI::DBus::DBusStubSignalHelper >> ::sendSignal( *this, "onTestDerivedStructAttributeAttributeChanged", "(sqi)", deployedValue ); } void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value) { CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestArrayUInt64, ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t> deployedValue(value, static_cast<::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t*>(nullptr)); CommonAPI::DBus::DBusStubSignalHelper >> ::sendSignal( *this, "onTestDerivedArrayAttributeAttributeChanged", "at", deployedValue ); } void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { CommonAPI::DBus::DBusStubSignalHelper >>::sendSignal( *this, "TestPredefinedTypeBroadcast", "us", uint32Value, CommonAPI::Deployable(stringValue, static_cast(nullptr)) ); } CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple > TestInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple<> > TestInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr _client) { std::shared_ptr dbusClient = std::dynamic_pointer_cast(_client); if(dbusClient) { CommonAPI::DBus::DBusStubSignalHelper>::sendSignal( dbusClient->getDBusId(), *this, "TestSelectiveBroadcast", "" ); } } void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr _receivers) { std::shared_ptr actualReceiverList = _receivers; if (!_receivers) actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) { if (!_receivers || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { fireTestSelectiveBroadcastSelective(*clientIdIterator); } } } void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr clientId, bool& success) { bool ok = TestInterfaceDBusStubAdapterHelper::stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); if (ok) { subscribersForTestSelectiveBroadcastSelective_->insert(clientId); TestInterfaceDBusStubAdapterHelper::stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); success = true; } else { success = false; } } void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr clientId) { subscribersForTestSelectiveBroadcastSelective_->erase(clientId); TestInterfaceDBusStubAdapterHelper::stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); } std::shared_ptr const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() { return subscribersForTestSelectiveBroadcastSelective_; } CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple > TestInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple<> > TestInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr _client, const uint32_t &_uint32Value, const std::string &_stringValue) { std::shared_ptr dbusClient = std::dynamic_pointer_cast(_client); if(dbusClient) { CommonAPI::DBus::DBusStubSignalHelper >>::sendSignal( dbusClient->getDBusId(), *this, "TestBroadcastWithOutArgs", "us", _uint32Value, CommonAPI::Deployable(_stringValue, static_cast(nullptr)) ); } } void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr _receivers) { std::shared_ptr actualReceiverList = _receivers; if (!_receivers) actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) { if (!_receivers || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { fireTestBroadcastWithOutArgsSelective(*clientIdIterator, _uint32Value, _stringValue); } } } void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr clientId, bool& success) { bool ok = TestInterfaceDBusStubAdapterHelper::stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); if (ok) { subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); TestInterfaceDBusStubAdapterHelper::stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); success = true; } else { success = false; } } void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr clientId) { subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); TestInterfaceDBusStubAdapterHelper::stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); } std::shared_ptr const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() { return subscribersForTestBroadcastWithOutArgsSelective_; } const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { return stubDispatcherTable_; } const CommonAPI::DBus::StubAttributeTable& TestInterfaceDBusStubAdapterInternal::getStubAttributeTable() { return stubAttributeTable_; } TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal( const CommonAPI::DBus::DBusAddress &_address, const std::shared_ptr &_connection, const std::shared_ptr &_stub) : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false), TestInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast(_stub), false), stubDispatcherTable_({ { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher } , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher }, { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher } , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher }, { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher } , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher } , { { "testEmptyMethod", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher }, { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher }, { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher }, { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher }, { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher }, { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher }, { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher }, { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher }, { { "TestStructWithEnumKeyMapMember", "(a{is})" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher } , { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher } , { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } , { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } }), stubAttributeTable_() { subscribersForTestSelectiveBroadcastSelective_ = std::make_shared(); subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared(); stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher }); } const bool TestInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() { return false; } } // namespace tests } // namespace commonapi } // namespace v1_0