bluetoothengine/bteng/src/btengsrvbbconnectionmgr.cpp
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
    90 // Destructor
    90 // Destructor
    91 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
    92 //
    92 //
    93 CBTEngSrvBBConnMgr::~CBTEngSrvBBConnMgr()
    93 CBTEngSrvBBConnMgr::~CBTEngSrvBBConnMgr()
    94     {
    94     {
    95 	delete iLinkCountWatcher;
    95     Unsubscribe();
    96 	delete iWlanWatcher;    
       
    97 	iLinkCountProperty.Close();
    96 	iLinkCountProperty.Close();
    98     iWlanStatusProperty.Close();
    97     iWlanStatusProperty.Close();
       
    98 	delete iLinkCountWatcher;
       
    99 	delete iWlanWatcher;
    99 	delete iPhyLinks;
   100 	delete iPhyLinks;
   100     }
   101     }
       
   102 
   101 
   103 
   102 // ---------------------------------------------------------------------------
   104 // ---------------------------------------------------------------------------
   103 // Start listening to the relevant properties.
   105 // Start listening to the relevant properties.
   104 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
   105 //
   107 //
   122 // Stop listening to the subscribed properties.
   124 // Stop listening to the subscribed properties.
   123 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   124 //
   126 //
   125 void CBTEngSrvBBConnMgr::Unsubscribe()
   127 void CBTEngSrvBBConnMgr::Unsubscribe()
   126     {
   128     {
   127     iLinkCountWatcher->Cancel();
   129     if( iLinkCountWatcher->IsActive() )
   128     iWlanWatcher->Cancel();
   130         {
   129     }
   131         iLinkCountProperty.Cancel();
       
   132         iLinkCountWatcher->CancelRequest();
       
   133         }
       
   134 	if( iWlanWatcher && iWlanWatcher->IsActive() )
       
   135 	    {
       
   136 	    iWlanStatusProperty.Cancel();
       
   137 	    iWlanWatcher->CancelRequest();
       
   138 	    }
       
   139     }
       
   140 
   130 
   141 
   131 // ---------------------------------------------------------------------------
   142 // ---------------------------------------------------------------------------
   132 // ?implementation_description
   143 // ?implementation_description
   133 // ---------------------------------------------------------------------------
   144 // ---------------------------------------------------------------------------
   134 //
   145 //
   351 // ---------------------------------------------------------------------------
   362 // ---------------------------------------------------------------------------
   352 // From class MBTEngActiveObserver.
   363 // From class MBTEngActiveObserver.
   353 // ?implementation_description
   364 // ?implementation_description
   354 // ---------------------------------------------------------------------------
   365 // ---------------------------------------------------------------------------
   355 //
   366 //
   356 void CBTEngSrvBBConnMgr::RequestCompletedL( CBTEngActive* aActive,
   367 void CBTEngSrvBBConnMgr::RequestCompletedL( CBTEngActive* aActive, TInt aId, 
   357     TInt aStatus )
   368     TInt aStatus )
   358     {
   369     {
   359     TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aActive->RequestId(), aStatus ) )
   370     TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aId, aStatus ) )
   360     ASSERT( aActive->RequestId() == KBTEngSrvBBConnId || aActive->RequestId() == KBTEngSrvWlanStatusId );
   371     ASSERT( aId == KBTEngSrvBBConnId || aId == KBTEngSrvWlanStatusId );
       
   372     (void) aActive;
       
   373     (void) aId;
   361     if( aStatus != KErrPermissionDenied )
   374     if( aStatus != KErrPermissionDenied )
   362         {
   375         {
   363         // Ignore any other errors.
   376             // Ignore any other errors.
   364         // First subscribe again, so that we don't miss any updates.
   377             // First subscribe again, so that we don't miss any updates.
   365         Subscribe();
   378             Subscribe();
   366         }
   379         }
   367     (void) ManageTopology( EFalse );    // Ignore result; nothing to do 
   380     (void) ManageTopology( EFalse );    // Ignore result; nothing to do 
   368                                         // about it here.
   381                                         // about it here.
   369     if( aActive->RequestId() == KBTEngSrvBBConnId )
   382     if( aId == KBTEngSrvBBConnId )
   370         {
   383         {
   371         TRACE_INFO( ( _L( "[BTENG] PHY count key changed, update UI connection status" ) ) )
   384         TRACE_INFO( ( _L( "[BTENG] PHY count key changed, update UI connection status" ) ) )
   372         iServer->SettingsManager()->SetUiIndicatorsL();
   385         iServer->SettingsManager()->SetUiIndicatorsL();
   373         }    
   386         }    
   374     TRACE_FUNC_EXIT
   387     TRACE_FUNC_EXIT
   375     }
   388     }
   376 
   389 
   377 // ---------------------------------------------------------------------------
       
   378 // From class MBTEngActiveObserver.
       
   379 // Handles cancelation of an outstanding request
       
   380 // ---------------------------------------------------------------------------
       
   381 //
       
   382 void CBTEngSrvBBConnMgr::CancelRequest( TInt aRequestId )
       
   383     {
       
   384     TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) );
       
   385     if ( aRequestId == KBTEngSrvBBConnId )
       
   386         {
       
   387         iLinkCountProperty.Cancel();
       
   388         }
       
   389     else if ( aRequestId == KBTEngSrvWlanStatusId )
       
   390         {
       
   391         iWlanStatusProperty.Cancel();
       
   392         }
       
   393     TRACE_FUNC_EXIT
       
   394     }
       
   395 
   390 
   396 // ---------------------------------------------------------------------------
   391 // ---------------------------------------------------------------------------
   397 // From class MBTEngActiveObserver.
   392 // From class MBTEngActiveObserver.
   398 // Handles an error in RunL( i.e. RequestCompletedL). Does nothing, since our
   393 // Handles an error in RunL( i.e. RequestCompletedL). Does nothing, since our
   399 // RunL cannot actually leave.
   394 // RunL cannot actually leave.
   400 // ---------------------------------------------------------------------------
   395 // ---------------------------------------------------------------------------
   401 //
   396 //
   402 void CBTEngSrvBBConnMgr::HandleError( CBTEngActive* aActive,  
   397 void CBTEngSrvBBConnMgr::HandleError( CBTEngActive* aActive, TInt aId, 
   403     TInt aError )
   398     TInt aError )
   404     {
   399     {
   405     TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aActive->RequestId(), aError ) )
   400     TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aId, aError ) )
   406     (void) aActive;
   401     (void) aActive;
       
   402     (void) aId;
   407     (void) aError;
   403     (void) aError;
   408     }
   404     }
   409 
   405 
   410 
   406 
   411 // ---------------------------------------------------------------------------
   407 // ---------------------------------------------------------------------------