diff options
author | Aleksandar Donchev <Aleksander.Donchev@partner.bmw.de> | 2017-09-28 17:09:28 +0200 |
---|---|---|
committer | Jacqueline Molz <Jacqueline.Molz@bmw.de> | 2018-02-13 12:48:34 +0100 |
commit | 6b6342f5381138aeecea93e153de021e42db8283 (patch) | |
tree | 9e0daac643ef1d73717804b90ac825646d81c9a9 /AudioManagerUtilities/include | |
parent | 911742f8b3798eaf03c56246539a402cc145eec8 (diff) | |
download | audiomanager-6b6342f5381138aeecea93e153de021e42db8283.tar.gz |
* All methods in CAPI wrapper with connectionID parameter are deprecated because CommonAPI creates new filedescriptor per connection which isn't needed.
* revents flag is passed to the CommonAPI watcher instead events
* revents set to 0 in Sockethandler
Signed-off-by: Christian Linke <christian.linke@bmw.de>
Change-Id: I9d9d2c424ac9fad62c76a66545c731c518adb2e4
Diffstat (limited to 'AudioManagerUtilities/include')
-rw-r--r-- | AudioManagerUtilities/include/CAmCommonAPIWrapper.h | 185 | ||||
-rw-r--r-- | AudioManagerUtilities/include/CAmSocketHandler.h | 5 |
2 files changed, 93 insertions, 97 deletions
diff --git a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h index 82328d6..a83b5b3 100644 --- a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h +++ b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h @@ -133,24 +133,25 @@ public: * @return Pointer to the socket handler. */ CAmSocketHandler *getSocketHandler() const { return mpSocketHandler; } -#if COMMONAPI_VERSION_NUMBER >= 300 - /** - * \brief Register stub objects. - * - * Example: std::shared_ptr<ConcreteStubClass> aStub; - * registerService( aStub, "local", "com.your_company.instance_name", "service-name"); - * - * @param shStub: Shared pointer to a stub instance - * @param domain: A string with the domain name, usually "local" - * @param instance: Common-api instance string as example "com.your_company.instance_name" - * @param connectionId: A string connection id, which is used by CommonAPI to group applications - * - */ - template <class TStubImp> bool registerService(const std::shared_ptr<TStubImp> & shStub, const std::string & domain, const std::string & instance, const CommonAPI::ConnectionId_t & connectionId) - { - return mRuntime->registerService(domain, instance, shStub, connectionId); - } -#endif + + /** + * \brief Deprecated method. This class is used only in single connection applications and no connectionId is needed. Instead you should use bool registerService(const std::shared_ptr<TStubImp> & shStub, const std::string & domain, const std::string & instance). + * + * + * Example: std::shared_ptr<ConcreteStubClass> aStub; + * registerService( aStub, "local", "com.your_company.instance_name", "service-name"); + * + * @param shStub: Shared pointer to a stub instance + * @param domain: A string with the domain name, usually "local" + * @param instance: Common-api instance string as example "com.your_company.instance_name" + * @param connectionId: A string connection id, which is used by CommonAPI to group applications + * + */ + template <class TStubImp> bool __attribute__((deprecated)) registerService(const std::shared_ptr<TStubImp> & shStub, const std::string & domain, const std::string & instance, const CommonAPI::ConnectionId_t __attribute__((__unused__)) & /*connectionId*/) + { + return mRuntime->registerService(domain, instance, shStub, mContext); + } + /** * \brief Register stub objects. * @@ -181,61 +182,59 @@ public: } /** - * \brief Deprecated method. Instead you should use bool registerService(const std::shared_ptr<TStubImp> & shStub, const std::string & domain, const std::string & instance). - * - * Register stub objects. - * - * Example: std::shared_ptr<ConcreteStubClass> aStub; - * registerService( aStub, "local:com.your_company.interface_name:com.your_company.instance_name"); - * - * @param shStub: Shared pointer to a stub instance - * @param address: Complete common-api address as example "local:com.your_company.interface_name:com.your_company.instance_name" - * - */ - template <class TStubImp> bool __attribute__((deprecated)) registerStub(const std::shared_ptr<TStubImp> & shStub, const std::string & address) - { - std::vector<std::string> parts = CommonAPI::split(address, ':'); - assert(parts.size()==3); - - return registerService(shStub, parts[0], parts[2]); - } - - /** - * \brief Deprecated method. Instead you should use bool unregisterService(const std::string &domain, const std::string &interface, const std::string &instance). - * - * Unregister stub objects. - * - * @param address: Complete common-api address as example "local:com.your_company.interface_name:com.your_company.instance_name" - * - */ - bool __attribute__((deprecated)) unregisterStub(const std::string & address) - { - std::vector<std::string> parts = CommonAPI::split(address, ':'); - assert(parts.size()==3); - - return unregisterService(parts[0], parts[1], parts[2]); - } - -#if COMMONAPI_VERSION_NUMBER >= 300 - /** - * \brief Build proxy objects. - * - * Example: std::shared_ptr<AProxyClass<>> aProxy = buildProxy<AProxyClass>("local", "com.your_company.instance_name", "client-name"); - * - * @param domain: A string with the domain name, usually "local" - * @param instance: Common-api instance string as example "com.your_company.instance_name" - * @param connectionId: A string connection id, which is used by CommonAPI to group applications - * - * @return A proxy object. - */ - template<template<typename ...> class ProxyClass, typename ... AttributeExtensions> - std::shared_ptr<ProxyClass<AttributeExtensions...>> buildProxy(const std::string &domain, const std::string &instance, const CommonAPI::ConnectionId_t & connectionId) - { - return mRuntime->buildProxy<ProxyClass>(domain, instance, connectionId); - } -#endif - - /** + * \brief Deprecated method. Instead you should use bool registerService(const std::shared_ptr<TStubImp> & shStub, const std::string & domain, const std::string & instance). + * + * Register stub objects. + * + * Example: std::shared_ptr<ConcreteStubClass> aStub; + * registerService( aStub, "local:com.your_company.interface_name:com.your_company.instance_name"); + * + * @param shStub: Shared pointer to a stub instance + * @param address: Complete common-api address as example "local:com.your_company.interface_name:com.your_company.instance_name" + * + */ + template <class TStubImp> bool __attribute__((deprecated)) registerStub(const std::shared_ptr<TStubImp> & shStub, const std::string & address) + { + std::vector<std::string> parts = CommonAPI::split(address, ':'); + assert(parts.size()==3); + + return registerService(shStub, parts[0], parts[2]); + } + + /** + * \brief Deprecated method. Instead you should use bool unregisterService(const std::string &domain, const std::string &interface, const std::string &instance). + * + * Unregister stub objects. + * + * @param address: Complete common-api address as example "local:com.your_company.interface_name:com.your_company.instance_name" + * + */ + bool __attribute__((deprecated)) unregisterStub(const std::string & address) + { + std::vector<std::string> parts = CommonAPI::split(address, ':'); + assert(parts.size()==3); + + return unregisterService(parts[0], parts[1], parts[2]); + } + + /** + * \brief Deprecated method. This class is used only in single connection applications and no connectionId is needed. Instead you should use buildProxy(const std::string &domain, const std::string &instance). + * + * Example: std::shared_ptr<AProxyClass<>> aProxy = buildProxy<AProxyClass>("local", "com.your_company.instance_name", "client-name"); + * + * @param domain: A string with the domain name, usually "local" + * @param instance: Common-api instance string as example "com.your_company.instance_name" + * @param connectionId: A string connection id, which is used by CommonAPI to group applications + * + * @return A proxy object. + */ + template<template<typename ...> class ProxyClass, typename ... AttributeExtensions> + std::shared_ptr<ProxyClass<AttributeExtensions...>> __attribute__((deprecated)) buildProxy(const std::string &domain, const std::string &instance, const CommonAPI::ConnectionId_t __attribute__((__unused__)) & /*connectionId*/) + { + return mRuntime->buildProxy<ProxyClass>(domain, instance, mContext); + } + + /** * \brief Build proxy objects. * * Example: std::shared_ptr<AProxyClass<>> aProxy = buildProxy<AProxyClass>("local", "com.your_company.instance_name"); @@ -250,26 +249,26 @@ public: { return mRuntime->buildProxy<ProxyClass>(domain, instance, mContext); } - - - /** - * \brief Deprecated method. Instead you should use buildProxy(const std::string &domain, const std::string &instance). - * - * Build proxy objects. - * Example: std::shared_ptr<AProxyClass<>> aProxy = buildProxy<AProxyClass>("local:com.your_company.interface_name:com.your_company.instance_name"); - * - * @param address: Complete common-api address as example "local:com.your_company.interface_name:com.your_company.instance_name" - * - * @return A proxy object. - */ - template<template<typename ...> class ProxyClass, typename ... AttributeExtensions> - std::shared_ptr<ProxyClass<AttributeExtensions...>> __attribute__((deprecated)) buildProxy(const std::string & address) - { - std::vector<std::string> parts=CommonAPI::split(address, ':'); - assert(parts.size()==3); - - return buildProxy<ProxyClass>(parts[0], parts[2]); - } + + + /** + * \brief Deprecated method. Instead you should use buildProxy(const std::string &domain, const std::string &instance). + * + * Build proxy objects. + * Example: std::shared_ptr<AProxyClass<>> aProxy = buildProxy<AProxyClass>("local:com.your_company.interface_name:com.your_company.instance_name"); + * + * @param address: Complete common-api address as example "local:com.your_company.interface_name:com.your_company.instance_name" + * + * @return A proxy object. + */ + template<template<typename ...> class ProxyClass, typename ... AttributeExtensions> + std::shared_ptr<ProxyClass<AttributeExtensions...>> __attribute__((deprecated)) buildProxy(const std::string & address) + { + std::vector<std::string> parts=CommonAPI::split(address, ':'); + assert(parts.size()==3); + + return buildProxy<ProxyClass>(parts[0], parts[2]); + } }; diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index 6163b3c..8809a30 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -305,14 +305,13 @@ class CAmSocketHandler internal_codes_t mInternalCodes; sh_pollHandle_t mSignalFdHandle; VectorListPoll_t mListActivePolls; + const std::thread::id mThreadID; //!< Socket handler thread id used to check if the calls come from the same thread #ifndef WITH_TIMERFD timespec mStartTime; //!<here the actual time is saved for timecorrection #endif private: - static void checkCallerThreadId(void); - bool fdIsValid(const int fd) const; timespec* insertTime(timespec& buffertime); @@ -500,8 +499,6 @@ public: void exit_mainloop(); bool fatalErrorOccurred(); - - static const std::thread::id SOCKETHANDLER_THREAD_ID; }; } /* namespace am */ |