bluetoothengine/bteng/src/btengsrvkeywatcher.cpp
changeset 17 f05641c183ff
parent 15 00f9ee97d895
child 19 43824b19ee35
equal deleted inserted replaced
15:00f9ee97d895 17:f05641c183ff
    37 /**  Identification for active object */
    37 /**  Identification for active object */
    38 const TInt KBTEngLockWatcher = 16;
    38 const TInt KBTEngLockWatcher = 16;
    39 /**  Identification for active object */
    39 /**  Identification for active object */
    40 const TInt KBTEngSysWatcher = 17;
    40 const TInt KBTEngSysWatcher = 17;
    41 /**  Identification for active object */
    41 /**  Identification for active object */
    42 const TInt KBTEngPHYCountWatcher = 18;
       
    43 /**  Identification for active object */
       
    44 const TInt KBTEngBtConnectionWatcher = 19;
    42 const TInt KBTEngBtConnectionWatcher = 19;
    45 /**  Identification for active object */
    43 /**  Identification for active object */
    46 const TInt KBTEngScanningWatcher = 20;
    44 const TInt KBTEngScanningWatcher = 20;
    47 /**  Identification for active object */
    45 /**  Identification for active object */
    48 const TInt KBTEngEmergencyWatcher = 21;
    46 const TInt KBTEngEmergencyWatcher = 21;
   101         {
    99         {
   102         iSystemStateWatcher = CBTEngActive::NewL( *this, KBTEngSysWatcher, 
   100         iSystemStateWatcher = CBTEngActive::NewL( *this, KBTEngSysWatcher, 
   103                                                    CActive::EPriorityStandard );
   101                                                    CActive::EPriorityStandard );
   104         iSystemStateKey.Subscribe( iSystemStateWatcher->RequestStatus() );
   102         iSystemStateKey.Subscribe( iSystemStateWatcher->RequestStatus() );
   105         iSystemStateWatcher->GoActive();
   103         iSystemStateWatcher->GoActive();
   106         }
   104         }        
   107         
       
   108     err = iPHYCountKey.Attach( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothPHYCount );
       
   109     if( !err )
       
   110         {
       
   111         iPHYCountWatcher = CBTEngActive::NewL( *this, KBTEngPHYCountWatcher, 
       
   112                                                CActive::EPriorityStandard );
       
   113         iPHYCountKey.Subscribe( iPHYCountWatcher->RequestStatus() );
       
   114         iPHYCountWatcher->GoActive();
       
   115         }
       
   116         
   105         
   117     err = iBtConnectionKey.Attach( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothConnecting );
   106     err = iBtConnectionKey.Attach( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothConnecting );
   118     if( !err )
   107     if( !err )
   119         {
   108         {
   120         iBtConnectionWatcher = CBTEngActive::NewL( *this, KBTEngBtConnectionWatcher, 
   109         iBtConnectionWatcher = CBTEngActive::NewL( *this, KBTEngBtConnectionWatcher, 
   222     if( iSystemStateKey.Handle() )
   211     if( iSystemStateKey.Handle() )
   223         {
   212         {
   224         iSystemStateKey.Cancel();
   213         iSystemStateKey.Cancel();
   225         }
   214         }
   226     delete iSystemStateWatcher;
   215     delete iSystemStateWatcher;
   227     iSystemStateKey.Close();
   216     iSystemStateKey.Close();    
   228     
       
   229     if( iPHYCountKey.Handle() )
       
   230         {
       
   231         iPHYCountKey.Cancel();
       
   232         }
       
   233     delete iPHYCountWatcher;
       
   234     iPHYCountKey.Close();
       
   235      
   217      
   236     if( iBtConnectionKey.Handle() )
   218     if( iBtConnectionKey.Handle() )
   237         {
   219         {
   238         iBtConnectionKey.Cancel();
   220         iBtConnectionKey.Cancel();
   239         }
   221         }
   330             aActive->GoActive();
   312             aActive->GoActive();
   331             if( !aStatus && !iSystemStateKey.Get( val ) && 
   313             if( !aStatus && !iSystemStateKey.Get( val ) && 
   332                  val == ESwStateShuttingDown )
   314                  val == ESwStateShuttingDown )
   333                 {
   315                 {
   334                 iServer->SettingsManager()->SetVisibilityModeL( EBTVisibilityModeNoScans , 0 );
   316                 iServer->SettingsManager()->SetVisibilityModeL( EBTVisibilityModeNoScans , 0 );
   335                 iServer->DisconnectAllL();   
   317                 iServer->DisconnectAllForPowerOffL();   
   336                 }
   318                 }
   337             }
       
   338             break;   
       
   339         case KBTEngPHYCountWatcher:
       
   340             {
       
   341             TRACE_INFO( ( _L( "PHY count key changed" ) ) )
       
   342             iPHYCountKey.Subscribe( aActive->RequestStatus() );
       
   343             aActive->GoActive();
       
   344             iServer->SettingsManager()->SetUiIndicatorsL();
       
   345             }
   319             }
   346             break;
   320             break;
   347         case KBTEngBtConnectionWatcher:
   321         case KBTEngBtConnectionWatcher:
   348             {
   322             {
   349             TRACE_INFO( ( _L( "BT connection key changed" ) ) )
   323             TRACE_INFO( ( _L( "BT connection key changed" ) ) )