51
|
1 |
// Copyright (c) 2008-2010 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 CONTROLBEARER_H
|
|
17 |
#define CONTROLBEARER_H
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file
|
|
21 |
@internalComponent
|
|
22 |
@released
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include <avctpservices.h>
|
|
26 |
#include <btsdp.h>
|
|
27 |
#include <e32std.h>
|
|
28 |
#include <remcon/clientid.h>
|
|
29 |
#include <remcon/remconbearerinterface.h>
|
|
30 |
#include <remcon/remconbearerplugin.h>
|
|
31 |
#include <remcon/avrcpspec.h>
|
|
32 |
#include <remcon/messagetype.h>
|
|
33 |
#include <remcon/playertype.h>
|
|
34 |
#include "avrcpbearerinterface.h"
|
|
35 |
#include "remconcommandinterface.h"
|
|
36 |
|
|
37 |
class CControlCommand;
|
|
38 |
class CRcpRemoteDevice;
|
|
39 |
class CControlRouter;
|
|
40 |
class TBTDevAddr;
|
|
41 |
class CBrowseCommand;
|
|
42 |
class CAvrcpPlayerInfoManager;
|
|
43 |
class CAvrcpBulkBearer;
|
|
44 |
|
|
45 |
NONSHARABLE_CLASS(CRemConBearerAvrcp) : public CRemConBearerPlugin, public MRemConBearerInterfaceV3,
|
|
46 |
public MAvrcpBearer, public MRemConControlCommandInterface
|
|
47 |
{
|
|
48 |
public:
|
|
49 |
static CRemConBearerAvrcp* NewL(TBearerParams& aParams);
|
|
50 |
virtual ~CRemConBearerAvrcp();
|
|
51 |
|
|
52 |
public: // Interface to command handlers, from MRemConCommandInterface
|
|
53 |
void MrcciNewCommand(CAvrcpCommand& aCommand);
|
|
54 |
void MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId);
|
|
55 |
void MrccciNewNotifyCommand(CAvrcpCommand& aCommand);
|
|
56 |
void MrccciNewNotifyCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId);
|
|
57 |
|
|
58 |
void MrccciNewResponse(CAvrcpCommand& aCommand);
|
|
59 |
void MrccciNewNotifyResponse(CControlCommand& aCommand);
|
|
60 |
|
|
61 |
TUint MrcciNewTransactionId();
|
|
62 |
void MrcciCommandExpired(TUint aTransactionId);
|
|
63 |
|
|
64 |
void MrccciSetAddressedClient(const TRemConClientId& aClient);
|
|
65 |
void MrccciRegisterForLocalAddressedClientUpdates();
|
|
66 |
void MrccciUnregisterForLocalAddressedClientUpdates();
|
|
67 |
|
|
68 |
private: // MRemConBearerInterfaceV3 functions called from RemCon
|
|
69 |
virtual TInt GetResponse(TUid& aInterfaceUid,
|
|
70 |
TUint& aId,
|
|
71 |
TUint& aOperationId,
|
|
72 |
RBuf8& aCommandData,
|
|
73 |
TRemConAddress& aAddr);
|
|
74 |
|
|
75 |
virtual TInt SendCommand(TUid aInterfaceUid,
|
|
76 |
TUint aOperationId,
|
|
77 |
TUint aId,
|
|
78 |
RBuf8& aData,
|
|
79 |
const TRemConAddress& aAddr);
|
|
80 |
|
|
81 |
virtual TInt GetCommand(TUid& aInterfaceUid,
|
|
82 |
TUint& aId,
|
|
83 |
TUint& aOperationId,
|
|
84 |
RBuf8& aCommandData,
|
|
85 |
TRemConAddress& aAddr);
|
|
86 |
|
|
87 |
virtual TInt GetNotifyCommand(TUid& aInterfaceUid,
|
|
88 |
TUint& aId,
|
|
89 |
TUint& aOperationId,
|
|
90 |
RBuf8& aCommandData,
|
|
91 |
TRemConAddress& aAddr);
|
|
92 |
|
|
93 |
virtual CAvrcpCommand* GetFirstCommand(TDblQue<CAvrcpCommand>& aQue,
|
|
94 |
TUid& aInterfaceUid,
|
|
95 |
TUint& aId,
|
|
96 |
TUint& aOperationId,
|
|
97 |
RBuf8& aCommandData,
|
|
98 |
TRemConAddress& aAddr);
|
|
99 |
|
|
100 |
virtual TInt SendResponse(TUid aInterfaceUid,
|
|
101 |
TUint aOperationId,
|
|
102 |
TUint aId,
|
|
103 |
RBuf8& aData,
|
|
104 |
const TRemConAddress& aAddr);
|
|
105 |
|
|
106 |
virtual void SendReject(TUid aInterfaceUid,
|
|
107 |
TUint aOperationId,
|
|
108 |
TUint aTransactionId,
|
|
109 |
const TRemConAddress& aAddr);
|
|
110 |
virtual void ConnectRequest(const TRemConAddress& aAddr);
|
|
111 |
virtual void DisconnectRequest(const TRemConAddress& aAddr);
|
|
112 |
|
|
113 |
virtual TSecurityPolicy SecurityPolicy() const;
|
|
114 |
void ClientStatus(TBool aControllerPresent, TBool aTargetPresent);
|
|
115 |
virtual void ClientAvailable(TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName);
|
|
116 |
virtual void ClientNotAvailable(TRemConClientId& aId);
|
|
117 |
virtual void ControllerFeaturesUpdated(RArray<TUid>& aSupportedInterfaces);
|
|
118 |
|
|
119 |
virtual TInt SetLocalAddressedClient(TRemConClientId& aId);
|
|
120 |
|
|
121 |
virtual void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName);
|
|
122 |
|
|
123 |
private: // from CRemConBearerPlugin
|
|
124 |
TAny* GetInterface(TUid aUid);
|
|
125 |
|
|
126 |
private:
|
|
127 |
// from MAvrcpBearer called from router
|
|
128 |
void ConnectIndicate(const TBTDevAddr& aBTDevice);
|
|
129 |
void ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError);
|
|
130 |
void DisconnectIndicate(const TBTDevAddr& aBTDevice);
|
|
131 |
void DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError);
|
|
132 |
|
|
133 |
MIncomingCommandHandler* IncomingHandler(const TBTDevAddr& aAddr);
|
|
134 |
MOutgoingCommandHandler* OutgoingHandler(const TBTDevAddr& aAddr);
|
|
135 |
|
|
136 |
private:
|
|
137 |
// MRemConBearerInterfaceV3 plugin functions called from RemCon
|
|
138 |
virtual TInt SendNotifyCommand(TUid aInterfaceUid,
|
|
139 |
TUint aOperationId,
|
|
140 |
TUint aId,
|
|
141 |
RBuf8& aData,
|
|
142 |
const TRemConAddress& aAddr);
|
|
143 |
|
|
144 |
virtual TInt GetNotifyResponse(TUid& aInterfaceUid,
|
|
145 |
TUint& aId,
|
|
146 |
TUint& aOperationId,
|
|
147 |
RBuf8& aCommandData,
|
|
148 |
TRemConAddress& aAddr,
|
|
149 |
TRemConMessageSubType& aSubMessageType);
|
|
150 |
|
|
151 |
private:
|
|
152 |
enum TAvrcpRecordType
|
|
153 |
{
|
|
154 |
EAvrcpRemoteControlRecord,
|
|
155 |
EAvrcpRemoteControlTargetRecord,
|
|
156 |
};
|
|
157 |
|
|
158 |
private:
|
|
159 |
CRemConBearerAvrcp(TBearerParams& aParams);
|
|
160 |
void ConstructL();
|
|
161 |
|
|
162 |
// utility functions
|
|
163 |
CRcpRemoteDevice* RemoteDevice(const TBTDevAddr& aAddr);
|
|
164 |
|
|
165 |
void UpdateServiceRecordL(RSdpDatabase& aSdpDatabase,
|
|
166 |
TBool aController,
|
|
167 |
TBool aTarget);
|
|
168 |
void RegisterServiceRecordL(RSdpDatabase& aSdpDatabase,
|
|
169 |
TAvrcpRecordType aType);
|
|
170 |
|
|
171 |
void HandleUndeliveredCommand(CAvrcpCommand& aCommand, const TRemConAddress& aAddr);
|
|
172 |
|
|
173 |
private:
|
|
174 |
TDblQue<CRcpRemoteDevice> iRemotes;
|
|
175 |
TDblQue<CAvrcpCommand> iReadyCommands;
|
|
176 |
TDblQue<CAvrcpCommand> iReadyResponses;
|
|
177 |
TDblQue<CControlCommand> iReadyNotifyResponses;
|
|
178 |
TDblQue<CAvrcpCommand> iReadyNotifyCommands;
|
|
179 |
CControlRouter* iRouter;
|
|
180 |
CDeltaTimer* iTimer;
|
|
181 |
RSdp iSdp;
|
|
182 |
TSdpServRecordHandle iControllerSdpRecordHandle;
|
|
183 |
TSdpServRecordHandle iTargetSdpRecordHandle;
|
|
184 |
TBool iConstructionComplete;
|
|
185 |
CAvrcpPlayerInfoManager* iPlayerInfoManager;
|
|
186 |
MIncomingCommandHandler* iInternalHandler;
|
|
187 |
|
|
188 |
CAvrcpBulkBearer* iBulkBearer;
|
|
189 |
|
|
190 |
RAvctp iAvctp;
|
|
191 |
|
|
192 |
TInt iRemotesInterestedInLocalAddressedClient;
|
|
193 |
};
|
|
194 |
|
|
195 |
#endif //CONTROLBEARER_H
|