bluetoothengine/bteng/btengdiscovery/src/btengdevicesearch.cpp
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
--- a/bluetoothengine/bteng/btengdiscovery/src/btengdevicesearch.cpp	Tue Aug 31 15:25:10 2010 +0300
+++ b/bluetoothengine/bteng/btengdiscovery/src/btengdevicesearch.cpp	Wed Sep 01 12:20:04 2010 +0100
@@ -72,6 +72,11 @@
 //
 CBTEngDeviceSearch::~CBTEngDeviceSearch()
     {
+    if( iNotifier.Handle()&& iActive->IsActive())
+       {
+       iNotifier.CancelNotifier( KDeviceSelectionNotifierUid );
+       iActive->CancelRequest();
+       }
     delete iActive;
     iNotifier.Close();
     iHostResolver.Close();
@@ -127,17 +132,20 @@
     TRACE_FUNC_ENTRY
     if( iActive->IsActive() && iClientReq == EDeviceSearch)
         {
-        iActive->Cancel();
         if (iActive->RequestId() == KDevSearchAoReqId)
             {
+            iNotifier.CancelNotifier( KDeviceSelectionNotifierUid );
+            iActive->CancelRequest();
             iNotifier.Close();
             NotifyClient(KErrAbort);
             }
         else if (iActive->RequestId() == KDevEirServiceListAoReqId)
             {
+            iHostResolver.Cancel();
             iHostResolver.Close();
             }
         }
+    
     TRACE_FUNC_EXIT
     }
 
@@ -174,7 +182,7 @@
     TRACE_FUNC_ENTRY
     if( iActive->IsActive() && iClientReq == EGetDeviceEir)
         {
-        iActive->Cancel();
+        iHostResolver.Cancel();
         iHostResolver.Close();
         }
     TRACE_FUNC_EXIT
@@ -185,16 +193,16 @@
 // Callback to notify that an outstanding request has completed.
 // ---------------------------------------------------------------------------
 //
-void CBTEngDeviceSearch::RequestCompletedL( CBTEngActive* aActive, 
+void CBTEngDeviceSearch::RequestCompletedL( CBTEngActive* aActive, TInt aId, 
     TInt aStatus )
     {
     TRACE_FUNC_ARG( ( _L( "status: %d") , aStatus ) )
     (void) aActive;
-    if ( aActive->RequestId() == KDevSearchAoReqId )
+    if ( aId == KDevSearchAoReqId )
         {
         HandleDeviceSelectionResultL(aStatus);
         }
-    else if ( aActive->RequestId() == KDevEirServiceListAoReqId )
+    else if (aId == KDevEirServiceListAoReqId)
         {
         HandleDeviceEirDataResult( aStatus );
         }
@@ -203,33 +211,15 @@
 
 // ---------------------------------------------------------------------------
 // From class MBTEngActiveObserver.
-// Handles cancelation of an outstanding request
-// ---------------------------------------------------------------------------
-//
-void CBTEngDeviceSearch::CancelRequest( TInt aRequestId )
-    {
-    TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) )
-    if ( aRequestId == KDevSearchAoReqId )
-        {
-        iNotifier.CancelNotifier( KDeviceSelectionNotifierUid );
-        }
-    else if ( aRequestId == KDevEirServiceListAoReqId )
-        {
-        iHostResolver.Cancel();
-        }
-    TRACE_FUNC_EXIT 
-    }
-
-// ---------------------------------------------------------------------------
-// From class MBTEngActiveObserver.
 // Callback to notify that an error has occurred in RunL.
 // ---------------------------------------------------------------------------
 //
-void CBTEngDeviceSearch::HandleError( CBTEngActive* aActive, 
+void CBTEngDeviceSearch::HandleError( CBTEngActive* aActive, TInt aId, 
     TInt aError )
     {
     TRACE_FUNC_ARG( ( _L( "error: %d") , aError ) )
     (void) aActive;
+    (void) aId;
     iNotifier.Close();
     iHostResolver.Close();
     NotifyClient(aError);