|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * ============================================================================ |
|
16 * Name : basrvaccman.h |
|
17 * Part of : BTEng / Bluetooth Accessory Server |
|
18 * Description : |
|
19 * Version : %version: 3.1.4.1.2.2.10 % |
|
20 * |
|
21 */ |
|
22 |
|
23 |
|
24 #ifndef C_BTASRVACCMAN_H |
|
25 #define C_BTASRVACCMAN_H |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <bttypes.h> |
|
29 #include <btnotif.h> |
|
30 #include <btengconstants.h> |
|
31 #include "basrvactive.h" |
|
32 #include "btaccObserver.h" |
|
33 #include "BTAccFwIf.h" |
|
34 #include "basrvactivenotifier.h" |
|
35 |
|
36 class CBasrvAcc; |
|
37 class CBTAccSession; |
|
38 class TAccInfo; |
|
39 class CBasrvPluginMan; |
|
40 class CBasrvAudio4Dos; |
|
41 |
|
42 class CBasrvAccMan : |
|
43 public CBase, |
|
44 public MBTAccObserver, |
|
45 public MBasrvActiveObserver |
|
46 { |
|
47 public: |
|
48 static CBasrvAccMan* NewL(); |
|
49 |
|
50 ~CBasrvAccMan(); |
|
51 |
|
52 void LoadServicesL(); |
|
53 |
|
54 void ConnectL(CBTAccSession& aSession, const TBTDevAddr& aAddr); |
|
55 |
|
56 void CancelConnect(const TBTDevAddr& aAddr); |
|
57 |
|
58 void DisconnectL(CBTAccSession& aSession, const TBTDevAddr& aAddr); |
|
59 |
|
60 void DisconnectAllL(CBTAccSession& aSession); |
|
61 |
|
62 void SetProfileNotifySession(CBTAccSession& aSession); |
|
63 |
|
64 void ClearProfileNotifySession(CBTAccSession& aSession); |
|
65 |
|
66 const TAccInfo* AccInfo(const TBTDevAddr& aAddr); |
|
67 |
|
68 CBasrvPluginMan& PluginMan(); |
|
69 |
|
70 void ConnectCompletedL(const TBTDevAddr& aAddr, TInt aErr, TInt aProfile, const RArray<TBTDevAddr>* aConflicts = NULL); |
|
71 |
|
72 void DisconnectCompletedL(const TBTDevAddr& aAddr, TInt aProfile, TInt aErr); |
|
73 |
|
74 TInt OpenAudioCompleted(const TBTDevAddr& aAddr, TAccAudioType aType, TInt aErr); |
|
75 |
|
76 TInt CloseAudioCompleted(const TBTDevAddr& aAddr, TAccAudioType aType, TInt aErr); |
|
77 |
|
78 void AccObsoleted(CBasrvAcc* aAcc, const TBTDevAddr& aAddr); |
|
79 |
|
80 CBasrvAccfwIf* AccfwConnectionL(const TAccInfo* aInfo = NULL); |
|
81 |
|
82 CBasrvAccfwIf* NewAccfwConnectionInstanceL(); |
|
83 |
|
84 void ListenAudioRequestL(); |
|
85 |
|
86 void CancelAudioRequestListen(); |
|
87 |
|
88 void RemoveAudioRequest(const TBTDevAddr& aAddr); |
|
89 |
|
90 void ShowNote(TBTGenericInfoNoteType aNote, const TBTDevAddr& aAddr); |
|
91 |
|
92 void FilterProfileSupport(TAccInfo& aInfo); |
|
93 |
|
94 TInt NotifyAccFwAudioOpened(const TBTDevAddr& aAddr, TAccAudioType aType, TInt aLatency); |
|
95 |
|
96 TInt AccInfos(RPointerArray<const TAccInfo>& aInfos); |
|
97 |
|
98 void NotifyClientNewProfile(TInt aProfile, const TBTDevAddr& aAddr); |
|
99 void NotifyClientNoProfile(TInt aProfile, const TBTDevAddr& aAddr); |
|
100 |
|
101 TBTEngConnectionStatus ConnectionStatus4Client(const TBTDevAddr& aAddr) const; |
|
102 |
|
103 // For DosServer version only |
|
104 void AudioToPhone(CBasrvAudio4Dos& aAudio4Dos); |
|
105 void AudioToAccessory(CBasrvAudio4Dos& aAudio4Dos); |
|
106 |
|
107 TBool IsAvrcpVolCTSupported(); |
|
108 TBool IsAbsoluteVolumeSupported(const TBTDevAddr& aAddr); |
|
109 TBool DisconnectIfAudioOpenFails(); |
|
110 |
|
111 private: // From MBTAccObserver |
|
112 void NewAccessory(const TBTDevAddr& aAddr, TProfiles aProfile); |
|
113 |
|
114 void AccessoryDisconnected(const TBTDevAddr& aAddr, TProfiles aProfile); |
|
115 |
|
116 void RemoteAudioOpened(const TBTDevAddr& aAddr, TProfiles aProfile); |
|
117 |
|
118 void RemoteAudioClosed(const TBTDevAddr& aAddr, TProfiles aProfile); |
|
119 |
|
120 TInt DisableNREC(const TBTDevAddr& aAddr); |
|
121 |
|
122 void AccessoryTemporarilyUnavailable(const TBTDevAddr& aAddr, TProfiles aType); |
|
123 |
|
124 TInt ConnectionStatus(const TBTDevAddr& aAddr); |
|
125 |
|
126 //TCleanupOperation callback function for TCleanupItem |
|
127 static void CleanupLastItemFromClientRequestsArray(TAny* aPtr); |
|
128 |
|
129 private: |
|
130 // From MBasrvActiveObserver |
|
131 |
|
132 /** |
|
133 * Handles the request completion event. |
|
134 * |
|
135 * @since S60 v3.1 |
|
136 * @param aActive the Active Object to which the request is assigned to. |
|
137 */ |
|
138 void RequestCompletedL(CBasrvActive& aActive); |
|
139 |
|
140 /** |
|
141 * Handles the cancellation of an outstanding request. |
|
142 * |
|
143 * @since S60 v3.1 |
|
144 * @param aActive the Active Object to which the request is assigned to. |
|
145 */ |
|
146 void CancelRequest(CBasrvActive& aActive); |
|
147 |
|
148 protected: |
|
149 /** |
|
150 * Default constructor |
|
151 */ |
|
152 CBasrvAccMan(); |
|
153 |
|
154 void ConstructL(); |
|
155 |
|
156 void HandleNewAudioRequestL(); |
|
157 |
|
158 void DoAudioRequestL(); |
|
159 |
|
160 void DestructVariant(); |
|
161 |
|
162 TInt FindAcc(const TBTDevAddr& aRemote); |
|
163 |
|
164 TInt AudioLinkStatus(); |
|
165 |
|
166 void RejectAudioLink(const TBTDevAddr& aAddr, TAccAudioType aType); |
|
167 |
|
168 private: |
|
169 enum TRequestType |
|
170 { |
|
171 ECloseReqFromAudioPolicy, |
|
172 EOpenReqFromAudioPolicy, |
|
173 ERejectAudioOpenedByAcc, |
|
174 }; |
|
175 |
|
176 class TAudioRequest |
|
177 { |
|
178 public: |
|
179 TBTDevAddr iAddr; |
|
180 TAccAudioType iAudioType; |
|
181 TRequestType iReqType; |
|
182 TBool iOngoing; |
|
183 }; |
|
184 |
|
185 class TClientRequestCache |
|
186 { |
|
187 public: |
|
188 CBTAccSession* iSession; |
|
189 TInt iRequest; |
|
190 TBTDevAddr iAddr; |
|
191 }; |
|
192 |
|
193 protected: |
|
194 RArray<TClientRequestCache> iClientRequests; |
|
195 CBTAccSession* iSessionOfDisconnectAll; // not own |
|
196 CBTAccSession* iProfileNotifySession; // not own |
|
197 |
|
198 CBasrvAudio4Dos* iAudio4Dos; // not own |
|
199 |
|
200 RPointerArray<CBasrvAcc> iAccs; |
|
201 |
|
202 CBasrvPluginMan* iPluginMan; |
|
203 CBasrvAccfwIf* iAccfw; |
|
204 |
|
205 CBasrvActive* iOpenListener; |
|
206 CBasrvActive* iCloseListener; |
|
207 TAccAudioType iOpenType; |
|
208 TAccAudioType iCloseType; |
|
209 TBTDevAddr iOpenAddr; |
|
210 TBTDevAddr iCloseAddr; |
|
211 RArray<TAudioRequest> iAudioRequests; |
|
212 |
|
213 RPointerArray<CBasrvActive> iNotifierArray; |
|
214 TBuf8<sizeof(TInt)> iNoResult; |
|
215 |
|
216 TBool iDisconnectAllPending; |
|
217 |
|
218 CBasrvActive* iAsyncHandlingActive; |
|
219 |
|
220 TBool iAvrcpVolCTSupported; |
|
221 TBool iDisconnectIfAudioOpenFails; |
|
222 }; |
|
223 |
|
224 #endif // C_BTASRVACCMAN_H |
|
225 |
|
226 // End of File |