bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp
branchRCL_3
changeset 20 2f88a7d66f50
parent 0 f63038272f30
child 49 9866e1d49556
--- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp	Tue Apr 27 16:49:44 2010 +0300
+++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp	Tue May 11 16:23:08 2010 +0300
@@ -54,7 +54,7 @@
 @return A fully constructed CRcpIncomingCommandHandler.
 @leave System wide error codes.
 */
-CRcpIncomingCommandHandler* CRcpIncomingCommandHandler::NewL(CRemConBearerAvrcp& aBearer,
+CRcpIncomingCommandHandler* CRcpIncomingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface,
 	MRemConBearerObserver& aObserver,
 	CRcpRouter& aRouter,
 	CDeltaTimer& aTimer,
@@ -62,7 +62,7 @@
 	TBTDevAddr& aDevice) 
 	{
 	LOG_STATIC_FUNC
-	CRcpIncomingCommandHandler* handler = new(ELeave)CRcpIncomingCommandHandler(aBearer, aObserver, aRouter, aTimer, aPlayerInfoManager, aDevice);
+	CRcpIncomingCommandHandler* handler = new(ELeave)CRcpIncomingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer, aPlayerInfoManager, aDevice);
 	CleanupStack::PushL(handler);
 	handler->ConstructL();
 	CleanupStack::Pop(handler);
@@ -78,7 +78,7 @@
 @return A partially constructed CRcpIncomingCommandHandler.
 @leave System wide error codes.
 */	
-CRcpIncomingCommandHandler::CRcpIncomingCommandHandler(CRemConBearerAvrcp& aBearer, 
+CRcpIncomingCommandHandler::CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, 
 	MRemConBearerObserver& aObserver,
 	CRcpRouter& aRouter,
 	CDeltaTimer& aTimer,
@@ -87,7 +87,7 @@
 	: iCommandQueue(_FOFF(CControlCommand, iHandlingLink))
 	, iInternalCommandQueue(_FOFF(CControlCommand, iHandlingLink))
 	, iFragmenter(NULL)
-	, iBearer(aBearer)
+	, iCommandInterface(aCommandInterface)
 	, iObserver(aObserver)
 	, iRouter(aRouter)
 	, iTimer(aTimer)
@@ -121,7 +121,7 @@
 	
 	CleanupStack::PopAndDestroy(&players);
 	
-	iPassthroughHelper = CPassthroughHelper::NewL(iRouter, iBearer, iTimer);
+	iPassthroughHelper = CPassthroughHelper::NewL(iRouter, iCommandInterface, iTimer);
 	}
 
 /** Destructor.
@@ -130,6 +130,7 @@
 	{
 	LOG_FUNC
 
+	iCommandInterface.MrccciUnregisterForLocalAddressedClientUpdates();
 	iPlayerInfoManager.RemoveObserver( *this );
 	delete iFragmenter;
 	delete iPassthroughHelper;
@@ -207,7 +208,7 @@
 	{
 	LOG_FUNC
 		
-	TUint id = iBearer.MrcciNewTransactionId();
+	TUint id = iCommandInterface.MrcciNewTransactionId();
 	
 	// If there's nothing beyond a header this is bobs.  Dump it now.
 	if(aMessageInformation.Length() <= KAVCFrameHeaderLength)
@@ -508,11 +509,11 @@
 		// can go directly to client (unlike passthrough which may need to map 2 commands to 1 click
 		if (aCommand.Frame().Type() == AVC::ENotify)
 			{
-			iBearer.MrccciNewNotifyCommand(aCommand, aCommand.ClientId());
+			iCommandInterface.MrccciNewNotifyCommand(aCommand, aCommand.ClientId());
 			}
 		else
 			{
-			iBearer.MrcciNewCommand(aCommand, aCommand.ClientId());
+			iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId());
 			}
 		}
 	}
@@ -522,7 +523,7 @@
 	LOG_FUNC
 	
 	// Once we respond to this we've told the remote that we're using a particular player
-	iAddressedMode = ETrue;
+	EnterAddressedMode();
 	
 	// SetAddressedPlayer involves not just responding to this command but
 	// also rejecting a bunch of notifies and completing the addressed player
@@ -568,7 +569,7 @@
 			};
 	
 		SendInternalResponse(aId, responseBuf);
-		iBearer.MrccciSetAddressedClient(iClientId);
+		iCommandInterface.MrccciSetAddressedClient(iClientId);
 	
 		responseBuf.Close();
 		}
@@ -662,7 +663,7 @@
 	LOG_FUNC
 
 	// Once we respond to this we've told the remote that we're using a particular player
-	iAddressedMode = ETrue;
+	EnterAddressedMode();
 	
 	RBuf8 responseBuf;
 	TRAPD(err, DoHandleRegisterAddressedPlayerNotificationL(responseBuf, aCommand));
@@ -720,7 +721,7 @@
 
 	// Although we haven't strictly told the remote which player we're using this is 
 	// a 1.4 command, and implies use of a specific player so switch into addressed mode
-	iAddressedMode = ETrue;
+	EnterAddressedMode();
 
 	RBuf8 responseBuf;
 	TUint16 uidCounter = 0;
@@ -823,6 +824,12 @@
 	aData.Close();
 	}
 
+void CRcpIncomingCommandHandler::EnterAddressedMode()
+	{
+	iAddressedMode = ETrue;
+	iCommandInterface.MrccciRegisterForLocalAddressedClientUpdates();
+	}
+
 TBool CRcpIncomingCommandHandler::DuplicateNotify(TDblQue<CControlCommand>& aCommandQueue, const CControlCommand& aCommand) const
 	{
 	TUid interfaceUid = aCommand.RemConInterfaceUid();