bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h
changeset 70 f5508c13dfe0
parent 67 16e4b9007960
child 71 083fd884d7dd
equal deleted inserted replaced
67:16e4b9007960 70:f5508c13dfe0
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef AVRCPINCOMINGCOMMANDHANDLER_H
       
    17 #define AVRCPINCOMINGCOMMANDHANDLER_H
       
    18 
       
    19 /**
       
    20 @file
       
    21 @internalComponent
       
    22 @released
       
    23 */
       
    24 
       
    25 #include <avctpservices.h>
       
    26 #include <e32base.h>
       
    27 #include <remcon/clientid.h>
       
    28 
       
    29 #include "controlcommand.h"
       
    30 #include "avrcpplayerinfomanager.h"
       
    31 #include "commandhandlerinterface.h"
       
    32 
       
    33 class CPassthroughHelper;
       
    34 class CRcpRouter;
       
    35 class MRemConControlCommandInterface;
       
    36 class CAVCFrame;
       
    37 class TBTDevAddr;
       
    38 NONSHARABLE_CLASS(CRcpIncomingCommandHandler) : public CBase, public MPlayerChangeObserver, public MIncomingCommandHandler
       
    39 	{
       
    40 public:
       
    41 	static CRcpIncomingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface, 
       
    42 		MRemConBearerObserver& aObserver,
       
    43 		CRcpRouter& aRouter,
       
    44 		CDeltaTimer& aTimer,
       
    45 		CAvrcpPlayerInfoManager& aPlayerInfoManager, TBTDevAddr& aDevice);
       
    46 	void ConstructL();
       
    47 	~CRcpIncomingCommandHandler();
       
    48 	
       
    49 	void Disconnect();
       
    50 			
       
    51 	inline CAvrcpPlayerInfoManager& AvrcpPlayerInfoManager() const;
       
    52 	
       
    53 private: // from MIncomingCommandHandler
       
    54 	void MaxPacketSize(TInt aMtu);
       
    55 	void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr);
       
    56 	void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult);
       
    57 	
       
    58 	TInt SendRemConResponse(TUid aInterfaceUid, TUint aId, RBuf8& aData);
       
    59 	void SendReject(TUid aInterfaceUid, TUint aId);
       
    60 
       
    61 private:
       
    62 	CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, 
       
    63 		MRemConBearerObserver& aObserver,
       
    64 		CRcpRouter& aRouter,
       
    65 		CDeltaTimer& aTimer,
       
    66 		CAvrcpPlayerInfoManager& aPlayerInfoManager,
       
    67 		TBTDevAddr& aDevice);
       
    68 	
       
    69 	// From MPlayerChangeObserver
       
    70 	void MpcoAvailablePlayersChanged();
       
    71 	void MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId);
       
    72 	void MpcoUidCounterChanged(TRemConClientId aClientId);
       
    73 
       
    74 	void Respond(CControlCommand& aCommand, TInt aErr);
       
    75 	void HandledCommand(CControlCommand& aCommand);
       
    76 	
       
    77 	void HandleInternalCommand(CControlCommand& aCommand);
       
    78 	void HandleRemConCommand(CControlCommand& aCommand);
       
    79 
       
    80 	TInt HandleSetAddressedPlayer(TUint aId, RBuf8& aCommandData);
       
    81 	void DoHandleSetAddressedPlayerL(RBuf8& aCommandData);
       
    82 	void AddressedPlayerChangedL(TRemConClientId aClientId);
       
    83 
       
    84 	TInt HandleRegisterAvailablePlayersNotification(CControlCommand& aCommand);
       
    85 	void DoHandleRegisterAvailablePlayersNotificationL(RBuf8& aResponseData, CControlCommand& aCommand);
       
    86 
       
    87 	TInt HandleRegisterAddressedPlayerNotification(CControlCommand& aCommand);
       
    88 	void DoHandleRegisterAddressedPlayerNotificationL(RBuf8& aResponseData, CControlCommand& aCommand);
       
    89 
       
    90 	TInt HandleUidChangedNotification( CControlCommand& aCommand);
       
    91 	void DoHandleUidChangedNotificationL(RBuf8& aResponseData, TUint16 aUidCounter);
       
    92 
       
    93 	void SendInternalResponse(TUint aId, RBuf8& aData);
       
    94 	void SendResponse(TDblQue<CControlCommand>& aCommandQueue, TUint aId, RBuf8& aData);
       
    95 	
       
    96 	void EnterAddressedMode();
       
    97 
       
    98 	// Timer functions
       
    99 	TBool DuplicateNotify(TDblQue<CControlCommand>& aCommandQueue, const CControlCommand& aCommand) const;
       
   100 	CControlCommand* FindNotify(TDblQue<CControlCommand>& aCommandQueue, TUid aInterfaceUid, TUint aOperationId);
       
   101 private:
       
   102 	TDblQue<CControlCommand>	iCommandQueue;
       
   103 	TDblQue<CControlCommand>	iInternalCommandQueue;
       
   104 	
       
   105 	CAVRCPFragmenter*					iFragmenter;
       
   106 	MRemConControlCommandInterface&		iCommandInterface;
       
   107 	MRemConBearerObserver&				iObserver;
       
   108 	CRcpRouter&							iRouter;
       
   109 	CDeltaTimer& 						iTimer;
       
   110 	TRemConClientId						iClientId;	// We store the client id even if we aren't
       
   111 													// in addressed mode as we may switch into
       
   112 													// it and need to know the current local
       
   113 													// addressed player
       
   114 	TBool					iAddressedMode;
       
   115 	
       
   116 	CAvrcpPlayerInfoManager&	iPlayerInfoManager;
       
   117 	TBTDevAddr&					iDevice;
       
   118 	
       
   119 	CPassthroughHelper*			iPassthroughHelper;
       
   120 	};
       
   121 
       
   122 CAvrcpPlayerInfoManager& CRcpIncomingCommandHandler::AvrcpPlayerInfoManager() const
       
   123 	{
       
   124 	return iPlayerInfoManager;
       
   125 	}
       
   126 
       
   127 #endif // AVRCPINCOMINGCOMMANDHANDLER_H