diff options
author | Aleksandar Donchev <aleksander.donchev@partner.bmw.de> | 2013-09-02 11:57:28 +0200 |
---|---|---|
committer | Christian Linke <Christian.Linke@bmw.de> | 2013-09-03 17:26:04 +0200 |
commit | a2edae5cee4254b933f42399edc0e092abd4f5cf (patch) | |
tree | ead58f525b947deed4b8c76ab9c89c80b5056227 /PluginRoutingInterfaceDbus/src | |
parent | 7aee1baeea1777318932cc49a8eac18f194233cd (diff) | |
download | audiomanager-a2edae5cee4254b933f42399edc0e092abd4f5cf.tar.gz |
*PluginCommandInterfaceCAPI, PluginRoutingInterfaceCAPI, NodeStateCommunicatorCAPI with unit tests first version.
Choosing between DBUS and Common-API via cmake.
CommonAPI - legacy support for DBus properties (Set 1)
Signed-off-by: Christian Linke <christian.linke@bmw.de>
(cherry picked from commit ea96ef59e29466667c90b506426e2a5a9cdb82d2)
Diffstat (limited to 'PluginRoutingInterfaceDbus/src')
-rw-r--r-- | PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp | 42 | ||||
-rw-r--r-- | PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp | 3 |
2 files changed, 37 insertions, 8 deletions
diff --git a/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp b/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp index 706cbd6..06da0e6 100644 --- a/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp +++ b/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp @@ -4,6 +4,7 @@ * * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012 * \author Sampreeth Ramavana + * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013 * * \copyright * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -335,14 +336,46 @@ void CAmRoutingSenderDbus::addSinkLookup(am_sinkID_t sinkID, am_domainID_t domai } } +template <typename TKey> void CAmRoutingSenderDbus::removeEntriesForValue(const rs_lookupData_s & value, std::map<TKey,rs_lookupData_s> & map) +{ + typename std::map<TKey,rs_lookupData_s>::iterator it = map.begin(); + while ( it != map.end() ) + { + if (it->second.busname == value.busname && + it->second.interface == value.interface && + it->second.path == value.path) + { + typename std::map<TKey,rs_lookupData_s>::iterator it_tmp = it; + it++; + map.erase(it_tmp); + } + else + ++it; + } +} + void CAmRoutingSenderDbus::removeDomainLookup(am_domainID_t domainID) { - mMapHandles.erase(domainID); + mapDomain_t::iterator iter(mMapDomains.begin()); + iter = mMapDomains.find(domainID); + if (iter != mMapDomains.end()) + { + CAmRoutingSenderDbus::removeEntriesForValue(iter->second, mMapSources); + CAmRoutingSenderDbus::removeEntriesForValue(iter->second, mMapSinks); + CAmRoutingSenderDbus::removeEntriesForValue(iter->second, mMapHandles); + CAmRoutingSenderDbus::removeEntriesForValue(iter->second, mMapConnections); + mMapDomains.erase(domainID); + } } void CAmRoutingSenderDbus::removeSourceLookup(am_sourceID_t sourceID) { - mMapHandles.erase(sourceID); + mMapSources.erase(sourceID); +} + +void CAmRoutingSenderDbus::removeSinkLookup(am_sinkID_t sinkID) +{ + mMapSinks.erase(sinkID); } am_Error_e CAmRoutingSenderDbus::asyncSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes) @@ -371,10 +404,5 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSourceNotificationConfiguration(const a return (E_NOT_USED); } -void CAmRoutingSenderDbus::removeSinkLookup(am_sinkID_t sinkID) -{ - mMapHandles.erase(sinkID); -} - } diff --git a/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp b/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp index 435abf1..96e7070 100644 --- a/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp +++ b/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp @@ -186,6 +186,7 @@ void IAmRoutingReceiverShadowDbus::ackDisconnect(DBusConnection* conn, DBusMessa myhandle.handle = handle; mRoutingReceiveInterface->ackDisconnect(myhandle, connectionID, error); mpRoutingSenderDbus->removeHandle(handle); + //todo: Connection removal ??? mDBUSMessageHandler.initReply(msg); mDBUSMessageHandler.sendMessage(); } @@ -252,7 +253,7 @@ void IAmRoutingReceiverShadowDbus::ackSourceVolumeTick(DBusConnection* conn, DBu am_volume_t volume(mDBUSMessageHandler.getInt()); log(&routingDbus, DLT_LOG_INFO, "IAmRoutingReceiverShadow::ackSourceVolumeTick called, handle", handle, "sourceID", sourceID, "volume", volume); am_Handle_s myhandle; - myhandle.handleType = H_SETSINKVOLUME; + myhandle.handleType = H_SETSOURCEVOLUME; myhandle.handle = handle; mRoutingReceiveInterface->ackSourceVolumeTick(myhandle, sourceID, volume); mDBUSMessageHandler.initReply(msg); |