bluetoothengine/bteng/src/btengsrvbbconnectionmgr.cpp
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
--- a/bluetoothengine/bteng/src/btengsrvbbconnectionmgr.cpp	Tue Aug 31 15:25:10 2010 +0300
+++ b/bluetoothengine/bteng/src/btengsrvbbconnectionmgr.cpp	Wed Sep 01 12:20:04 2010 +0100
@@ -92,13 +92,15 @@
 //
 CBTEngSrvBBConnMgr::~CBTEngSrvBBConnMgr()
     {
-	delete iLinkCountWatcher;
-	delete iWlanWatcher;    
+    Unsubscribe();
 	iLinkCountProperty.Close();
     iWlanStatusProperty.Close();
+	delete iLinkCountWatcher;
+	delete iWlanWatcher;
 	delete iPhyLinks;
     }
 
+
 // ---------------------------------------------------------------------------
 // Start listening to the relevant properties.
 // ---------------------------------------------------------------------------
@@ -124,10 +126,19 @@
 //
 void CBTEngSrvBBConnMgr::Unsubscribe()
     {
-    iLinkCountWatcher->Cancel();
-    iWlanWatcher->Cancel();
+    if( iLinkCountWatcher->IsActive() )
+        {
+        iLinkCountProperty.Cancel();
+        iLinkCountWatcher->CancelRequest();
+        }
+	if( iWlanWatcher && iWlanWatcher->IsActive() )
+	    {
+	    iWlanStatusProperty.Cancel();
+	    iWlanWatcher->CancelRequest();
+	    }
     }
 
+
 // ---------------------------------------------------------------------------
 // ?implementation_description
 // ---------------------------------------------------------------------------
@@ -353,20 +364,22 @@
 // ?implementation_description
 // ---------------------------------------------------------------------------
 //
-void CBTEngSrvBBConnMgr::RequestCompletedL( CBTEngActive* aActive,
+void CBTEngSrvBBConnMgr::RequestCompletedL( CBTEngActive* aActive, TInt aId, 
     TInt aStatus )
     {
-    TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aActive->RequestId(), aStatus ) )
-    ASSERT( aActive->RequestId() == KBTEngSrvBBConnId || aActive->RequestId() == KBTEngSrvWlanStatusId );
+    TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aId, aStatus ) )
+    ASSERT( aId == KBTEngSrvBBConnId || aId == KBTEngSrvWlanStatusId );
+    (void) aActive;
+    (void) aId;
     if( aStatus != KErrPermissionDenied )
         {
-        // Ignore any other errors.
-        // First subscribe again, so that we don't miss any updates.
-        Subscribe();
+            // Ignore any other errors.
+            // First subscribe again, so that we don't miss any updates.
+            Subscribe();
         }
     (void) ManageTopology( EFalse );    // Ignore result; nothing to do 
                                         // about it here.
-    if( aActive->RequestId() == KBTEngSrvBBConnId )
+    if( aId == KBTEngSrvBBConnId )
         {
         TRACE_INFO( ( _L( "[BTENG] PHY count key changed, update UI connection status" ) ) )
         iServer->SettingsManager()->SetUiIndicatorsL();
@@ -374,24 +387,6 @@
     TRACE_FUNC_EXIT
     }
 
-// ---------------------------------------------------------------------------
-// From class MBTEngActiveObserver.
-// Handles cancelation of an outstanding request
-// ---------------------------------------------------------------------------
-//
-void CBTEngSrvBBConnMgr::CancelRequest( TInt aRequestId )
-    {
-    TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) );
-    if ( aRequestId == KBTEngSrvBBConnId )
-        {
-        iLinkCountProperty.Cancel();
-        }
-    else if ( aRequestId == KBTEngSrvWlanStatusId )
-        {
-        iWlanStatusProperty.Cancel();
-        }
-    TRACE_FUNC_EXIT
-    }
 
 // ---------------------------------------------------------------------------
 // From class MBTEngActiveObserver.
@@ -399,11 +394,12 @@
 // RunL cannot actually leave.
 // ---------------------------------------------------------------------------
 //
-void CBTEngSrvBBConnMgr::HandleError( CBTEngActive* aActive,  
+void CBTEngSrvBBConnMgr::HandleError( CBTEngActive* aActive, TInt aId, 
     TInt aError )
     {
-    TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aActive->RequestId(), aError ) )
+    TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aId, aError ) )
     (void) aActive;
+    (void) aId;
     (void) aError;
     }