177 |
177 |
178 // ----------------------------------------------------------------------------- |
178 // ----------------------------------------------------------------------------- |
179 // CBtsacConnected::CancelActionL |
179 // CBtsacConnected::CancelActionL |
180 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
181 // |
181 // |
182 void CBtsacConnected::CancelActionL(TInt aError, TBTSACGavdpResetReason aGavdpReset) |
182 void CBtsacConnected::CancelActionL(TInt aError) |
183 { |
183 { |
184 TRACE_FUNC |
184 TRACE_FUNC |
185 StopTimer(); |
185 StopTimer(); |
186 Parent().CompletePendingRequests((KConnectReq | KOpenAudioReq), aError); |
186 Parent().CompletePendingRequests((KConnectReq | KOpenAudioReq), aError); |
187 Parent().ChangeStateL(CBtsacListening::NewL(Parent(), aGavdpReset, aError)); |
187 Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError)); |
188 } |
188 } |
189 |
189 |
190 // ----------------------------------------------------------------------------- |
190 // ----------------------------------------------------------------------------- |
191 // CBtsacConnected::OpenAudioLinkL |
191 // CBtsacConnected::OpenAudioLinkL |
192 // ----------------------------------------------------------------------------- |
192 // ----------------------------------------------------------------------------- |
196 TRACE_FUNC |
196 TRACE_FUNC |
197 |
197 |
198 if (Parent().GetRemoteAddr() != aAddr) |
198 if (Parent().GetRemoteAddr() != aAddr) |
199 { |
199 { |
200 TRACE_INFO((_L("CBtsacConnected::OpenAudio, Error!"))) |
200 TRACE_INFO((_L("CBtsacConnected::OpenAudio, Error!"))) |
201 CancelActionL(KErrNotFound, EGavdpResetReasonGeneral); |
201 CancelActionL(KErrNotFound); |
202 return; |
202 return; |
203 } |
203 } |
204 iAudioOpenedBy = EAudioOpenedByAFW; |
204 iAudioOpenedBy = EAudioOpenedByAFW; |
205 Parent().SetRemoteAddr(aAddr); |
205 Parent().SetRemoteAddr(aAddr); |
206 |
206 |
222 // ----------------------------------------------------------------------------- |
222 // ----------------------------------------------------------------------------- |
223 // |
223 // |
224 void CBtsacConnected::CancelOpenAudioLinkL() |
224 void CBtsacConnected::CancelOpenAudioLinkL() |
225 { |
225 { |
226 TRACE_FUNC |
226 TRACE_FUNC |
227 CancelActionL(KErrCancel, EGavdpResetReasonGeneral); |
227 CancelActionL(KErrCancel); |
228 } |
228 } |
229 |
229 |
230 // ----------------------------------------------------------------------------- |
230 // ----------------------------------------------------------------------------- |
231 // CBtsacConnected::DisconnectL |
231 // CBtsacConnected::DisconnectL |
232 // ----------------------------------------------------------------------------- |
232 // ----------------------------------------------------------------------------- |
233 // |
233 // |
234 void CBtsacConnected::DisconnectL() |
234 void CBtsacConnected::DisconnectL() |
235 { |
235 { |
236 TRACE_FUNC |
236 TRACE_FUNC |
237 Parent().CompletePendingRequests(KDisconnectReq, KErrNone); |
237 Parent().CompletePendingRequests(KDisconnectReq, KErrNone); |
238 CancelActionL(KErrCancel, EGavdpResetReasonDisconnect); |
238 CancelActionL(KErrCancel); |
239 } |
239 } |
240 |
240 |
241 // ----------------------------------------------------------------------------- |
241 // ----------------------------------------------------------------------------- |
242 // CBtsacConnected::CancelConnectL |
242 // CBtsacConnected::CancelConnectL |
243 // ----------------------------------------------------------------------------- |
243 // ----------------------------------------------------------------------------- |
287 |
287 |
288 RPointerArray<TAvdtpServiceCapability> SEPCapabilities; |
288 RPointerArray<TAvdtpServiceCapability> SEPCapabilities; |
289 if ((Parent().iRemoteSEPs->GetCaps(Parent().GetSEPIndex(), SEPCapabilities)) ) |
289 if ((Parent().iRemoteSEPs->GetCaps(Parent().GetSEPIndex(), SEPCapabilities)) ) |
290 { |
290 { |
291 TRACE_INFO((_L("CBtsacConnected::Configure() Couldn't retrieve Capabilities !"))) |
291 TRACE_INFO((_L("CBtsacConnected::Configure() Couldn't retrieve Capabilities !"))) |
292 CancelActionL(KErrCancel, EGavdpResetReasonGeneral); |
292 CancelActionL(KErrCancel); |
293 SEPCapabilities.Close(); |
293 SEPCapabilities.Close(); |
294 return; |
294 return; |
295 } |
295 } |
296 |
296 |
297 TRACE_INFO((_L("CBtsacConnected::Configure() Retrieve %d capabilities"), SEPCapabilities.Count())) |
297 TRACE_INFO((_L("CBtsacConnected::Configure() Retrieve %d capabilities"), SEPCapabilities.Count())) |
325 TRACE_INFO((_L("CBtsacConnected::Configure() Accessory Min bitpool: %d"), SBCCaps.MinBitpoolValue())) |
325 TRACE_INFO((_L("CBtsacConnected::Configure() Accessory Min bitpool: %d"), SBCCaps.MinBitpoolValue())) |
326 |
326 |
327 if (Parent().iStreamer->ConfigureSEP(SBCCaps) ) |
327 if (Parent().iStreamer->ConfigureSEP(SBCCaps) ) |
328 { |
328 { |
329 TRACE_INFO((_L("CBtsacConnected::Configure() Streamer couldn't configure SEP !"))) |
329 TRACE_INFO((_L("CBtsacConnected::Configure() Streamer couldn't configure SEP !"))) |
330 CancelActionL(KErrCancel, EGavdpResetReasonGeneral); |
330 CancelActionL(KErrCancel); |
331 return; // capabilites doesn't suit us |
331 return; // capabilites doesn't suit us |
332 } |
332 } |
333 |
333 |
334 TAvdtpSEPInfo SEPInfo; |
334 TAvdtpSEPInfo SEPInfo; |
335 if (Parent().iRemoteSEPs->GetInfo(Parent().GetSEPIndex(), SEPInfo)) |
335 if (Parent().iRemoteSEPs->GetInfo(Parent().GetSEPIndex(), SEPInfo)) |
336 { |
336 { |
337 TRACE_INFO((_L("CBtsacConnected::Configure() Couldn't retrieve SEP Info !"))) |
337 TRACE_INFO((_L("CBtsacConnected::Configure() Couldn't retrieve SEP Info !"))) |
338 CancelActionL(KErrCancel, EGavdpResetReasonGeneral); |
338 CancelActionL(KErrCancel); |
339 return; // capabilites doesn't suit us |
339 return; // capabilites doesn't suit us |
340 } |
340 } |
341 TSEID remoteSEPid = SEPInfo.SEID(); |
341 TSEID remoteSEPid = SEPInfo.SEID(); |
342 // local sep index is hard coded cause current implementation is only sbc encoded |
342 // local sep index is hard coded cause current implementation is only sbc encoded |
343 TSEID localSEPid = TSEID(1, ETrue); |
343 TSEID localSEPid = TSEID(1, ETrue); |
344 |
344 |
345 StartTimer(KSEPConfigureResponseDelay, KRequestIdTimer); |
345 StartTimer(KSEPConfigureResponseDelay, KRequestIdTimer); |
346 if ( Parent().iGavdp->ConfigureSEP(localSEPid, remoteSEPid , SBCCaps, MedTransCaps ) ) |
346 if ( Parent().iGavdp->ConfigureSEP(localSEPid, remoteSEPid , SBCCaps, MedTransCaps ) ) |
347 { |
347 { |
348 TRACE_INFO((_L("CBtsacConnected::Configure() ConfigureSEP returned Error !!!"))) |
348 TRACE_INFO((_L("CBtsacConnected::Configure() ConfigureSEP returned Error !!!"))) |
349 CancelActionL(KErrCancel, EGavdpResetReasonGeneral); |
349 CancelActionL(KErrCancel); |
350 } |
350 } |
351 } |
351 } |
352 |
352 |
353 // ----------------------------------------------------------------------------- |
353 // ----------------------------------------------------------------------------- |
354 // CBtsacConnected::GetCapabilitiesOfAllSEPs |
354 // CBtsacConnected::GetCapabilitiesOfAllSEPs |
391 // GAVDP_ConfigurationStartIndication. |
389 // GAVDP_ConfigurationStartIndication. |
392 StartTimer(KWaitConfStartIndicationDelay, KRequestIdTimer); |
390 StartTimer(KWaitConfStartIndicationDelay, KRequestIdTimer); |
393 } |
391 } |
394 else // no audio sbc sink sep found |
392 else // no audio sbc sink sep found |
395 { |
393 { |
396 TRAP_IGNORE(CancelActionL(KErrCancel, EGavdpResetReasonGeneral)); |
394 TRAP_IGNORE(CancelActionL(KErrCancel)); |
397 } |
395 } |
398 } |
396 } |
399 } |
397 } |
400 |
398 |
401 // ----------------------------------------------------------------------------- |
399 // ----------------------------------------------------------------------------- |
415 { |
413 { |
416 Parent().iRemoteSEPs->SetState(aSEPInfo.SEID(), CBTSACStreamEndPoint::EDiscoveredRemote, &aSEPInfo); |
414 Parent().iRemoteSEPs->SetState(aSEPInfo.SEID(), CBTSACStreamEndPoint::EDiscoveredRemote, &aSEPInfo); |
417 } |
415 } |
418 else // internal problem |
416 else // internal problem |
419 { |
417 { |
420 TRAP_IGNORE(CancelActionL(KErrCancel, EGavdpResetReasonGeneral)); |
418 TRAP_IGNORE(CancelActionL(KErrCancel)); |
421 } |
419 } |
422 } |
420 } |
423 } |
421 } |
424 |
422 |
425 // ----------------------------------------------------------------------------- |
423 // ----------------------------------------------------------------------------- |
436 GetCapabilitiesOfAllSEPs(); |
434 GetCapabilitiesOfAllSEPs(); |
437 } |
435 } |
438 else // remote A2DP has no 'audio' 'sink' SEPs ! naughty remote |
436 else // remote A2DP has no 'audio' 'sink' SEPs ! naughty remote |
439 { |
437 { |
440 TRACE_INFO((_L("CBtsacConnected::GAVDP_SEPDiscoveryComplete() Remote A2dP has no 'audio' 'sink' SEPs !"))) |
438 TRACE_INFO((_L("CBtsacConnected::GAVDP_SEPDiscoveryComplete() Remote A2dP has no 'audio' 'sink' SEPs !"))) |
441 TRAP_IGNORE(CancelActionL(KErrCancel, EGavdpResetReasonGeneral)); |
439 TRAP_IGNORE(CancelActionL(KErrCancel)); |
442 } |
440 } |
443 } |
441 } |
444 |
442 |
445 // ----------------------------------------------------------------------------- |
443 // ----------------------------------------------------------------------------- |
446 // CBtsacConnected::GAVDP_SEPCapability |
444 // CBtsacConnected::GAVDP_SEPCapability |
509 StopTimer(); |
507 StopTimer(); |
510 TAvdtpSEPInfo SEPInfo; |
508 TAvdtpSEPInfo SEPInfo; |
511 if (Parent().iRemoteSEPs->GetInfo(Parent().GetSEPIndex(), SEPInfo)) |
509 if (Parent().iRemoteSEPs->GetInfo(Parent().GetSEPIndex(), SEPInfo)) |
512 { |
510 { |
513 TRACE_INFO((_L("CBtsacConnected::GAVDP_ConfigurationConfirm Couldn't retrieve SEP Info !"))) |
511 TRACE_INFO((_L("CBtsacConnected::GAVDP_ConfigurationConfirm Couldn't retrieve SEP Info !"))) |
514 TRAP_IGNORE(CancelActionL(KErrCancel, EGavdpResetReasonGeneral)); |
512 TRAP_IGNORE(CancelActionL(KErrCancel)); |
515 return; // cannot get remote SEP capabilites |
513 return; // cannot get remote SEP capabilites |
516 } |
514 } |
517 TSEID remoteSEPid = SEPInfo.SEID(); |
515 TSEID remoteSEPid = SEPInfo.SEID(); |
518 TRACE_INFO((_L("CBtsacConnected::GAVDP_ConfigurationConfirm() Asking for bearer for remote SEID(%d)"), remoteSEPid.SEID())) |
516 TRACE_INFO((_L("CBtsacConnected::GAVDP_ConfigurationConfirm() Asking for bearer for remote SEID(%d)"), remoteSEPid.SEID())) |
519 iBearersQuery = ETrue; |
517 iBearersQuery = ETrue; |
564 // |
562 // |
565 void CBtsacConnected::GAVDP_AbortIndication(TSEID aSEID) |
563 void CBtsacConnected::GAVDP_AbortIndication(TSEID aSEID) |
566 { |
564 { |
567 TRACE_INFO((_L("CBtsacConnected::GAVDP_AbortIndication() SEID:%d"), aSEID.SEID())) |
565 TRACE_INFO((_L("CBtsacConnected::GAVDP_AbortIndication() SEID:%d"), aSEID.SEID())) |
568 (void)aSEID; |
566 (void)aSEID; |
569 TRAP_IGNORE(CancelActionL(KErrDisconnected, EGavdpResetReasonNone)); |
567 TRAP_IGNORE(CancelActionL(KErrDisconnected)); |
570 } |
568 } |
571 |
569 |
572 // ----------------------------------------------------------------------------- |
570 // ----------------------------------------------------------------------------- |
573 // CBtsacConnected::GAVDP_ConfigurationStartIndication |
571 // CBtsacConnected::GAVDP_ConfigurationStartIndication |
574 // ----------------------------------------------------------------------------- |
572 // ----------------------------------------------------------------------------- |
592 { |
590 { |
593 case KRequestIdTimer: |
591 case KRequestIdTimer: |
594 { |
592 { |
595 if(!iBearersQuery) |
593 if(!iBearersQuery) |
596 { |
594 { |
597 // Go to listening state, gavdp will be shutdown in listening state |
595 // Go to listening state, gavdp will be shutdown in listening state |
598 CancelActionL(KErrCancel, EGavdpResetReasonNone); |
596 CancelActionL(KErrDisconnected); |
599 } |
597 } |
600 else |
598 else |
601 { |
599 { |
602 // If bearers query timer has expired, lets handle it separately. |
600 // If bearers query timer has expired, lets handle it separately. |
603 Parent().iGavdp->Cancel(); |
601 Parent().iGavdp->Cancel(); |
651 { |
649 { |
652 case KErrAvdtpRequestTimeout: // -18005 |
650 case KErrAvdtpRequestTimeout: // -18005 |
653 { |
651 { |
654 TRACE_INFO((_L("CBtsacConnected::HandleGavdpErrorL() Request TIMEOUT"))) |
652 TRACE_INFO((_L("CBtsacConnected::HandleGavdpErrorL() Request TIMEOUT"))) |
655 // Go to listening state, gavdp will be shutdown in listening state |
653 // Go to listening state, gavdp will be shutdown in listening state |
656 CancelActionL(KErrDisconnected, EGavdpResetReasonNone); |
654 CancelActionL(KErrDisconnected); |
657 break; |
655 break; |
658 } |
656 } |
659 |
657 |
660 case KErrHCILinkDisconnection: // -6305 |
658 case KErrHCILinkDisconnection: // -6305 |
661 case KErrDisconnected: // -36 |
659 case KErrDisconnected: // -36 |
662 { |
660 { |
663 TRACE_INFO((_L("CBtsacConnected::HandleGavdpErrorL() Signalling disconnected."))) |
661 TRACE_INFO((_L("CBtsacConnected::HandleGavdpErrorL() Signalling disconnected."))) |
664 // for both outgoing or incoming connection, if we have an error, |
662 // for both outgoing or incoming connection, if we have an error, |
665 // this means there is disconnection |
663 // this means there is disconnection |
666 CancelActionL(aError, EGavdpResetReasonGeneral); |
664 CancelActionL(aError); |
667 break; |
665 break; |
668 } |
666 } |
669 |
667 |
670 case (KErrAvdtpSignallingErrorBase - EAvdtpSEPInUse): // -18064 |
668 case (KErrAvdtpSignallingErrorBase - EAvdtpSEPInUse): // -18064 |
671 { |
669 { |