|
1 /* |
|
2 * Copyright (c) 2005 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: Implementation for CBTSAController class. This class is advertised |
|
15 * to E-com framework (@see proxy.cpp) so that it loads this class when |
|
16 * this plugin gets loaded. That is why this class implements the interface |
|
17 * of the module (currently BT Accessory Server) which loads this plugin.Being |
|
18 * main class, this class constructs other classes and also recieves callbacks, |
|
19 * hence implementing their interfaces. |
|
20 * |
|
21 */ |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include "btsaController.h" |
|
26 #include "btsacactive.h" |
|
27 #include "btsacStateIdle.h" |
|
28 #include "btsacStateListening.h" |
|
29 #include "btsacStreamerController.h" |
|
30 #include "btsacSEPManager.h" |
|
31 #include "btsacGavdp.h" |
|
32 #include "debug.h" |
|
33 #include <e32property.h> |
|
34 #include "btaudioremconpskeys.h" |
|
35 |
|
36 _LIT_SECURITY_POLICY_C1( KPSKeyReadPolicy, |
|
37 ECapabilityLocalServices); |
|
38 _LIT_SECURITY_POLICY_C1( KPSKeyWritePolicy, |
|
39 ECapabilityLocalServices); |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 // MODULE DATA STRUCTURES |
|
44 |
|
45 // ================= MEMBER FUNCTIONS ======================= |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CBTSAController::NewL |
|
49 // Two-phased constructor. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CBTSAController* CBTSAController::NewL(TPluginParams& aParams) |
|
53 { |
|
54 CBTSAController* self = new (ELeave) CBTSAController(aParams); |
|
55 CleanupStack::PushL(self); |
|
56 self->ConstructL( ); |
|
57 CleanupStack::Pop(self); |
|
58 return self; |
|
59 } |
|
60 |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // Destructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CBTSAController::~CBTSAController() |
|
67 { |
|
68 TRACE_FUNC |
|
69 if(iStreamingSockets.Count()) |
|
70 { |
|
71 TRACE_INFO((_L("[SOCKET] closed."))) |
|
72 iStreamingSockets[0].Close(); |
|
73 } |
|
74 iStreamingSockets.Close(); |
|
75 delete iStreamer; |
|
76 delete iGavdp; |
|
77 delete iState; |
|
78 delete iGavdpErrorActive; |
|
79 delete iLocalSEPs; |
|
80 delete iRemoteSEPs; |
|
81 iAccDb.ResetAndDestroy(); |
|
82 iAccDb.Close(); |
|
83 RProperty::Delete( KBTAudioRemCon, KBTAudioPlayerControl ); |
|
84 TRACE_INFO((_L("CBTSAController::~CBTSAController() completed"))) |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CBTSAController::CBTSAController |
|
89 // C++ default constructor. |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 CBTSAController::CBTSAController(TPluginParams& aParams) |
|
93 : CBTAccPlugin(aParams) |
|
94 { |
|
95 TRACE_FUNC |
|
96 } |
|
97 |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CBTSAController::ConstructL |
|
101 // Symbian 2nd phase constructor. |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CBTSAController::ConstructL() |
|
105 { |
|
106 TRACE_FUNC_ENTRY |
|
107 CBtsacState* state = CBtsacIdle::NewL(*this); |
|
108 CleanupStack::PushL(state); |
|
109 iStreamer = CBTSACStreamerController::NewL(*this); |
|
110 // Initially idle state is registered as observer of GAVDP |
|
111 iGavdp = CBTSACGavdp::NewL(state); |
|
112 iLocalSEPs = CBTSACSEPManager::NewL(TBTDevAddr()); |
|
113 iGavdpErrorActive = CBtsacActive::NewL(*this, CActive::EPriorityStandard, KRequestIdGavdpError); |
|
114 ChangeStateL(state); |
|
115 CleanupStack::Pop(state); |
|
116 |
|
117 ResetRemoteCache(); |
|
118 |
|
119 TInt err = RProperty::Define( KBTAudioRemCon, |
|
120 KBTAudioPlayerControl, RProperty::EInt, |
|
121 KPSKeyReadPolicy, |
|
122 KPSKeyWritePolicy ); |
|
123 TRACE_INFO((_L("PS define err %d"), err)) |
|
124 TRACE_FUNC_EXIT |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CBTSAController::ChangeStateL |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CBTSAController::ChangeStateL(CBtsacState* aState) |
|
132 { |
|
133 TRACE_FUNC_ENTRY |
|
134 TRACE_ASSERT(!!aState, EBTPanicNullPointer); |
|
135 if(iState) |
|
136 { |
|
137 if(aState->GetStateIndex() == iState->GetStateIndex()) |
|
138 { |
|
139 // We already are in desired state, delete the state which came in and return |
|
140 TRACE_INFO((_L("CBTSAController::ChangeStateL(), already in desired state."))) |
|
141 delete aState; |
|
142 return; |
|
143 } |
|
144 } |
|
145 CBtsacState *CurrentState = iState; |
|
146 iState = aState; |
|
147 TInt err = KErrNone; |
|
148 TRAP(err, iState->EnterL()); |
|
149 if (err) |
|
150 { |
|
151 ChangeStateL(iState->ErrorOnEntryL(err)); |
|
152 } |
|
153 delete CurrentState; |
|
154 TRACE_FUNC_EXIT |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CBTSAController::ResetRemoteCache |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CBTSAController::ResetRemoteCache() |
|
162 { |
|
163 TRACE_FUNC |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CBTSAController::InitializeSEPManager |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CBTSAController::InitializeSEPManager() |
|
171 { |
|
172 TRACE_FUNC |
|
173 iSBCSEPIndex = 0; // SBC SEP Index in iRemoteSEPs array |
|
174 if( iRemoteSEPs ) |
|
175 { |
|
176 delete iRemoteSEPs; |
|
177 iRemoteSEPs = NULL; |
|
178 } |
|
179 TRAPD(ret, iRemoteSEPs = CBTSACSEPManager::NewL(iRemoteAddr)); |
|
180 if (ret) |
|
181 { |
|
182 TRACE_INFO((_L("CBTSAController::InitializeSEPManager(), ERROR"))) |
|
183 } |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CBTSAController::CleanSockets |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void CBTSAController::CleanSockets() |
|
191 { |
|
192 TRACE_FUNC |
|
193 if(iStreamingSockets.Count()) |
|
194 { |
|
195 // Close possible streaming socket(s) |
|
196 TRACE_INFO((_L("[SOCKET] closed."))) |
|
197 iStreamingSockets[0].Close(); |
|
198 iStreamingSockets.Remove(0); |
|
199 iStreamingSockets.Reset(); |
|
200 } |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CBTSAController::PluginType |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 TProfiles CBTSAController::PluginType() |
|
208 { |
|
209 TRACE_FUNC |
|
210 return EStereo; |
|
211 } |
|
212 |
|
213 // ----------------------------------------------------------------------------- |
|
214 // CBTSAController::ConnectToAccessory |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 void CBTSAController::ConnectToAccessory(const TBTDevAddr& aAddr, TRequestStatus& aStatus) |
|
218 { |
|
219 TRACE_FUNC_ENTRY |
|
220 TRACE_INFO_SEG( |
|
221 {TBuf<KBTDevAddrReadable> buf; aAddr.GetReadable(buf); |
|
222 Trace(_L("[REQUEST] Connect request, BT Addr %S"), &buf);}) |
|
223 iConnectStatus = &aStatus; |
|
224 aStatus = KRequestPending; |
|
225 TRAPD(err, iState->ConnectL(aAddr)); |
|
226 if (err) |
|
227 { |
|
228 CompletePendingRequests(KConnectReq, err); |
|
229 } |
|
230 TRACE_FUNC_EXIT |
|
231 } |
|
232 |
|
233 // ----------------------------------------------------------------------------- |
|
234 // CBTSAController::CancelConnectToAccessory |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 void CBTSAController::CancelConnectToAccessory(const TBTDevAddr& aAddr) |
|
238 { |
|
239 TRACE_FUNC_ENTRY |
|
240 TRACE_INFO_SEG( |
|
241 {TBuf<KBTDevAddrReadable> buf; aAddr.GetReadable(buf); Trace(_L("BT Addr %S"), &buf);}) |
|
242 if (aAddr != iRemoteAddr) |
|
243 { |
|
244 TRACE_INFO((_L("CBTSAController::CancelConnectToAccessory() Invalid address, error."))) |
|
245 CompletePendingRequests(KConnectReq, KErrArgument); |
|
246 return; |
|
247 } |
|
248 TRAP_IGNORE(iState->CancelConnectL()); |
|
249 TRACE_FUNC_EXIT |
|
250 } |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CBTSAController::DisconnectAccessory |
|
254 // ----------------------------------------------------------------------------- |
|
255 // |
|
256 void CBTSAController::DisconnectAccessory(const TBTDevAddr& aAddr, TRequestStatus& aStatus) |
|
257 { |
|
258 TRACE_FUNC_ENTRY |
|
259 TRACE_INFO_SEG( |
|
260 {TBuf<KBTDevAddrReadable> buf; aAddr.GetReadable(buf); |
|
261 Trace(_L("[REQUEST] Disconnect request, BT Addr %S"), &buf);}) |
|
262 |
|
263 // if we have an open/close audio request pending, complete it |
|
264 CompletePendingRequests((KOpenAudioReq | KCloseAudioReq), KErrDisconnected); |
|
265 iDisconnectStatus = &aStatus; |
|
266 aStatus = KRequestPending; |
|
267 if (aAddr != iRemoteAddr ) |
|
268 { |
|
269 TRACE_INFO((_L("CBTSAController::DisconnectAccessory() Invalid address, error."))) |
|
270 CompletePendingRequests(KDisconnectReq, KErrArgument); |
|
271 return; |
|
272 } |
|
273 TRAPD(err, iState->DisconnectL()); |
|
274 if (err) |
|
275 { |
|
276 CompletePendingRequests(KDisconnectReq, err); |
|
277 return; |
|
278 } |
|
279 SetResetAudioInput(ETrue); |
|
280 TRACE_FUNC_EXIT |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CBTSAController::OpenAudioLink |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 void CBTSAController::OpenAudioLink(const TBTDevAddr& aAddr, TRequestStatus& aStatus) |
|
288 { |
|
289 TRACE_FUNC_ENTRY |
|
290 TRACE_INFO_SEG( |
|
291 {TBuf<KBTDevAddrReadable> buf; aAddr.GetReadable(buf); |
|
292 Trace(_L("[REQUEST] Open audio request, BT Addr %S"), &buf);}) |
|
293 iOpenAudioStatus = &aStatus; |
|
294 aStatus = KRequestPending; |
|
295 TRAPD(err, iState->OpenAudioLinkL(aAddr)); |
|
296 if (err) |
|
297 { |
|
298 CompletePendingRequests(KOpenAudioReq, err); |
|
299 } |
|
300 TRACE_FUNC_EXIT |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------------------------- |
|
304 // CBTSAController::CancelOpenAudioLink |
|
305 // ----------------------------------------------------------------------------- |
|
306 // |
|
307 void CBTSAController::CancelOpenAudioLink(const TBTDevAddr& aAddr) |
|
308 { |
|
309 TRACE_FUNC_ENTRY |
|
310 TRACE_INFO_SEG( |
|
311 {TBuf<KBTDevAddrReadable> buf; aAddr.GetReadable(buf); Trace(_L("BT Addr %S"), &buf);}) |
|
312 if(aAddr != iRemoteAddr) |
|
313 { |
|
314 TRACE_INFO((_L("CBTSAController::CancelOpenAudioLink() Invalid address, error."))) |
|
315 CompletePendingRequests(KOpenAudioReq, KErrArgument); |
|
316 return; |
|
317 } |
|
318 if(IsOpenAudioReqFromAccFWPending()) |
|
319 { |
|
320 TRAP_IGNORE(iState->CancelOpenAudioLinkL()); |
|
321 } |
|
322 TRACE_FUNC_EXIT |
|
323 } |
|
324 |
|
325 // ----------------------------------------------------------------------------- |
|
326 // CBTSAController::CloseAudioLink |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 void CBTSAController::CloseAudioLink(const TBTDevAddr& aAddr, TRequestStatus& aStatus) |
|
330 { |
|
331 TRACE_FUNC_ENTRY |
|
332 TRACE_INFO_SEG( |
|
333 {TBuf<KBTDevAddrReadable> buf; aAddr.GetReadable(buf); |
|
334 Trace(_L("[REQUEST] Close audio request, BT Addr %S"), &buf);}) |
|
335 iCloseAudioStatus = &aStatus; |
|
336 aStatus = KRequestPending; |
|
337 TRAPD(err, iState->CloseAudioLinkL(aAddr)); |
|
338 if (err) |
|
339 { |
|
340 CompletePendingRequests(KCloseAudioReq, err); |
|
341 } |
|
342 TRACE_FUNC_EXIT |
|
343 } |
|
344 |
|
345 // ----------------------------------------------------------------------------- |
|
346 // CBTSAController::CancelCloseAudioLink |
|
347 // ----------------------------------------------------------------------------- |
|
348 // |
|
349 void CBTSAController::CancelCloseAudioLink(const TBTDevAddr& aAddr) |
|
350 { |
|
351 TRACE_FUNC_ENTRY |
|
352 TRACE_INFO_SEG( |
|
353 {TBuf<KBTDevAddrReadable> buf; aAddr.GetReadable(buf); Trace(_L("BT Addr %S"), &buf);}) |
|
354 if(aAddr != iRemoteAddr) |
|
355 { |
|
356 TRACE_INFO((_L("CBTSAController::CancelCloseAudioLink() Invalid address, error."))) |
|
357 CompletePendingRequests(KCloseAudioReq, KErrArgument); |
|
358 return; |
|
359 } |
|
360 if(iCloseAudioStatus) |
|
361 { |
|
362 iState->CancelCloseAudioLink(aAddr); |
|
363 } |
|
364 TRACE_FUNC_EXIT |
|
365 } |
|
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // CBTSAController::AccInUse |
|
369 // ----------------------------------------------------------------------------- |
|
370 // |
|
371 void CBTSAController::AccInUse() |
|
372 { |
|
373 TRACE_FUNC |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // CBTSAController::StartRecording |
|
378 // ----------------------------------------------------------------------------- |
|
379 // |
|
380 void CBTSAController::StartRecording() |
|
381 { |
|
382 TRACE_FUNC |
|
383 iState->StartRecording(); |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CBTSAController::StoreAccInfo |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
|
390 void CBTSAController::StoreAccInfo() |
|
391 { |
|
392 TRACE_FUNC |
|
393 iAccDb.Append(iRemoteSEPs); |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // CBTSAController::DeleteAccInfo |
|
398 // ----------------------------------------------------------------------------- |
|
399 // |
|
400 void CBTSAController::DeleteAccInfo() |
|
401 { |
|
402 TRACE_FUNC |
|
403 for(TInt i = 0 ; i < iAccDb.Count() ; i++) |
|
404 { |
|
405 iAccDb.Remove(i); |
|
406 } |
|
407 iAccDb.Reset(); |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CBTSAController::IsAccInfoAvailable |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 TBool CBTSAController::IsAccInfoAvailable() |
|
415 { |
|
416 TRACE_INFO((_L("CBTSAController::IsAccInfoAvailable() Count: %d"), iAccDb.Count())) |
|
417 for (TInt i=0; i<iAccDb.Count(); i++) |
|
418 { |
|
419 CBTSACSEPManager* SM = iAccDb[i]; |
|
420 if ( SM->GetDeviceAddr() == iRemoteAddr ) |
|
421 { |
|
422 iRemoteSEPs = iAccDb[i]; // retrieve SEP Manager |
|
423 return ETrue; |
|
424 } |
|
425 } |
|
426 return EFalse; |
|
427 } |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // CBTSAController::AbortStream |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 TInt CBTSAController::AbortStream() |
|
434 { |
|
435 TRACE_FUNC |
|
436 TAvdtpSEPInfo SEPInfo; |
|
437 if (iRemoteSEPs->GetInfo(iSBCSEPIndex, SEPInfo)) |
|
438 { |
|
439 TRACE_INFO((_L("CBTSAController::AbortStream() Couldn't retrieve SEP Info !"))) |
|
440 return KErrGeneral; |
|
441 } |
|
442 TSEID remoteSEPid = SEPInfo.SEID(); |
|
443 iGavdp->AbortStreaming(remoteSEPid); |
|
444 return KErrNone; |
|
445 } |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // CBTSAController::NewAccessory |
|
449 // ----------------------------------------------------------------------------- |
|
450 // |
|
451 void CBTSAController::NewAccessory(const TBTDevAddr& aAddr) |
|
452 { |
|
453 TRACE_FUNC |
|
454 TInt connectedProfiles = Observer().ConnectionStatus( aAddr ); |
|
455 if( !(connectedProfiles & EStereo) ) |
|
456 { |
|
457 Observer().NewAccessory( aAddr, EStereo ); |
|
458 } |
|
459 } |
|
460 |
|
461 // ----------------------------------------------------------------------------- |
|
462 // CBTSAController::DisconnectedFromRemote |
|
463 // ----------------------------------------------------------------------------- |
|
464 // |
|
465 void CBTSAController::DisconnectedFromRemote(const TBTDevAddr& aAddr, TInt /*aError*/) |
|
466 { |
|
467 TRACE_FUNC |
|
468 Observer().AccessoryDisconnected(aAddr, EStereo ); |
|
469 } |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // CBTSAController::AccessoryOpenedAudio |
|
473 // ----------------------------------------------------------------------------- |
|
474 // |
|
475 void CBTSAController::AccessoryOpenedAudio(const TBTDevAddr& aBDAddr) |
|
476 { |
|
477 TRACE_FUNC |
|
478 Observer().RemoteAudioOpened(aBDAddr, EStereo ); |
|
479 } |
|
480 |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CBTSAController::AccessoryClosedAudio |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 void CBTSAController::AccessoryClosedAudio(const TBTDevAddr& aBDAddr) |
|
487 { |
|
488 TRACE_FUNC |
|
489 Observer().RemoteAudioClosed(aBDAddr, EStereo ); |
|
490 } |
|
491 |
|
492 // ----------------------------------------------------------------------------- |
|
493 // CBTSAController::AccessorySuspendedAudio |
|
494 // ----------------------------------------------------------------------------- |
|
495 // |
|
496 void CBTSAController::AccessorySuspendedAudio(const TBTDevAddr& aBDAddr) |
|
497 { |
|
498 TRACE_FUNC |
|
499 RProperty::Set(KBTAudioRemCon, KBTAudioPlayerControl, EBTAudioPausePlayer); |
|
500 Observer().RemoteAudioClosed(aBDAddr, EStereo ); |
|
501 } |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CBTSAController::CompletePendingRequests |
|
505 // ----------------------------------------------------------------------------- |
|
506 // |
|
507 void CBTSAController::CompletePendingRequests(TUint aCompleteReq, TInt aError) |
|
508 { |
|
509 TRACE_INFO((_L("CBTSAController::CompletePendingRequests() Request %d"), aCompleteReq)) |
|
510 |
|
511 if((aCompleteReq & KConnectReq) && iConnectStatus) |
|
512 { |
|
513 TRACE_INFO((_L("[REQUEST] Connect request completed with %d"), aError)) |
|
514 User::RequestComplete(iConnectStatus, aError); |
|
515 } |
|
516 if((aCompleteReq & KDisconnectReq) && iDisconnectStatus) |
|
517 { |
|
518 TRACE_INFO((_L("[REQUEST] Disconnect request completed with %d"), aError)) |
|
519 User::RequestComplete(iDisconnectStatus, aError); |
|
520 } |
|
521 if((aCompleteReq & KOpenAudioReq) && iOpenAudioStatus) |
|
522 { |
|
523 TRACE_INFO((_L("[REQUEST] Open audio request completed with %d"), aError)) |
|
524 User::RequestComplete(iOpenAudioStatus, aError); |
|
525 } |
|
526 if((aCompleteReq & KCloseAudioReq) && iCloseAudioStatus) |
|
527 { |
|
528 TRACE_INFO((_L("[REQUEST] Close audio request completed with %d"), aError)) |
|
529 User::RequestComplete(iCloseAudioStatus, KErrNone); // audio sw cant handle error codes. |
|
530 } |
|
531 } |
|
532 |
|
533 // ----------------------------------------------------------------------------- |
|
534 // CBTSAController::SetRemoteAddr |
|
535 // ----------------------------------------------------------------------------- |
|
536 // |
|
537 void CBTSAController::SetRemoteAddr(const TBTDevAddr& aRemoteAddr) |
|
538 { |
|
539 iRemoteAddr = aRemoteAddr; |
|
540 } |
|
541 |
|
542 // ----------------------------------------------------------------------------- |
|
543 // CBTSAController::GetRemoteAddr |
|
544 // ----------------------------------------------------------------------------- |
|
545 // |
|
546 TBTDevAddr CBTSAController::GetRemoteAddr() const |
|
547 { |
|
548 return iRemoteAddr; |
|
549 } |
|
550 |
|
551 // ----------------------------------------------------------------------------- |
|
552 // CBTSAController::IsOpenAudioReqFromAccFWPending |
|
553 // ----------------------------------------------------------------------------- |
|
554 // |
|
555 TBool CBTSAController::IsOpenAudioReqFromAccFWPending() const |
|
556 { |
|
557 if(iOpenAudioStatus) |
|
558 return ETrue; |
|
559 else |
|
560 return EFalse; |
|
561 } |
|
562 |
|
563 // ----------------------------------------------------------------------------- |
|
564 // CBTSAController::SetSEPIndex |
|
565 // ----------------------------------------------------------------------------- |
|
566 // |
|
567 void CBTSAController::SetSEPIndex(TInt aIndex) |
|
568 { |
|
569 iSBCSEPIndex = aIndex; |
|
570 } |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // CBTSAController::GetSEPIndex |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 TInt CBTSAController::GetSEPIndex() const |
|
577 { |
|
578 return iSBCSEPIndex; |
|
579 } |
|
580 |
|
581 // ----------------------------------------------------------------------------- |
|
582 // CBTSAController::SetResetAudioInput |
|
583 // ----------------------------------------------------------------------------- |
|
584 // |
|
585 void CBTSAController::SetResetAudioInput(TBool aReset) |
|
586 { |
|
587 iResetAudioInput = aReset; |
|
588 } |
|
589 |
|
590 // ----------------------------------------------------------------------------- |
|
591 // CBTSAController::GetResetAudioInput |
|
592 // ----------------------------------------------------------------------------- |
|
593 // |
|
594 TBool CBTSAController::GetResetAudioInput() const |
|
595 { |
|
596 return iResetAudioInput; |
|
597 } |
|
598 |
|
599 // ----------------------------------------------------------------------------- |
|
600 // CBTSAController::GetGavdpErrorActive |
|
601 // ----------------------------------------------------------------------------- |
|
602 // |
|
603 CBtsacActive* CBTSAController::GetGavdpErrorActive() const |
|
604 { |
|
605 return iGavdpErrorActive; |
|
606 } |
|
607 |
|
608 // ----------------------------------------------------------------------------- |
|
609 // CBTSAController::NotifyError |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 void CBTSAController::NotifyError(TInt /*aError*/) |
|
613 { |
|
614 TRACE_FUNC |
|
615 if(iState->GetStateIndex() == EStateStreaming) |
|
616 { |
|
617 TRAP_IGNORE(iState->CloseAudioLinkL(GetRemoteAddr())); |
|
618 } |
|
619 else |
|
620 { |
|
621 TRAPD(err, ChangeStateL(CBtsacListening::NewL(*this, EGavdpResetReasonGeneral, EFalse))); |
|
622 if (err) |
|
623 { |
|
624 TRACE_INFO((_L("CBTSAController::NotifyError() Couldn't change state."))) |
|
625 } |
|
626 } |
|
627 CompletePendingRequests(KCompleteAllReqs, KErrCancel); |
|
628 } |
|
629 |
|
630 // ----------------------------------------------------------------------------- |
|
631 // CBTSAController::GAVDP_Error |
|
632 // ----------------------------------------------------------------------------- |
|
633 // |
|
634 void CBTSAController::GAVDP_Error(TInt aError) |
|
635 { |
|
636 TRACE_INFO((_L("CBTSAController::GAVDP_Error(%d)"), aError)) |
|
637 if(iGavdpErrorActive) |
|
638 { |
|
639 if (!iGavdpErrorActive->IsActive()) |
|
640 { |
|
641 TRequestStatus* sta = &(iGavdpErrorActive->iStatus); |
|
642 iGavdpErrorActive->iStatus = KRequestPending; |
|
643 User::RequestComplete(sta, aError); |
|
644 iGavdpErrorActive->GoActive(); |
|
645 } |
|
646 } |
|
647 else |
|
648 { |
|
649 TRACE_INFO((_L("CBTSAController::CBTSAController() AO doesn't exist."))) |
|
650 } |
|
651 } |
|
652 |
|
653 // ----------------------------------------------------------------------------- |
|
654 // CBTSAController::RequestCompletedL |
|
655 // ----------------------------------------------------------------------------- |
|
656 // |
|
657 void CBTSAController::RequestCompletedL(CBtsacActive& aActive) |
|
658 { |
|
659 TRACE_FUNC |
|
660 switch(aActive.RequestId()) |
|
661 { |
|
662 case KRequestIdGavdpError: |
|
663 { |
|
664 iState->HandleGavdpErrorL(aActive.iStatus.Int()); |
|
665 break; |
|
666 } |
|
667 default: |
|
668 { |
|
669 TRACE_INFO((_L("CBTSAController::RequestCompletedL() Unknown request"))) |
|
670 break; |
|
671 } |
|
672 } |
|
673 } |
|
674 |
|
675 // ----------------------------------------------------------------------------- |
|
676 // CBTSAController::CancelRequest |
|
677 // ----------------------------------------------------------------------------- |
|
678 // |
|
679 void CBTSAController::CancelRequest(CBtsacActive& /*aActive*/) |
|
680 { |
|
681 TRACE_FUNC |
|
682 } |
|
683 |
|
684 // End of File |