1 /* |
1 /* |
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
33 // ----------------------------------------------------------------------------- |
33 // ----------------------------------------------------------------------------- |
34 // CBtsacListening::NewL |
34 // CBtsacListening::NewL |
35 // ----------------------------------------------------------------------------- |
35 // ----------------------------------------------------------------------------- |
36 // |
36 // |
37 CBtsacListening* CBtsacListening::NewL(CBTSAController& aParent, |
37 CBtsacListening* CBtsacListening::NewL(CBTSAController& aParent, |
38 TBTSACGavdpResetReason aGavdpResetReason, TInt aDisconnectReason) |
38 TBTSACResetGavdp aResetGavdp, |
39 { |
39 TInt aDisconnectReason) |
40 CBtsacListening* self = new( ELeave ) CBtsacListening(aParent, aGavdpResetReason, aDisconnectReason); |
40 { |
|
41 CBtsacListening* self = new( ELeave ) CBtsacListening(aParent, aResetGavdp, aDisconnectReason); |
41 CleanupStack::PushL(self); |
42 CleanupStack::PushL(self); |
42 self->ConstructL(); |
43 self->ConstructL(); |
43 CleanupStack::Pop(self); |
44 CleanupStack::Pop(self); |
44 return self; |
45 return self; |
45 } |
46 } |
47 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
48 // CBtsacListening::CBtsacListening |
49 // CBtsacListening::CBtsacListening |
49 // ----------------------------------------------------------------------------- |
50 // ----------------------------------------------------------------------------- |
50 // |
51 // |
51 CBtsacListening::CBtsacListening(CBTSAController& aParent, |
52 CBtsacListening::CBtsacListening(CBTSAController& aParent, |
52 TBTSACGavdpResetReason aGavdpResetReason, TInt aDisconnectReason) |
53 TBTSACResetGavdp aResetGavdp, TInt aDisconnectReason) |
53 : CBtsacState(aParent, EStateListening), iGavdpResetReason(aGavdpResetReason), |
54 : CBtsacState(aParent, EStateListening), iResetGavdp(aResetGavdp), |
54 iDisconnectReason(aDisconnectReason), iPendingRequests(KRequestNone), |
55 iDisconnectReason(aDisconnectReason), iPendingRequests(KRequestNone), |
55 iInitializationProcedure(EInitProcedureOngoing), iUnfinishedGavdpError(EFalse) |
56 iInitializationProcedure(EInitProcedureOngoing) |
56 { |
57 { |
57 } |
58 } |
58 |
59 |
59 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
60 // CBtsacListening::ConstructL |
61 // CBtsacListening::ConstructL |
260 switch(aActive.RequestId()) |
261 switch(aActive.RequestId()) |
261 { |
262 { |
262 case KRequestIdSelfComplete: |
263 case KRequestIdSelfComplete: |
263 { |
264 { |
264 TBTDevAddr remoteAddr = Parent().GetRemoteAddr(); |
265 TBTDevAddr remoteAddr = Parent().GetRemoteAddr(); |
265 if(iUnfinishedGavdpError) |
266 #ifdef PRJ_ENABLE_TRACE |
266 { |
267 TBuf<12> buf; |
267 // We have unfinished gavdp error, force gavdp reset |
268 remoteAddr.GetReadable(buf); |
268 iGavdpResetReason = EGavdpResetReasonGeneral; |
269 TRACE_INFO((_L("\tremoteAddr = %S"), &buf)) |
269 } |
270 #endif |
270 if(iGavdpResetReason != EGavdpResetReasonNone) |
271 TRACE_INFO((_L("\tiResetGavdp = %d"), iResetGavdp)) |
|
272 if(iResetGavdp == EResetGavdp) |
271 { |
273 { |
272 ResetGavdp(); |
274 ResetGavdp(); |
273 } |
275 } |
274 else |
276 else |
275 { |
277 { |
276 GoListen(); |
278 GoListen(); |
277 } |
279 } |
278 if((iDisconnectReason == KErrDisconnected || iDisconnectReason == KErrHCILinkDisconnection) && |
280 TRACE_INFO((_L("\tiPendingRequests = %d"), iPendingRequests)) |
279 iPendingRequests == KRequestNone) |
281 if(iPendingRequests == KRequestNone) |
280 { |
282 { |
281 if(remoteAddr != TBTDevAddr()) |
283 if(remoteAddr != TBTDevAddr()) |
282 { |
284 { |
|
285 TRACE_INFO((_L("\tcalling DisconnectedFromRemote with iDisconnectReason = %d"), iDisconnectReason)) |
283 Parent().DisconnectedFromRemote(remoteAddr, iDisconnectReason); |
286 Parent().DisconnectedFromRemote(remoteAddr, iDisconnectReason); |
284 } |
287 } |
285 Parent().SetResetAudioInput(ETrue); |
288 Parent().SetResetAudioInput(ETrue); |
286 } |
289 } |
287 if(Parent().GetResetAudioInput()) |
290 if(Parent().GetResetAudioInput()) |
395 { |
398 { |
396 TRACE_FUNC |
399 TRACE_FUNC |
397 if(iInitializationProcedure != EInitProcedureDone) |
400 if(iInitializationProcedure != EInitProcedureDone) |
398 { |
401 { |
399 TRACE_INFO((_L("CBtsacListening::HandleGavdpErrorL() error ignored, initialization procedure ongoing."))) |
402 TRACE_INFO((_L("CBtsacListening::HandleGavdpErrorL() error ignored, initialization procedure ongoing."))) |
400 iUnfinishedGavdpError = ETrue; |
403 iResetGavdp = EResetGavdp; |
401 return; |
404 return; |
402 } |
405 } |
403 switch(aError) |
406 switch(aError) |
404 { |
407 { |
405 case KErrHCILinkDisconnection: // -6305 |
408 case KErrHCILinkDisconnection: // -6305 |