bluetoothengine/bteng/btengconnman/src/btengconnman.cpp
branchRCL_3
changeset 55 613943a21004
parent 0 f63038272f30
child 56 9386f31cc85b
--- a/bluetoothengine/bteng/btengconnman/src/btengconnman.cpp	Thu Aug 19 10:05:41 2010 +0300
+++ b/bluetoothengine/bteng/btengconnman/src/btengconnman.cpp	Tue Aug 31 15:25:10 2010 +0300
@@ -23,6 +23,7 @@
 
 #include "btengconnman.h"
 #include "btengconnhandler.h"
+#include "btengpairinghandler.h"
 #include "debug.h"
 
 // ======== MEMBER FUNCTIONS ========
@@ -92,6 +93,7 @@
     {
     TRACE_FUNC_ENTRY
     delete iConnHandler;
+    delete iPairingHandler;
     }
 
 
@@ -224,10 +226,21 @@
 EXPORT_C TInt CBTEngConnMan::PairDevice( const TBTDevAddr& aAddr, TBTDeviceClass aDeviceClass )
     {
     TRACE_FUNC_ENTRY
-    return  iConnHandler->StartPairing( aAddr, aDeviceClass );
+    TInt err = KErrNone;
+    if( !iPairingHandler )
+        {
+        TRAP( err, iPairingHandler = CBTEngPairingHandler::NewL( iObserver, this ) );
+        }
+    if( !err )
+        {
+        iPairingHandler->CancelPairing();
+
+        TRAP( err, iPairingHandler->StartPairingL( aAddr, aDeviceClass ) );
+        }
+    TRACE_FUNC_RES( ( _L( "result: %d" ), err ) )
+    return err;
     }
 
-
 // ---------------------------------------------------------------------------
 // Cancels an ongoing pairing.
 // ---------------------------------------------------------------------------
@@ -235,21 +248,25 @@
 EXPORT_C void CBTEngConnMan::CancelPairDevice()
     {
     TRACE_FUNC_ENTRY
-    if( iConnHandler )
+    if( iPairingHandler )
         {
-        iConnHandler->CancelPairing();
+        iPairingHandler->CancelPairing();
+        delete iPairingHandler;
+        iPairingHandler = NULL;
         }
     }
 
 
 // ---------------------------------------------------------------------------
 // Tell BTEng to start observing the status of an ongoing pairing.
+// Deprecated since Symbian^4.
 // ---------------------------------------------------------------------------
 //
 EXPORT_C TInt CBTEngConnMan::StartPairingObserver( const TBTDevAddr& aAddr )
     {
     TRACE_FUNC_ENTRY
-    return CBTEngConnHandler::SetPairingObserver( aAddr, ETrue );
+    (void) aAddr;
+    return KErrNone;
     }
 
 
@@ -264,13 +281,14 @@
     }
 
 // ---------------------------------------------------------------------------
-// ?implementation_description
+// Deprecated since Symbian^4.
 // ---------------------------------------------------------------------------
 //
 EXPORT_C TInt CBTEngConnMan::StopPairingObserver( const TBTDevAddr& aAddr )
     {
     TRACE_FUNC_ENTRY
-    return CBTEngConnHandler::SetPairingObserver( aAddr, EFalse );
+    (void) aAddr;
+    return KErrNone;
     }
 
 // ---------------------------------------------------------------------------