diff options
Diffstat (limited to 'src/test/commonapi/tests/managed')
15 files changed, 814 insertions, 25 deletions
diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h index 6001346..94f8bcb 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h @@ -1,11 +1,11 @@ /* * 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. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.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_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h b/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h index a4eb7cb..7e8d718 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h @@ -1,11 +1,11 @@ /* * 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. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.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_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/commonapi/tests/managed/LeafInterfaceStub.h index c41ecaa..d31561b 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStub.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStub.h @@ -1,11 +1,11 @@ /* * 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. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.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_ diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp index 2ce07be..01dd58b 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp @@ -1,11 +1,11 @@ /* * 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. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.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> diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h index ee324c3..fdedc9c 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h @@ -1,11 +1,11 @@ /* * 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. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.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_ diff --git a/src/test/commonapi/tests/managed/SecondRoot.h b/src/test/commonapi/tests/managed/SecondRoot.h new file mode 100644 index 0000000..0b55364 --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRoot.h @@ -0,0 +1,61 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_H_ +#define COMMONAPI_TESTS_MANAGED_Second_Root_H_ + + +#include <set> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/types.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class SecondRoot { + public: + virtual ~SecondRoot() { } + + static inline const char* getInterfaceId(); + static inline CommonAPI::Version getInterfaceVersion(); +}; + +const char* SecondRoot::getInterfaceId() { + static const char* interfaceId = "commonapi.tests.managed.SecondRoot"; + return interfaceId; +} + +CommonAPI::Version SecondRoot::getInterfaceVersion() { + return CommonAPI::Version(1, 0); +} + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +namespace CommonAPI { + +} + + +namespace std { + //hashes for types + + //hashes for error types +} + +#endif // COMMONAPI_TESTS_MANAGED_Second_Root_H_ diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp new file mode 100644 index 0000000..b1eb31a --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp @@ -0,0 +1,58 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "SecondRootDBusProxy.h" + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusProxy> createSecondRootDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) { + return std::make_shared<SecondRootDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); +} + +__attribute__((constructor)) void registerSecondRootDBusProxy(void) { + CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(SecondRoot::getInterfaceId(), + &createSecondRootDBusProxy); +} + +SecondRootDBusProxy::SecondRootDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection): + CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection) +, proxyManagerLeafInterface_(*this, "commonapi.tests.managed.LeafInterface", factory) + { + } + + + + +CommonAPI::ProxyManager& SecondRootDBusProxy::getProxyManagerLeafInterface() { + return proxyManagerLeafInterface_; +} + + +void SecondRootDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const { + ownVersionMajor = 1; + ownVersionMinor = 0; +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h new file mode 100644 index 0000000..4942927 --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h @@ -0,0 +1,62 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_H_ + +#include <commonapi/tests/managed/SecondRootProxyBase.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusProxy.h> +#include <CommonAPI/DBus/DBusProxyManager.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +#include <string> + +namespace commonapi { +namespace tests { +namespace managed { + +class SecondRootDBusProxy: virtual public SecondRootProxyBase, virtual public CommonAPI::DBus::DBusProxy { + public: + SecondRootDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection); + + virtual ~SecondRootDBusProxy() { } + + + + + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); + + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; + + private: + + + CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_; +}; + + + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp new file mode 100644 index 0000000..e7e7719 --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp @@ -0,0 +1,135 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "SecondRootDBusStubAdapter.h" +#include <commonapi/tests/managed/SecondRoot.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), + &createSecondRootDBusStubAdapter); +} + +SecondRootDBusStubAdapter::SecondRootDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + SecondRootDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<SecondRootStub>(stub), + true) { +} + +SecondRootDBusStubAdapter::~SecondRootDBusStubAdapter() { + deactivateManagedInstances(); + deinit(); + stub_.reset(); +} + +void SecondRootDBusStubAdapter::deactivateManagedInstances() { + for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); + iter != registeredLeafInterfaceInstances.end(); ++iter) { + deregisterManagedStubLeafInterface(*iter); + } +} + +const char* SecondRootDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { + static const char* introspectionData = + + "" + ; + return introspectionData; +} + + + + + + +const SecondRootDBusStubAdapter::StubDispatcherTable& SecondRootDBusStubAdapter::getStubDispatcherTable() { + static const SecondRootDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { + }; + return stubDispatcherTable; +} + + +bool SecondRootDBusStubAdapter::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", + instance, "commonapi.tests.managed.LeafInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool SecondRootDBusStubAdapter::deregisterManagedStubLeafInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& SecondRootDBusStubAdapter::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h new file mode 100644 index 0000000..8fdb7dc --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h @@ -0,0 +1,66 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_H_ +#define COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_H_ + +#include <commonapi/tests/managed/SecondRootStub.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusStubAdapterHelper.h> +#include <CommonAPI/DBus/DBusStubAdapter.h> +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusServicePublisher.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +typedef CommonAPI::DBus::DBusStubAdapterHelper<SecondRootStub> SecondRootDBusStubAdapterHelper; + +class SecondRootDBusStubAdapter: public SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper { + public: + SecondRootDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub); + + ~SecondRootDBusStubAdapter(); + + + + bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); + bool deregisterManagedStubLeafInterface(const std::string&); + std::set<std::string>& getLeafInterfaceInstances(); + + const StubDispatcherTable& getStubDispatcherTable(); + + void deactivateManagedInstances(); + + protected: + virtual const char* getMethodsDBusIntrospectionXmlData() const; + + private: + std::set<std::string> registeredLeafInterfaceInstances; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_H_ diff --git a/src/test/commonapi/tests/managed/SecondRootProxy.h b/src/test/commonapi/tests/managed/SecondRootProxy.h new file mode 100644 index 0000000..2eb8cc1 --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootProxy.h @@ -0,0 +1,149 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_H_ +#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_H_ + +#include "SecondRootProxyBase.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 SecondRootProxy: virtual public SecondRoot, virtual public SecondRootProxyBase, public _AttributeExtensions... { + public: + SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate); + ~SecondRootProxy(); + + + + + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); + + /** + * 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<SecondRootProxyBase> delegate_; +}; + + +// +// SecondRootProxy Implementation +// +template <typename ... _AttributeExtensions> +SecondRootProxy<_AttributeExtensions...>::SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate): + delegate_(std::dynamic_pointer_cast<SecondRootProxyBase>(delegate)), + _AttributeExtensions(*(std::dynamic_pointer_cast<SecondRootProxyBase>(delegate)))... { +} + +template <typename ... _AttributeExtensions> +SecondRootProxy<_AttributeExtensions...>::~SecondRootProxy() { +} + + +template <typename ... _AttributeExtensions> +std::string SecondRootProxy<_AttributeExtensions...>::getAddress() const { + return delegate_->getAddress(); +} + +template <typename ... _AttributeExtensions> +const std::string& SecondRootProxy<_AttributeExtensions...>::getDomain() const { + return delegate_->getDomain(); +} + +template <typename ... _AttributeExtensions> +const std::string& SecondRootProxy<_AttributeExtensions...>::getServiceId() const { + return delegate_->getServiceId(); +} + +template <typename ... _AttributeExtensions> +const std::string& SecondRootProxy<_AttributeExtensions...>::getInstanceId() const { + return delegate_->getInstanceId(); +} + +template <typename ... _AttributeExtensions> +bool SecondRootProxy<_AttributeExtensions...>::isAvailable() const { + return delegate_->isAvailable(); +} + +template <typename ... _AttributeExtensions> +bool SecondRootProxy<_AttributeExtensions...>::isAvailableBlocking() const { + return delegate_->isAvailableBlocking(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::ProxyStatusEvent& SecondRootProxy<_AttributeExtensions...>::getProxyStatusEvent() { + return delegate_->getProxyStatusEvent(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::InterfaceVersionAttribute& SecondRootProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() { + return delegate_->getInterfaceVersionAttribute(); +} + + +template <typename ... _AttributeExtensions> +CommonAPI::ProxyManager& SecondRootProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() { + return delegate_->getProxyManagerLeafInterface(); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi + + +#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_H_ diff --git a/src/test/commonapi/tests/managed/SecondRootProxyBase.h b/src/test/commonapi/tests/managed/SecondRootProxyBase.h new file mode 100644 index 0000000..2c6d805 --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootProxyBase.h @@ -0,0 +1,45 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_H_ +#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_H_ + +#include "SecondRoot.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> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { +namespace managed { + +class SecondRootProxyBase: virtual public CommonAPI::Proxy { + public: + + + + + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface() = 0; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_H_ diff --git a/src/test/commonapi/tests/managed/SecondRootStub.h b/src/test/commonapi/tests/managed/SecondRootStub.h new file mode 100644 index 0000000..7789e5d --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootStub.h @@ -0,0 +1,96 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_STUB_H_ +#define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_H_ + + + +#include <commonapi/tests/managed/LeafInterfaceStub.h> + +#include "SecondRoot.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 SecondRoot. 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 SecondRootStubAdapter: virtual public CommonAPI::StubAdapter, public SecondRoot { + public: + + + virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; + virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; + virtual std::set<std::string>& getLeafInterfaceInstances() = 0; + + virtual void deactivateManagedInstances() = 0; + +protected: + /** + * Defines properties for storing the ClientIds of clients / proxies that have + * subscribed to the selective broadcasts + */ +}; + + +/** + * Defines the necessary callbacks to handle remote set events related to the attributes + * defined in the IDL description for SecondRoot. + * 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 SecondRootStubRemoteEvent { + public: + virtual ~SecondRootStubRemoteEvent() { } + +}; + + +/** + * Defines the interface that must be implemented by any class that should provide + * the service SecondRoot to remote clients. + * This class and the one above are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class SecondRootStub : public CommonAPI::Stub<SecondRootStubAdapter , SecondRootStubRemoteEvent> { + public: + virtual ~SecondRootStub() { } + + + + 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; +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Second_Root_STUB_H_ diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp new file mode 100644 index 0000000..2e1f42b --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp @@ -0,0 +1,52 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include <commonapi/tests/managed/SecondRootStubDefault.h> + +namespace commonapi { +namespace tests { +namespace managed { + +SecondRootStubDefault::SecondRootStubDefault(): + autoInstanceCounter_(0), + remoteEventHandler_(this) { +} + +SecondRootStubRemoteEvent* SecondRootStubDefault::initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter) { + stubAdapter_ = stubAdapter; + return &remoteEventHandler_; +} + + + + +bool SecondRootStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub> stub) { + autoInstanceCounter_++; + std::stringstream ss; + ss << stubAdapter_->getInstanceId() << ".i" << autoInstanceCounter_; + std::string instance = ss.str(); + return stubAdapter_->registerManagedStubLeafInterface(stub, instance); +} +bool SecondRootStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + return stubAdapter_->registerManagedStubLeafInterface(stub, instance); +} +bool SecondRootStubDefault::deregisterManagedStubLeafInterface(const std::string& instance) { + return stubAdapter_->deregisterManagedStubLeafInterface(instance); +} +std::set<std::string>& SecondRootStubDefault::getLeafInterfaceInstances() { + return stubAdapter_->getLeafInterfaceInstances(); +} + +SecondRootStubDefault::RemoteEventHandler::RemoteEventHandler(SecondRootStubDefault* defaultStub): + defaultStub_(defaultStub) { +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.h b/src/test/commonapi/tests/managed/SecondRootStubDefault.h new file mode 100644 index 0000000..7c3a99d --- /dev/null +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.h @@ -0,0 +1,65 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_H_ +#define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_H_ + +#include <commonapi/tests/managed/SecondRootStub.h> +#include <sstream> + +namespace commonapi { +namespace tests { +namespace managed { + +/** + * Provides a default implementation for SecondRootStubRemoteEvent and + * SecondRootStub. 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 SecondRootStubDefault : public SecondRootStub { + public: + SecondRootStubDefault(); + + SecondRootStubRemoteEvent* initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter); + + + + + 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(); + + protected: + std::shared_ptr<SecondRootStubAdapter> stubAdapter_; + private: + class RemoteEventHandler: public SecondRootStubRemoteEvent { + public: + RemoteEventHandler(SecondRootStubDefault* defaultStub); + + + private: + SecondRootStubDefault* defaultStub_; + }; + + RemoteEventHandler remoteEventHandler_; + uint32_t autoInstanceCounter_; + +}; + +} // namespace managed +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_H_ |