From cfe0e77aaf87a0590ceea42f6afa62b0c7d95e80 Mon Sep 17 00:00:00 2001 From: Aleksandar Donchev Date: Mon, 25 Sep 2017 17:01:18 +0200 Subject: Timer fd is closed at the beginning of the next iteration + some unit tests. Signed-off-by: Christian Linke Change-Id: I8c5d3c436ac9fad62c76a26145c731b538abb1e7 --- AudioManagerUtilities/include/CAmSocketHandler.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index 717f792..7baa496 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -244,10 +244,11 @@ class CAmSocketHandler sh_timer_s() : handle(0) #ifdef WITH_TIMERFD - , fd(0) + , fd(-1) #endif , countdown(), callback(), userData(0) {} + }; struct sh_signal_s @@ -291,7 +292,11 @@ class CAmSocketHandler VectorListPoll_t mListPoll; //! mListTimer; //! mListActiveTimer; //! mListRemovedTimers; +#endif sh_identifier_s mSetSignalhandlerKeys; //!A set of all used signal handler keys VectorSignalHandlers_t mSignalHandlers; bool mRecreatePollfds; //! Date: Tue, 26 Sep 2017 16:07:00 +0200 Subject: A filedescriptor removal will set an invalidation flag which will prevent calls on the invalidated objects in the current iteration. Signed-off-by: Christian Linke Change-Id: I9d5d3c434ac9fad62c76a76145c731b538aeb1e3 # Conflicts: # AudioManagerUtilities/src/CAmSocketHandler.cpp --- AudioManagerUtilities/include/CAmSocketHandler.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index 7baa496..d14c1a3 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -217,6 +217,7 @@ class CAmSocketHandler { struct sh_poll_s //! prepareCB; //preperation callback @@ -226,7 +227,7 @@ class CAmSocketHandler void* userData; sh_poll_s() : - handle(0), pollfdValue(), prepareCB(), firedCB(), checkCB(), dispatchCB(), userData(0) + isValid(true), handle(0), pollfdValue(), prepareCB(), firedCB(), checkCB(), dispatchCB(), userData(0) {} }; @@ -302,9 +303,11 @@ class CAmSocketHandler bool mRecreatePollfds; //! Date: Wed, 27 Sep 2017 11:51:13 +0200 Subject: Runtime check for calls to the sockethandler from other threads Signed-off-by: Christian Linke Change-Id: I9d9d3c424ac9fad62c76a76545c731b518bdb1e2 --- AudioManagerUtilities/include/CAmSocketHandler.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index d14c1a3..6163b3c 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "audiomanagertypes.h" @@ -309,6 +310,9 @@ class CAmSocketHandler #endif private: + + static void checkCallerThreadId(void); + bool fdIsValid(const int fd) const; timespec* insertTime(timespec& buffertime); @@ -496,6 +500,8 @@ public: void exit_mainloop(); bool fatalErrorOccurred(); + + static const std::thread::id SOCKETHANDLER_THREAD_ID; }; } /* namespace am */ -- cgit v1.2.1 From 6b6342f5381138aeecea93e153de021e42db8283 Mon Sep 17 00:00:00 2001 From: Aleksandar Donchev Date: Thu, 28 Sep 2017 17:09:28 +0200 Subject: * 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 Change-Id: I9d9d2c424ac9fad62c76a66545c731c518adb2e4 --- .../include/CAmCommonAPIWrapper.h | 185 ++++++++++----------- AudioManagerUtilities/include/CAmSocketHandler.h | 5 +- 2 files changed, 93 insertions(+), 97 deletions(-) (limited to 'AudioManagerUtilities/include') 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 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 bool registerService(const std::shared_ptr & 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 & shStub, const std::string & domain, const std::string & instance). + * + * + * Example: std::shared_ptr 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 bool __attribute__((deprecated)) registerService(const std::shared_ptr & 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 & shStub, const std::string & domain, const std::string & instance). - * - * Register stub objects. - * - * Example: std::shared_ptr 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 bool __attribute__((deprecated)) registerStub(const std::shared_ptr & shStub, const std::string & address) - { - std::vector 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 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> aProxy = buildProxy("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 class ProxyClass, typename ... AttributeExtensions> - std::shared_ptr> buildProxy(const std::string &domain, const std::string &instance, const CommonAPI::ConnectionId_t & connectionId) - { - return mRuntime->buildProxy(domain, instance, connectionId); - } -#endif - - /** + * \brief Deprecated method. Instead you should use bool registerService(const std::shared_ptr & shStub, const std::string & domain, const std::string & instance). + * + * Register stub objects. + * + * Example: std::shared_ptr 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 bool __attribute__((deprecated)) registerStub(const std::shared_ptr & shStub, const std::string & address) + { + std::vector 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 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> aProxy = buildProxy("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 class ProxyClass, typename ... AttributeExtensions> + std::shared_ptr> __attribute__((deprecated)) buildProxy(const std::string &domain, const std::string &instance, const CommonAPI::ConnectionId_t __attribute__((__unused__)) & /*connectionId*/) + { + return mRuntime->buildProxy(domain, instance, mContext); + } + + /** * \brief Build proxy objects. * * Example: std::shared_ptr> aProxy = buildProxy("local", "com.your_company.instance_name"); @@ -250,26 +249,26 @@ public: { return mRuntime->buildProxy(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> aProxy = buildProxy("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 class ProxyClass, typename ... AttributeExtensions> - std::shared_ptr> __attribute__((deprecated)) buildProxy(const std::string & address) - { - std::vector parts=CommonAPI::split(address, ':'); - assert(parts.size()==3); - - return buildProxy(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> aProxy = buildProxy("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 class ProxyClass, typename ... AttributeExtensions> + std::shared_ptr> __attribute__((deprecated)) buildProxy(const std::string & address) + { + std::vector parts=CommonAPI::split(address, ':'); + assert(parts.size()==3); + + return buildProxy(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; //! Date: Thu, 12 Oct 2017 13:02:09 +0200 Subject: Real time scheduler added, capi wrapper timeout return value considered in registerTimeout, only requested revent passed from within the camsockethandler instead of all Signed-off-by: Christian Linke Change-Id: I2d9d2c424ac3fac62c76a66545a531c518edb2e8 --- AudioManagerUtilities/include/CAmSocketHandler.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index 8809a30..53010ba 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -421,13 +421,6 @@ private: */ inline static void fire(const sh_poll_s* a); - /** - * functor to return all fired events - * @param a - * @return - */ - inline static bool eventFired(const pollfd& a); - /** * functor to help find the items that do not need dispatching * @param a -- cgit v1.2.1 From 34207d94acb8914c4f45b64c2362c645251a53ec Mon Sep 17 00:00:00 2001 From: Aleksandar Donchev Date: Thu, 12 Oct 2017 17:38:49 +0200 Subject: FIx for CAPI timeouts and support for more than one CAPI watch Signed-off-by: Christian Linke Change-Id: I9a9d2c424bc8fac62c76a66545a531c518edb2e3 --- .../include/CAmCommonAPIWrapper.h | 46 +++++++++++++--------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h index a83b5b3..0f770c4 100644 --- a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h +++ b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -48,29 +49,37 @@ class CAmSocketHandler; class CAmCommonAPIWrapper { - void commonPrepareCallback(const sh_pollHandle_t handle, void* userData); + void commonPrepareCallback ( const sh_pollHandle_t, void* ); TAmShPollPrepare pCommonPrepareCallback; - bool commonDispatchCallback(const sh_pollHandle_t handle, void* userData); - TAmShPollDispatch pCommonDispatchCallback; - void commonFireCallback(const pollfd pollfd, const sh_pollHandle_t, void*); TAmShPollFired pCommonFireCallback; bool commonCheckCallback(const sh_pollHandle_t handle, void*); TAmShPollCheck pCommonCheckCallback; + + bool commonDispatchCallback(const sh_pollHandle_t handle, void* userData); + TAmShPollDispatch pCommonDispatchCallback; void commonTimerCallback(sh_timerHandle_t handle, void* userData); TAmShTimerCallBack pCommonTimerCallback; - struct timerHandles - { - sh_timerHandle_t handle; - CommonAPI::Timeout* timeout; - }; - CAmSocketHandler *mpSocketHandler; //!< pointer to the sockethandler + typedef std::vector ArrayDispatchSources; + typedef ArrayDispatchSources::iterator IteratorArrayDispatchSources; + typedef std::unordered_map MapWatches; + typedef MapWatches::iterator IteratorMapWatches; + typedef std::unordered_map> MapDispatchSources; + typedef MapDispatchSources::iterator IteratorDispatchSources; + typedef std::unordered_map MapTimeouts; + typedef MapTimeouts::iterator IteratorMapTimeouts; + + ArrayDispatchSources mRegisteredDispatchSources; + MapWatches mMapWatches; + MapDispatchSources mSourcesToDispatch; + MapTimeouts mListTimerhandles; + std::shared_ptr mRuntime; std::shared_ptr mContext; @@ -78,22 +87,23 @@ class CAmCommonAPIWrapper CommonAPI::WatchListenerSubscription mWatchListenerSubscription; CommonAPI::TimeoutSourceListenerSubscription mTimeoutSourceListenerSubscription; CommonAPI::WakeupListenerSubscription mWakeupListenerSubscription; - std::multimap mRegisteredDispatchSources; - std::map mMapWatches; - CommonAPI::Watch* mWatchToCheck; - std::list mSourcesToDispatch; - std::vector mpListTimerhandles; + void registerDispatchSource(CommonAPI::DispatchSource* dispatchSource, const CommonAPI::DispatchPriority dispatchPriority); void deregisterDispatchSource(CommonAPI::DispatchSource* dispatchSource); + void deregisterAllDispatchSource(); void registerWatch(CommonAPI::Watch* watch, const CommonAPI::DispatchPriority dispatchPriority); void deregisterWatch(CommonAPI::Watch* watch); + void deregisterAllWatches(); void registerTimeout(CommonAPI::Timeout* timeout, const CommonAPI::DispatchPriority dispatchPriority); void deregisterTimeout(CommonAPI::Timeout* timeout); - void wakeup(); - + void deregisterAllTimeouts(); + + CommonAPI::Watch* watchWithHandle(const sh_pollHandle_t handle); + CommonAPI::Timeout* timeoutWithHandle(const sh_pollHandle_t handle); + protected: - CAmCommonAPIWrapper(CAmSocketHandler* socketHandler, const std::string & applicationName = "") ; + CAmCommonAPIWrapper ( CAmSocketHandler* socketHandler, const std::string& applicationName = "" ) ; public: -- cgit v1.2.1 From d6481481d86408a5b1c74162012167ed57ac6ee9 Mon Sep 17 00:00:00 2001 From: Aleksandar Donchev Date: Mon, 27 Nov 2017 15:39:53 +0100 Subject: Cmake parameters for real-time scheduler's priority and policy and throw runtime error if read fails. Signed-off-by: Christian Linke Change-Id: I6a7a2c424bc8fac62c76a66545a231c518edb2e1 --- AudioManagerUtilities/include/CAmSocketHandler.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index 53010ba..2fd5c42 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -492,7 +492,29 @@ public: void exit_mainloop(); bool fatalErrorOccurred(); +#ifdef WITH_REALTIME_SCHEDULER + /** + * Set scheduling algorithm and/or parameters for a thread whose ID is specified in pid. + * If pid equals zero, the scheduling policy and parameters of the calling thread will be set. + * @param pid_t pid thread id + * @param int policy equals specified policies in sched_setscheduler documentation + * @param int priority between 1 and 99 + * @return on success 0 and on error -1 + */ + static int setRuntimeScheduler(const pid_t pid, const int policy, const int priority); +#endif }; +#ifdef WITH_REALTIME_SCHEDULER +#define SET_REALTIME_SCHEDULER()\ + if ( CAmSocketHandler::setRuntimeScheduler(0, AM_REALTIME_POLICY, AM_PROCESS_PRIORITY) != 0 )\ + {\ + std::cerr <<"sched_setscheduler:"< Date: Wed, 7 Feb 2018 10:51:17 +0100 Subject: The real-time scheduler removed. Signed-off-by: Christian Linke Change-Id: I7c8a2c474bc8fac62c76a46545a231c518edb2a8 --- AudioManagerUtilities/include/CAmSocketHandler.h | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index 2fd5c42..53010ba 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -492,29 +492,7 @@ public: void exit_mainloop(); bool fatalErrorOccurred(); -#ifdef WITH_REALTIME_SCHEDULER - /** - * Set scheduling algorithm and/or parameters for a thread whose ID is specified in pid. - * If pid equals zero, the scheduling policy and parameters of the calling thread will be set. - * @param pid_t pid thread id - * @param int policy equals specified policies in sched_setscheduler documentation - * @param int priority between 1 and 99 - * @return on success 0 and on error -1 - */ - static int setRuntimeScheduler(const pid_t pid, const int policy, const int priority); -#endif }; -#ifdef WITH_REALTIME_SCHEDULER -#define SET_REALTIME_SCHEDULER()\ - if ( CAmSocketHandler::setRuntimeScheduler(0, AM_REALTIME_POLICY, AM_PROCESS_PRIORITY) != 0 )\ - {\ - std::cerr <<"sched_setscheduler:"< Date: Mon, 26 Feb 2018 17:24:31 +0100 Subject: Remainning fixes from utility update Signed-off-by: Christian Linke Change-Id: I3c8a2b474bc8fac62c76a46545a231c718edb2a9 --- .../include/CAmCommonAPIWrapper.h | 105 ++++++++++----------- 1 file changed, 52 insertions(+), 53 deletions(-) (limited to 'AudioManagerUtilities/include') diff --git a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h index 0f770c4..7d64a04 100644 --- a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h +++ b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h @@ -98,12 +98,12 @@ class CAmCommonAPIWrapper void registerTimeout(CommonAPI::Timeout* timeout, const CommonAPI::DispatchPriority dispatchPriority); void deregisterTimeout(CommonAPI::Timeout* timeout); void deregisterAllTimeouts(); - - CommonAPI::Watch* watchWithHandle(const sh_pollHandle_t handle); + + CommonAPI::Watch* watchWithHandle(const sh_pollHandle_t handle); CommonAPI::Timeout* timeoutWithHandle(const sh_pollHandle_t handle); - + protected: - CAmCommonAPIWrapper ( CAmSocketHandler* socketHandler, const std::string& applicationName = "" ) ; + CAmCommonAPIWrapper(CAmSocketHandler* socketHandler, const std::string& applicationName = "") ; public: @@ -191,42 +191,42 @@ public: return mRuntime->unregisterService(domain, interface, instance); } - /** + /** * \brief Deprecated method. Instead you should use bool registerService(const std::shared_ptr & shStub, const std::string & domain, const std::string & instance). - * - * Register stub objects. - * - * Example: std::shared_ptr 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 bool __attribute__((deprecated)) registerStub(const std::shared_ptr & shStub, const std::string & address) - { - std::vector 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 parts = CommonAPI::split(address, ':'); - assert(parts.size()==3); - - return unregisterService(parts[0], parts[1], parts[2]); - } - + * + * Register stub objects. + * + * Example: std::shared_ptr 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 bool __attribute__((deprecated)) registerStub(const std::shared_ptr & shStub, const std::string & address) + { + std::vector 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 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). * @@ -241,26 +241,25 @@ public: template class ProxyClass, typename ... AttributeExtensions> std::shared_ptr> __attribute__((deprecated)) buildProxy(const std::string &domain, const std::string &instance, const CommonAPI::ConnectionId_t __attribute__((__unused__)) & /*connectionId*/) { - return mRuntime->buildProxy(domain, instance, mContext); + return mRuntime->buildProxy(domain, instance, mContext); } - /** - * \brief Build proxy objects. - * - * Example: std::shared_ptr> aProxy = buildProxy("local", "com.your_company.instance_name"); - * - * @param domain: A string with the domain name, usually "local" - * @param instance: Common-api instance string as example "com.your_company.instance_name" - * - * @return A proxy object. - */ + /** + * \brief Build proxy objects. + * + * Example: std::shared_ptr> aProxy = buildProxy("local", "com.your_company.instance_name"); + * + * @param domain: A string with the domain name, usually "local" + * @param instance: Common-api instance string as example "com.your_company.instance_name" + * + * @return A proxy object. + */ template class ProxyClass, typename ... AttributeExtensions> std::shared_ptr> buildProxy(const std::string &domain, const std::string &instance) { return mRuntime->buildProxy(domain, instance, mContext); } - - + /** * \brief Deprecated method. Instead you should use buildProxy(const std::string &domain, const std::string &instance). * @@ -278,7 +277,7 @@ public: assert(parts.size()==3); return buildProxy(parts[0], parts[2]); - } + } }; -- cgit v1.2.1