|
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 CRemConBearerAvrcp; |
|
36 class CAVCFrame; |
|
37 class TBTDevAddr; |
|
38 NONSHARABLE_CLASS(CRcpIncomingCommandHandler) : public CBase, public MPlayerChangeObserver, public MIncomingCommandHandler |
|
39 { |
|
40 public: |
|
41 static CRcpIncomingCommandHandler* NewL(CRemConBearerAvrcp& aBearer, |
|
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(CRemConBearerAvrcp& aBearer, |
|
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 // Timer functions |
|
97 TBool DuplicateNotify(TDblQue<CControlCommand>& aCommandQueue, const CControlCommand& aCommand) const; |
|
98 CControlCommand* FindNotify(TDblQue<CControlCommand>& aCommandQueue, TUid aInterfaceUid, TUint aOperationId); |
|
99 private: |
|
100 TDblQue<CControlCommand> iCommandQueue; |
|
101 TDblQue<CControlCommand> iInternalCommandQueue; |
|
102 |
|
103 CAVRCPFragmenter* iFragmenter; |
|
104 CRemConBearerAvrcp& iBearer; |
|
105 MRemConBearerObserver& iObserver; |
|
106 CRcpRouter& iRouter; |
|
107 CDeltaTimer& iTimer; |
|
108 TRemConClientId iClientId; // We store the client id even if we aren't |
|
109 // in addressed mode as we may switch into |
|
110 // it and need to know the current local |
|
111 // addressed player |
|
112 TBool iAddressedMode; |
|
113 |
|
114 CAvrcpPlayerInfoManager& iPlayerInfoManager; |
|
115 TBTDevAddr& iDevice; |
|
116 |
|
117 CPassthroughHelper* iPassthroughHelper; |
|
118 }; |
|
119 |
|
120 CAvrcpPlayerInfoManager& CRcpIncomingCommandHandler::AvrcpPlayerInfoManager() const |
|
121 { |
|
122 return iPlayerInfoManager; |
|
123 } |
|
124 |
|
125 #endif // AVRCPINCOMINGCOMMANDHANDLER_H |