diff options
author | Aleksandar Donchev <Aleksander.Donchev@partner.bmw.de> | 2015-09-11 13:50:51 +0200 |
---|---|---|
committer | Aleksandar Donchev <Aleksander.Donchev@partner.bmw.de> | 2015-09-11 13:50:51 +0200 |
commit | c529ce5944d3c56c27beb78f0193698b7c1bf1ae (patch) | |
tree | eb5647224bf2792ca6097fcda020de4dfaa38479 /AudioManagerUtilities/src | |
parent | ad8e89a7331340d1215cfec30032931f2f9d85a7 (diff) | |
download | audiomanager-c529ce5944d3c56c27beb78f0193698b7c1bf1ae.tar.gz |
* CAPI wrapper with better someip integration.
Signed-off-by: Christian Linke <christian.linke@bmw.de>
Diffstat (limited to 'AudioManagerUtilities/src')
-rw-r--r-- | AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp b/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp index 8412a71..b6ac399 100644 --- a/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp +++ b/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp @@ -48,7 +48,7 @@ namespace am static CAmCommonAPIWrapper* pSingleCommonAPIInstance = NULL; -CAmCommonAPIWrapper::CAmCommonAPIWrapper(CAmSocketHandler* socketHandler): +CAmCommonAPIWrapper::CAmCommonAPIWrapper(CAmSocketHandler* socketHandler, const std::string & applicationName): pCommonPrepareCallback(this,&CAmCommonAPIWrapper::commonPrepareCallback), // pCommonDispatchCallback(this, &CAmCommonAPIWrapper::commonDispatchCallback), // pCommonFireCallback(this, &CAmCommonAPIWrapper::commonFireCallback), // @@ -64,18 +64,26 @@ CAmCommonAPIWrapper::CAmCommonAPIWrapper(CAmSocketHandler* socketHandler): #else CommonAPI::Runtime::setProperty("LogContext", "AMCAPI"); mRuntime = CommonAPI::Runtime::get(); + logInfo("CommonAPI runtime has been loaded! Default Binding is", mRuntime->getDefaultBinding()); #endif assert(NULL!=mRuntime); //Create the context +#if COMMONAPI_VERSION_NUMBER < 300 mContext = std::make_shared<CommonAPI::MainLoopContext>(); +#else + if(applicationName.size()) + mContext = std::make_shared<CommonAPI::MainLoopContext>(applicationName); + else + mContext = std::make_shared<CommonAPI::MainLoopContext>(); +#endif assert(NULL!=mContext); + logInfo("CommonAPI main loop context with name '", mContext->getName(), "' has been created!"); #if COMMONAPI_VERSION_NUMBER < 300 - mFactory = runtime->createFactory(mContext); + mFactory = mRuntime->createFactory(mContext); assert(mFactory); #else - logInfo("CommonAPI runtime has been loaded! Default Binding is", mRuntime->getDefaultBinding()); #if COMMONAPI_USED_BINDING > 0 mFactory = CommonAPI::SomeIP::Factory::get(); assert(mFactory); @@ -111,14 +119,14 @@ CAmCommonAPIWrapper::~CAmCommonAPIWrapper() mWatchToCheck = NULL; } -CAmCommonAPIWrapper* CAmCommonAPIWrapper::instantiateOnce(CAmSocketHandler* socketHandler) +CAmCommonAPIWrapper* CAmCommonAPIWrapper::instantiateOnce(CAmSocketHandler* socketHandler, const std::string & applicationName) { if(NULL==pSingleCommonAPIInstance) { if(NULL==socketHandler) throw std::runtime_error(std::string("Expected a valid socket handler. The socket handler pointer must not be NULL.")); else - pSingleCommonAPIInstance = new CAmCommonAPIWrapper(socketHandler); + pSingleCommonAPIInstance = new CAmCommonAPIWrapper(socketHandler, applicationName); } else throw std::logic_error(std::string("The singleton instance has been already instantiated. This method should be called only once.")); |