# HG changeset patch # User hgs # Date 1280227323 -10800 # Node ID 9866e1d495565f51022bd127235d62f1d5c23f39 # Parent 3aeaa0c5c8c19152f4c2e3e2aed90b29834e1ae9 201030_01 diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf Tue Jul 27 13:42:03 2010 +0300 @@ -40,5 +40,5 @@ ../public/remconmediabrowsetypes.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsetypes.h) ../public/remconmediabrowsepanic.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsepanic.h) -../public/remconmediabrowsetargetbase.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcon/remconmediabrowsetargetbase.h) +../public/remconmediabrowsetargetbase.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconmediabrowsetargetbase.h) diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf Tue Jul 27 13:42:03 2010 +0300 @@ -30,4 +30,4 @@ ../public/remcondatabaseunawarenowplayingtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtarget.h) ../public/remcondatabaseunawarenowplayingtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtargetobserver.h) -../public/remconnowplayingtargetbase.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcon/remconnowplayingtargetbase.h) +../public/remconnowplayingtargetbase.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconnowplayingtargetbase.h) diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h Tue Jul 27 13:42:03 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-2010 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" @@ -88,6 +88,7 @@ void ClientStatus(TBool aControllerPresent, TBool aTargetPresent); TInt SetLocalAddressedClient(const TRemConClientId& aId); void ControllerFeaturesUpdatedL(RArray& aSupportedInterfaces); + void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); MIncomingCommandHandler& InternalCommandHandler(); // Interface to command handler @@ -106,7 +107,10 @@ void MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus); void MpsoError(TRemConClientId aId); - + // Helper function for ClientAvailable and TargetFeaturesUpdated + TInt SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); + void UpdateSdpRecord(const TAvrcpMediaPlayerItem& aItem); + //--------------------------------------------------------- // Bulk thread only functions //--------------------------------------------------------- diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h Tue Jul 27 13:42:03 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-2010 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" @@ -118,6 +118,8 @@ virtual TInt SetLocalAddressedClient(TRemConClientId& aId); + virtual void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); + private: // from CRemConBearerPlugin TAny* GetInterface(TUid aUid); diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp Tue Jul 27 13:42:03 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-2010 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" @@ -564,13 +564,13 @@ // Can ignore this as we know we have allocated a big enough buffer TRAP_IGNORE(response.WriteL(responseBuf)); + + iCommandInterface.MrccciSetAddressedClient(iClientId); break; } }; SendInternalResponse(aId, responseBuf); - iCommandInterface.MrccciSetAddressedClient(iClientId); - responseBuf.Close(); } diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp Tue Jul 27 13:42:03 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-2010 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,7 +133,33 @@ iUidWatcher = NULL; } -void CAvrcpPlayerInfoManager::ClientAvailable(const TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName) +// 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) { LOG_FUNC; ASSERT_CONTROL_THREAD; @@ -150,15 +176,11 @@ 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; - item.iFeatureBitmask = TPlayerFeatureBitmask(); - TInt err = SetPlayerFeatures(aId, item.iFeatureBitmask, item.iSdpFeatures, item.iAbsoluteVolumeSupport); + 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 @@ -168,41 +190,21 @@ if(!err) { TRAP(err, iPlayStatusWatcher->StartWatchingPlayerL(aId)); - if(!err) { - // Update SDP record, if this fails we carry on, it's non-fatal - TInt sdpErr = KErrNone; - if(!iTargetRecord) + UpdateSdpRecord(item); + for(TInt i = 0; iMpcoAvailablePlayersChanged(); } } - } - - if(!err) - { - for(TInt i = 0; iMpcoAvailablePlayersChanged(); + iLock.Wait(); + iPlayers[index].iId = KNullClientId; + iLock.Signal(); } } - else - { - iLock.Wait(); - iPlayers[index].iId = KNullClientId; - iLock.Signal(); - } } void CAvrcpPlayerInfoManager::ClientNotAvailable(const TRemConClientId& aId) @@ -303,6 +305,46 @@ 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 diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp Tue Jul 27 13:42:03 2010 +0300 @@ -37,14 +37,17 @@ void CPlayerWatcherBase::StopWatchingPlayer(TRemConClientId aClientId) { LOG_FUNC; - CInternalCommand* command = *iCommands.Find(aClientId); - __ASSERT_DEBUG(command, AVRCP_PANIC(ENotWatchingPlayer)); - - TUint transId = command->RemConCommandId(); - iCommandInterface.MrcciCommandExpired(transId); - - iCommands.Remove(aClientId); - command->DecrementUsers(); + CInternalCommand** cmdPtr = iCommands.Find(aClientId); + if (cmdPtr) // This may be NULL if we've already stopped watching the player as a result of reciving a reject + { + CInternalCommand* cmd = *cmdPtr; + + TUint transId = cmd->RemConCommandId(); + iCommandInterface.MrcciCommandExpired(transId); + + iCommands.Remove(aClientId); + cmd->DecrementUsers(); + } } void CPlayerWatcherBase::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/) diff -r 3aeaa0c5c8c1 -r 9866e1d49556 bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp Mon Jul 26 10:02:52 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp Tue Jul 27 13:42:03 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-2010 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" @@ -698,6 +698,19 @@ return iPlayerInfoManager->SetLocalAddressedClient(aId); } +void CRemConBearerAvrcp::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) + { + LOG_FUNC + + if (!iConstructionComplete) + { + // Object only partially constructed, swallow the request + return; + } + + iPlayerInfoManager->TargetFeaturesUpdated(aId, aPlayerType, aPlayerSubType, aName); + } + void CRemConBearerAvrcp::ControllerFeaturesUpdated(RArray& aSupportedInterfaces) { LOG_FUNC