51
|
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 AVRCPOUTGOINGCOMMANDHANDLER_H
|
|
17 |
#define AVRCPOUTGOINGCOMMANDHANDLER_H
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file
|
|
21 |
@internalComponent
|
|
22 |
@released
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include <e32base.h>
|
|
26 |
#include <avctpservices.h>
|
|
27 |
#include "commandhandlerinterface.h"
|
|
28 |
|
|
29 |
using namespace SymbianAvctp;
|
|
30 |
|
|
31 |
class CControlCommand;
|
|
32 |
class CRcpRouter;
|
|
33 |
class MRemConControlCommandInterface;
|
|
34 |
class MRemConBearerObserver;
|
|
35 |
NONSHARABLE_CLASS(CRcpOutgoingCommandHandler) : public CBase, public MOutgoingCommandHandler
|
|
36 |
{
|
|
37 |
public:
|
|
38 |
// Construction/Destruction
|
|
39 |
static CRcpOutgoingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface,
|
|
40 |
MRemConBearerObserver& aObserver,
|
|
41 |
CRcpRouter& aRouter,
|
|
42 |
CDeltaTimer& aTimer);
|
|
43 |
~CRcpOutgoingCommandHandler();
|
|
44 |
|
|
45 |
// Called from bearer
|
|
46 |
void Disconnect(TBool aClearQueue);
|
|
47 |
|
|
48 |
// Delta timer callback functions
|
|
49 |
static TInt ResponseExpiry(TAny* aExpiryInfo);
|
|
50 |
static TInt ReleaseExpiry(TAny* aExpiryInfo);
|
|
51 |
|
|
52 |
private:
|
|
53 |
// From MOutgoingCommandHandler
|
|
54 |
void MaxPacketSize(TInt aMtu);
|
|
55 |
void ReceiveResponse(const TDesC8& aMessageInformation, TTransactionLabel aTransLabel, TBool aIpidBitSet);
|
|
56 |
void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult);
|
|
57 |
|
|
58 |
void SendCommandL(TUid aInterfaceUid,
|
|
59 |
TUint aCommand,
|
|
60 |
TUint aId,
|
|
61 |
RBuf8& aCommandData,
|
|
62 |
const TBTDevAddr& aAddr);
|
|
63 |
|
|
64 |
void SendNotifyCommandL(TUid aInterfaceUid,
|
|
65 |
TUint aCommand,
|
|
66 |
TUint aId,
|
|
67 |
RBuf8& aCommandData,
|
|
68 |
const TBTDevAddr& aAddr);
|
|
69 |
|
|
70 |
private:
|
|
71 |
CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface,
|
|
72 |
MRemConBearerObserver& aObserver,
|
|
73 |
CRcpRouter& aRouter,
|
|
74 |
CDeltaTimer& aTimer);
|
|
75 |
|
|
76 |
// Internal send utility funcs
|
|
77 |
void CleanupUnreleased();
|
|
78 |
CControlCommand& SendCommandL(TUid aInterfaceUid,
|
|
79 |
TUint aCommand,
|
|
80 |
TUint aId,
|
|
81 |
RBuf8& aCommandData,
|
|
82 |
TBool isClick,
|
|
83 |
const TBTDevAddr& aAddr,
|
|
84 |
TBool aKnownToBearer,
|
|
85 |
TBool aNotify);
|
|
86 |
|
|
87 |
void HandleCoreApiCommandL(TUint aCommand,
|
|
88 |
TUint aId,
|
|
89 |
RBuf8& aCommandData,
|
|
90 |
const TBTDevAddr& aAddr);
|
|
91 |
|
|
92 |
void GenerateFailureResult(CControlCommand& aCommand, TInt aResult);
|
|
93 |
void GenerateCommandL(CControlCommand& aCommand, TRemConCoreApiButtonAction aButtonAct);
|
|
94 |
|
|
95 |
// Timer functions
|
|
96 |
void ResponseExpiry(CControlCommand& aCommand);
|
|
97 |
void ReleaseExpiry(CControlCommand& aCommand);
|
|
98 |
void StartResponseTimer(CControlCommand& aCommand);
|
|
99 |
void StartReleaseTimer(CControlCommand& aCommand);
|
|
100 |
void ClearQueue(TDblQue<CControlCommand>& aQue);
|
|
101 |
void ProcessDisconnect(TDblQue<CControlCommand>& aQue, TBool aClearQueue);
|
|
102 |
CControlCommand* FindInQueue(TDblQue<CControlCommand>& aQue, SymbianAvctp::TTransactionLabel aTransLabel);
|
|
103 |
void ProcessReceiveResponse(CAVCFrame* aFrame,
|
|
104 |
TBool aIpidBitSet,
|
|
105 |
CControlCommand* aCommand,
|
|
106 |
TBool aNotify);
|
|
107 |
private:
|
|
108 |
TTransactionLabel iCurrentTrans;
|
|
109 |
TDblQue<CControlCommand> iCommandQueue;
|
|
110 |
TDblQue<CControlCommand> iNotifyCommandQueue;
|
|
111 |
|
|
112 |
MRemConControlCommandInterface& iCommandInterface;
|
|
113 |
MRemConBearerObserver& iObserver;
|
|
114 |
CRcpRouter& iRouter;
|
|
115 |
CDeltaTimer& iTimer;
|
|
116 |
|
|
117 |
CControlCommand* iUnreleasedCommand;
|
|
118 |
TBool iUnreleasedHasResponse;
|
|
119 |
TInt iReleaseTimerExpiryCount;
|
|
120 |
};
|
|
121 |
|
|
122 |
#endif // AVRCPOUTGOINGCOMMANDHANDLER_H
|