diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -133,33 +133,7 @@ iUidWatcher = NULL; } -// Helper function for ClientAvailable and TargetFeaturesUpdated -TInt CAvrcpPlayerInfoManager::SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - aItem.iPlayerType = aPlayerType; - aItem.iPlayerSubType = aPlayerSubType; - aItem.iName.Set(aName); - aItem.iFeatureBitmask = TPlayerFeatureBitmask(); - return SetPlayerFeatures(aItem.iId, aItem.iFeatureBitmask, aItem.iSdpFeatures, aItem.iAbsoluteVolumeSupport); - } - -// Helper function for ClientAvailable and TargetFeaturesUpdated -void CAvrcpPlayerInfoManager::UpdateSdpRecord(const TAvrcpMediaPlayerItem& aItem) - { - // Update SDP record, if this fails we carry on, it's non-fatal - TInt sdpErr = KErrNone; - if(!iTargetRecord) - { - TRAP(sdpErr, AvrcpSdpUtils::CreateServiceRecordL(iSdpDatabase, iTargetRecord, ETrue, - (aItem.iSdpFeatures & AvrcpSdp::EBrowsing) ? AvrcpSdp::KAvrcpProfileVersion14 : AvrcpSdp::KAvrcpProfileVersion13)); - } - if(sdpErr == KErrNone) - { - TRAP_IGNORE(UpdateTgServiceRecordL()); - } - } - -void CAvrcpPlayerInfoManager::ClientAvailable(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) +void CAvrcpPlayerInfoManager::ClientAvailable(const TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName) { LOG_FUNC; ASSERT_CONTROL_THREAD; @@ -176,11 +150,15 @@ TAvrcpMediaPlayerItem& item = iPlayers[index]; item.iId = aId; + item.iPlayerType = aClientType; + item.iPlayerSubType = aClientSubType; + item.iName.Set(aName); item.iBulkClientAvailable = EFalse; item.iUidCounter = 0; item.iLastUpdatedUidCounter = 0; item.iPlaybackStatus = MPlayerEventsObserver::EStopped; - TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName); + item.iFeatureBitmask = TPlayerFeatureBitmask(); + TInt err = SetPlayerFeatures(aId, item.iFeatureBitmask, item.iSdpFeatures, item.iAbsoluteVolumeSupport); // Release lock before calling out of player info manager in case // anyone needs to call back in - we're finished updating the @@ -190,21 +168,41 @@ if(!err) { TRAP(err, iPlayStatusWatcher->StartWatchingPlayerL(aId)); + if(!err) { - UpdateSdpRecord(item); - for(TInt i = 0; iMpcoAvailablePlayersChanged(); + TRAP(sdpErr, AvrcpSdpUtils::CreateServiceRecordL(iSdpDatabase, + iTargetRecord, + ETrue, + (item.iSdpFeatures & AvrcpSdp::EBrowsing) ? + AvrcpSdp::KAvrcpProfileVersion14 : + AvrcpSdp::KAvrcpProfileVersion13)); + } + + if(sdpErr == KErrNone) + { + TRAP_IGNORE(UpdateTgServiceRecordL()); } } - else + } + + if(!err) + { + for(TInt i = 0; iMpcoAvailablePlayersChanged(); } } + else + { + iLock.Wait(); + iPlayers[index].iId = KNullClientId; + iLock.Signal(); + } } void CAvrcpPlayerInfoManager::ClientNotAvailable(const TRemConClientId& aId) @@ -305,46 +303,6 @@ AvrcpSdpUtils::UpdateSupportedFeaturesL(iSdpDatabase, iControllerRecord, AvrcpSdp::ERemoteControl, AvrcpSdp::KAvrcpBaseCtFeatures); } -void CAvrcpPlayerInfoManager::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - LOG_FUNC; - ASSERT_CONTROL_THREAD; - iLock.Wait(); - // Find this client in our client list - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index < 0) - { - // Couldn't find client in client list, maybe we removed it after an earlier failure - iLock.Signal(); - return; - } - - TAvrcpMediaPlayerItem& item = iPlayers[index]; - TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName); - - // Release lock before calling out of player info manager in case - // anyone needs to call back in - we're finished updating the - // info now. - iLock.Signal(); - - if(!err) - { - UpdateSdpRecord(item); - } - else - { - // There was an error updating the features so remove this client from the client list - iLock.Wait(); - iPlayers[index].iId = KNullClientId; - iLock.Signal(); - } - - for(TInt i = 0; iMpcoAvailablePlayersChanged(); - } - } - MIncomingCommandHandler& CAvrcpPlayerInfoManager::InternalCommandHandler() { LOG_FUNC