1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
370 { |
370 { |
371 LOG_FUNC |
371 LOG_FUNC |
372 switch(aStatus) |
372 switch(aStatus) |
373 { |
373 { |
374 case EBTOn: |
374 case EBTOn: |
|
375 { |
375 // Start-up Bluetooth |
376 // Start-up Bluetooth |
376 // Avoid from ON to ON |
377 // Avoid from ON to ON |
377 __ASSERT_DEBUG (iLastPowerState == EBTOff, Panic(EHCIPowerStateError)); |
378 __ASSERT_DEBUG (iLastPowerState == EBTOff, Panic(EHCIPowerStateError)); |
378 |
379 |
379 iLastPowerState = aStatus; |
380 iLastPowerState = aStatus; |
380 //recovery the channels |
381 //recovery the channels |
381 iLinkMgrProtocol.LinkMuxer().ChannelsFree(iHCTLState); |
382 iLinkMgrProtocol.LinkMuxer().ChannelsFree(iHCTLState); |
382 |
383 |
383 TRAPD(err, InitL(iLinkMgrProtocol.LocalDevice())); |
384 TBTLocalDevice settings(iLinkMgrProtocol.LocalDevice()); |
|
385 iLinkMgrProtocol.DesiredLocalDeviceSettings().Modify(settings); |
|
386 |
|
387 TRAPD(err, InitL(settings)); |
384 // Hopefully this should just work it won't rename the device though |
388 // Hopefully this should just work it won't rename the device though |
385 // since that is persisted |
389 // since that is persisted |
386 if (err) |
390 if (err) |
387 { |
391 { |
388 HandlePowerStatusChange(EBTOff); |
392 HandlePowerStatusChange(EBTOff); |
389 return; |
393 return; |
390 } |
394 } |
391 else |
395 else |
392 { |
396 { |
|
397 iLinkMgrProtocol.DesiredLocalDeviceSettings().ResetChangesMask(); |
393 // Reset the inquiry manager |
398 // Reset the inquiry manager |
394 iLinkMgrProtocol.InquiryMgr().SetHWState(CBTInquiryMgr::EIdle); |
399 iLinkMgrProtocol.InquiryMgr().SetHWState(CBTInquiryMgr::EIdle); |
395 // Clear debug mode |
400 // Clear debug mode |
396 iLinkMgrProtocol.SecMan().ClearDebugMode(); |
401 iLinkMgrProtocol.SecMan().ClearDebugMode(); |
397 } |
402 } |
|
403 } |
398 break; |
404 break; |
399 |
405 |
400 case EBTOff: |
406 case EBTOff: |
|
407 { |
401 // Reset the Command Queue |
408 // Reset the Command Queue |
402 // Avoid from OFF to OFF |
409 // Avoid from OFF to OFF |
403 __ASSERT_DEBUG (iLastPowerState == EBTOn, Panic(EHCIPowerStateError)); |
410 __ASSERT_DEBUG (iLastPowerState == EBTOn, Panic(EHCIPowerStateError)); |
404 |
411 |
405 iLastPowerState = aStatus; |
412 iLastPowerState = aStatus; |
431 // Removes any pending AFH Channel Classification command |
438 // Removes any pending AFH Channel Classification command |
432 // and cancels timer. |
439 // and cancels timer. |
433 // NB This ensures AFH host channel classification command blocking is |
440 // NB This ensures AFH host channel classification command blocking is |
434 // not in place if power comes back on. |
441 // not in place if power comes back on. |
435 iAFHTimer->Reset(); |
442 iAFHTimer->Reset(); |
|
443 } |
436 break; |
444 break; |
437 |
445 |
438 default: |
446 default: |
|
447 { |
439 Panic(EHCIUnknownPowerState); |
448 Panic(EHCIUnknownPowerState); |
|
449 } |
440 break; |
450 break; |
441 } |
451 } |
442 |
452 |
443 // Successfully changed power state |
453 // Successfully changed power state |
444 iLinkMgrProtocol.UpdateLocalDevicePower(aStatus); |
454 iLinkMgrProtocol.UpdateLocalDevicePower(aStatus); |