24 #include <bt_subscribe.h> |
24 #include <bt_subscribe.h> |
25 |
25 |
26 #include "btengsrvkeywatcher.h" |
26 #include "btengsrvkeywatcher.h" |
27 #include "btengserver.h" |
27 #include "btengserver.h" |
28 #include "btengsrvpluginmgr.h" |
28 #include "btengsrvpluginmgr.h" |
|
29 #include "btengsrvsettingsmgr.h" |
|
30 #include "btengpairman.h" |
29 #include "btengprivatepskeys.h" |
31 #include "btengprivatepskeys.h" |
30 #include "btengprivatecrkeys.h" |
32 #include "btengprivatecrkeys.h" |
31 #include "debug.h" |
33 #include "debug.h" |
32 |
34 |
33 /** Identification for active object */ |
35 /** Identification for active object */ |
300 TRACE_INFO( ( _L( "DUT mode key changed" ) ) ) |
302 TRACE_INFO( ( _L( "DUT mode key changed" ) ) ) |
301 iDutModeKey.Subscribe( aActive->RequestStatus() ); |
303 iDutModeKey.Subscribe( aActive->RequestStatus() ); |
302 aActive->GoActive(); |
304 aActive->GoActive(); |
303 if( !aStatus && !iDutModeKey.Get( val ) ) |
305 if( !aStatus && !iDutModeKey.Get( val ) ) |
304 { |
306 { |
305 iServer->SetDutMode( val ); |
307 iServer->SettingsManager()->SetDutMode( val ); |
306 } |
308 } |
307 } |
309 } |
308 break; |
310 break; |
309 case KBTEngLockWatcher: |
311 case KBTEngLockWatcher: |
310 { |
312 { |
314 aActive->GoActive(); |
316 aActive->GoActive(); |
315 TInt remoteLockVal = 0; |
317 TInt remoteLockVal = 0; |
316 remoteLockVal = ERemoteLocked; |
318 remoteLockVal = ERemoteLocked; |
317 if( !aStatus && !iPhoneLockKey.Get( val ) && val == remoteLockVal ) |
319 if( !aStatus && !iPhoneLockKey.Get( val ) && val == remoteLockVal ) |
318 { |
320 { |
319 iServer->SetPowerStateL( EBTPowerOff, EFalse ); |
321 iServer->SetPowerStateL( EBTOff, EFalse ); |
320 } |
322 } |
321 #endif //RD_REMOTELOCK |
323 #endif //RD_REMOTELOCK |
322 } |
324 } |
323 break; |
325 break; |
324 case KBTEngSysWatcher: |
326 case KBTEngSysWatcher: |
327 iSystemStateKey.Subscribe( aActive->RequestStatus() ); |
329 iSystemStateKey.Subscribe( aActive->RequestStatus() ); |
328 aActive->GoActive(); |
330 aActive->GoActive(); |
329 if( !aStatus && !iSystemStateKey.Get( val ) && |
331 if( !aStatus && !iSystemStateKey.Get( val ) && |
330 val == ESwStateShuttingDown ) |
332 val == ESwStateShuttingDown ) |
331 { |
333 { |
332 iServer->SetVisibilityModeL( EBTVisibilityModeNoScans , 0 ); |
334 iServer->SettingsManager()->SetVisibilityModeL( EBTVisibilityModeNoScans , 0 ); |
333 iServer->DisconnectAllL(); |
335 iServer->DisconnectAllL(); |
334 } |
336 } |
335 } |
337 } |
336 break; |
338 break; |
337 case KBTEngPHYCountWatcher: |
339 case KBTEngPHYCountWatcher: |
338 { |
340 { |
339 TRACE_INFO( ( _L( "PHY count key changed" ) ) ) |
341 TRACE_INFO( ( _L( "PHY count key changed" ) ) ) |
340 iPHYCountKey.Subscribe( aActive->RequestStatus() ); |
342 iPHYCountKey.Subscribe( aActive->RequestStatus() ); |
341 aActive->GoActive(); |
343 aActive->GoActive(); |
342 iServer->SetUiIndicatorsL(); |
344 iServer->SettingsManager()->SetUiIndicatorsL(); |
343 } |
345 } |
344 break; |
346 break; |
345 case KBTEngBtConnectionWatcher: |
347 case KBTEngBtConnectionWatcher: |
346 { |
348 { |
347 TRACE_INFO( ( _L( "BT connection key changed" ) ) ) |
349 TRACE_INFO( ( _L( "BT connection key changed" ) ) ) |
348 iBtConnectionKey.Subscribe( aActive->RequestStatus() ); |
350 iBtConnectionKey.Subscribe( aActive->RequestStatus() ); |
349 aActive->GoActive(); |
351 aActive->GoActive(); |
350 iServer->SetUiIndicatorsL(); |
352 iServer->SettingsManager()->SetUiIndicatorsL(); |
351 } |
353 } |
352 break; |
354 break; |
353 case KBTEngScanningWatcher: |
355 case KBTEngScanningWatcher: |
354 { |
356 { |
355 TRACE_INFO( ( _L( "BT stack scanning key changed" ) ) ) |
357 TRACE_INFO( ( _L( "BT stack scanning key changed" ) ) ) |
356 iBtScanningKey.Subscribe( aActive->RequestStatus() ); |
358 iBtScanningKey.Subscribe( aActive->RequestStatus() ); |
357 aActive->GoActive(); |
359 aActive->GoActive(); |
358 if ( !iBtScanningKey.Get( val ) ) |
360 if ( !iBtScanningKey.Get( val ) ) |
359 { |
361 { |
360 iServer->UpdateVisibilityModeL( val ); |
362 iServer->SettingsManager()->UpdateVisibilityModeL( val ); |
361 } |
363 } |
362 } |
364 } |
363 break; |
365 break; |
364 case KBTEngEmergencyWatcher: |
366 case KBTEngEmergencyWatcher: |
365 { |
367 { |
367 iEmergencyCallKey.Subscribe( aActive->RequestStatus() ); |
369 iEmergencyCallKey.Subscribe( aActive->RequestStatus() ); |
368 aActive->GoActive(); |
370 aActive->GoActive(); |
369 if( !aStatus && !iEmergencyCallKey.Get( val ) && val ) |
371 if( !aStatus && !iEmergencyCallKey.Get( val ) && val ) |
370 { |
372 { |
371 // An emergency call initiated -> Close SAP connection if it's active |
373 // An emergency call initiated -> Close SAP connection if it's active |
372 iServer->iPluginMgr->DisconnectProfile( EBTProfileSAP ); |
374 iServer->PluginManager()->DisconnectProfile( EBTProfileSAP ); |
373 } |
375 } |
374 } |
376 } |
375 break; |
377 break; |
376 case KBTEngSspDebugWatcher: |
378 case KBTEngSspDebugWatcher: |
377 { |
379 { |
378 TRACE_INFO( ( _L( "Simple pairing debug mode key changed" ) ) ) |
380 TRACE_INFO( ( _L( "Simple pairing debug mode key changed" ) ) ) |
379 iSspDebugModeKey.Subscribe( aActive->RequestStatus() ); |
381 iSspDebugModeKey.Subscribe( aActive->RequestStatus() ); |
380 aActive->GoActive(); |
382 aActive->GoActive(); |
381 if( !aStatus && !iSspDebugModeKey.Get( val ) ) |
383 if( !aStatus && !iSspDebugModeKey.Get( val ) ) |
382 { |
384 { |
383 iServer->CheckSspDebugModeL( (TBool) val ); |
385 iServer->SettingsManager()->CheckSspDebugModeL( (TBool) val ); |
384 } |
386 } |
385 break; |
387 break; |
386 } |
388 } |
387 case KBTEngRegistryWatcher: |
389 case KBTEngRegistryWatcher: |
388 { |
390 { |
394 |
396 |
395 TInt err = iBtRegistryKey.Get( myChangedTable ); |
397 TInt err = iBtRegistryKey.Get( myChangedTable ); |
396 if( !err && myChangedTable == KRegistryChangeRemoteTable ) |
398 if( !err && myChangedTable == KRegistryChangeRemoteTable ) |
397 { |
399 { |
398 TRACE_INFO( ( _L("BT Remote registry key changed") ) ) |
400 TRACE_INFO( ( _L("BT Remote registry key changed") ) ) |
399 iServer->RemoteRegistryChangeDetected(); |
401 iServer->PairManager()->RemoteRegistryChangeDetected(); |
400 } |
402 } |
401 break; |
403 break; |
402 } |
404 } |
403 case KBTEngSapWatcher: |
405 case KBTEngSapWatcher: |
404 { |
406 { |
405 TRACE_INFO( ( _L( "SAP mode key changed" ) ) ) |
407 TRACE_INFO( ( _L( "SAP mode key changed" ) ) ) |
406 iSapKeyCenRep->NotifyRequest( KBTSapEnabled, aActive->RequestStatus() ); |
408 iSapKeyCenRep->NotifyRequest( KBTSapEnabled, aActive->RequestStatus() ); |
407 aActive->GoActive(); |
409 aActive->GoActive(); |
408 iSapKeyCenRep->Get( KBTSapEnabled, val ); |
410 iSapKeyCenRep->Get( KBTSapEnabled, val ); |
409 |
411 |
410 TBTPowerStateValue powerState = EBTPowerOff; |
412 TBTPowerState powerState = EBTOff; |
411 User::LeaveIfError( iServer->GetHwPowerState( (TBTPowerStateValue&) powerState ) ); |
413 User::LeaveIfError( iServer->SettingsManager()->GetHwPowerState( powerState ) ); |
412 if( aStatus >= 0 && powerState ) |
414 if( aStatus >= 0 && powerState == EBTOn ) |
413 { |
415 { |
414 // Relevant only if BT is on |
416 // Relevant only if BT is on |
415 if( val == EBTSapEnabled ) |
417 if( val == EBTSapEnabled ) |
416 { |
418 { |
417 iServer->iPluginMgr->LoadBTSapPluginL(); |
419 iServer->PluginManager()->LoadBTSapPluginL(); |
418 } |
420 } |
419 else |
421 else |
420 { |
422 { |
421 iServer->iPluginMgr->UnloadBTSapPlugin(); |
423 iServer->PluginManager()->UnloadBTSapPlugin(); |
422 } |
424 } |
423 } |
425 } |
424 } |
426 } |
425 break; |
427 break; |
426 case KBTEngAddrWatcher: |
428 case KBTEngAddrWatcher: |