summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/src/RoutingSender.cpp
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-01-10 15:58:38 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-01-12 00:09:34 +0100
commit472d0762b68ce0f2a755b4215515a3e031831495 (patch)
tree276e811f00dfe17cba15c56092b33d67ba2793f6 /AudioManagerDaemon/src/RoutingSender.cpp
parent6ebae8c4d3a340c135ed2f5f611a0e1c31994164 (diff)
downloadaudiomanager-472d0762b68ce0f2a755b4215515a3e031831495.tar.gz
* recreated the header files out of the model. Added versioning support in the headerfiles generated
* ensured compatibility with 64 bit systems while compiling dbus [ changed FindDBUS.cmake] * updated the README to better support building * updated typo in introspectable string of DBusWrapper * reworked including strategie * added getInterfafeVersion method on all interfaces * added Interface Versioning support * added version as part of .so ending * it is no possible to set a vector of source and sink sound properties at a time * added interface to ask for all loaded plugins on RoutingSender * added first version of telnet server (not yet productive) - set to not active in CMakeLists.txt * added changelog (created out of git commit log) * added default values for all enum types to be save even on other if communication is on other domain
Diffstat (limited to 'AudioManagerDaemon/src/RoutingSender.cpp')
-rw-r--r--AudioManagerDaemon/src/RoutingSender.cpp83
1 files changed, 75 insertions, 8 deletions
diff --git a/AudioManagerDaemon/src/RoutingSender.cpp b/AudioManagerDaemon/src/RoutingSender.cpp
index 3b5bdad..2b2adb5 100644
--- a/AudioManagerDaemon/src/RoutingSender.cpp
+++ b/AudioManagerDaemon/src/RoutingSender.cpp
@@ -32,6 +32,8 @@
using namespace am;
+#define REQUIRED_INTERFACE_VERSION 1
+
#define CALL_ALL_INTERFACES(...) \
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin(); \
std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end(); \
@@ -99,7 +101,7 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
for (; iter != iterEnd; ++iter)
{
- //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Loading Hook plugin"),DLT_STRING(iter->c_str()));
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin: "),DLT_STRING(iter->c_str()));
RoutingSendInterface* (*createFunc)();
void* tempLibHandle=NULL;
@@ -107,7 +109,7 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
if (!createFunc)
{
- // DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Entry point of Communicator not found"));
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Entry point of RoutingPlugin not found"));
continue;
}
@@ -115,13 +117,21 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
if (!router)
{
- //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("HookPlugin initialization failed. Entry Function not callable"));
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin initialization failed. Entry Function not callable"));
continue;
}
InterfaceNamePairs routerInterface;
routerInterface.routingInterface = router;
+ //check libversion
+ if (router->getInterfaceVersion()<REQUIRED_INTERFACE_VERSION)
+ {
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin initialization failed. Version of Interface to old"));
+ continue;
+ }
+
+
//here, the busname is saved together with the interface. Later The domains will register with the name and sinks, sources etc with the domain....
router->returnBusName(routerInterface.busName);
assert(!routerInterface.busName.empty());
@@ -134,6 +144,16 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
RoutingSender::~RoutingSender()
{
unloadLibraries();
+ HandlesMap::iterator it=mlistActiveHandles.begin();
+
+ //clean up heap if existent
+ for(;it!=mlistActiveHandles.end();++it)
+ {
+ if (it->first.handleType==H_SETSINKSOUNDPROPERTIES || it->first.handleType==H_SETSOURCESOUNDPROPERTIES)
+ {
+ delete it->second.soundProperties;
+ }
+ }
}
void RoutingSender::routingInterfacesReady()
@@ -263,11 +283,10 @@ am_Error_e RoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, const a
handle=createHandle(handleData,H_SETSINKSOUNDPROPERTY);
mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
return iter->second->asyncSetSinkSoundProperty(handle,soundProperty,sinkID);
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
-
am_Error_e RoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
am_handleData_c handleData;
@@ -279,11 +298,39 @@ am_Error_e RoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, const
handle=createHandle(handleData,H_SETSOURCESOUNDPROPERTY);
mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
return iter->second->asyncSetSourceSoundProperty(handle,soundProperty,sourceID);
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
+am_Error_e am::RoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID)
+{
+ am_handleData_c handleData;
+ SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
+ iter=mMapSourceInterface.find(sourceID);
+ if (iter != mMapSourceInterface.end())
+ handleData.sourceID=sourceID;
+ handleData.soundProperties=new std::vector<am_SoundProperty_s>(listSoundProperties);
+ handle=createHandle(handleData,H_SETSOURCESOUNDPROPERTIES);
+ mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
+ return iter->second->asyncSetSourceSoundProperties(handle,listSoundProperties,sourceID);
+ return (E_NON_EXISTENT);
+}
+am_Error_e am::RoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sinkID_t sinkID)
+{
+ am_handleData_c handleData;
+ SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
+ iter=mMapSinkInterface.find(sinkID);
+ if (iter != mMapSinkInterface.end())
+ handleData.sinkID=sinkID;
+ handleData.soundProperties=new std::vector<am_SoundProperty_s>(listSoundProperties);
+ handle=createHandle(handleData,H_SETSINKSOUNDPROPERTIES);
+ mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
+ return iter->second->asyncSetSinkSoundProperties(handle,listSoundProperties,sinkID);
+ return (E_NON_EXISTENT);
+
+}
+
am_Error_e RoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
am_handleData_c handleData;
@@ -455,9 +502,9 @@ am_Handle_s RoutingSender::createHandle(const am_handleData_c& handleData, const
return handle;
}
-RoutingSender::am_handleData_c RoutingSender::returnHandleData(am_Handle_s handle)
+RoutingSender::am_handleData_c RoutingSender::returnHandleData(const am_Handle_s handle) const
{
- HandlesMap::iterator it=mlistActiveHandles.begin();
+ HandlesMap::const_iterator it=mlistActiveHandles.begin();
it=mlistActiveHandles.find(handle);
return (it->second);
}
@@ -472,6 +519,26 @@ void RoutingSender::unloadLibraries(void)
mListLibraryHandles.clear();
}
+am_Error_e am::RoutingSender::getListPlugins(std::vector<std::string>& interfaces) const
+{
+ std::vector<InterfaceNamePairs>::const_iterator it=mListInterfaces.begin();
+ for(;it!=mListInterfaces.end();++it)
+ {
+ interfaces.push_back(it->busName);
+ }
+ return E_OK;
+}
+
+
+uint16_t RoutingSender::getInterfaceVersion() const
+{
+ return (RoutingSendVersion);
+}
+
+
+
+
+