bluetoothengine/bteng/btengconnman/src/btengconnhandler.cpp
changeset 19 43824b19ee35
parent 0 f63038272f30
child 56 9386f31cc85b
--- a/bluetoothengine/bteng/btengconnman/src/btengconnhandler.cpp	Mon May 03 12:40:50 2010 +0300
+++ b/bluetoothengine/bteng/btengconnman/src/btengconnhandler.cpp	Fri May 14 16:01:46 2010 +0300
@@ -83,7 +83,6 @@
     {
     TRACE_FUNC_ENTRY
     CancelNotifyConnectionEvents();
-    CancelPairing();
     iBTEng.Close();
     }
 
@@ -146,128 +145,52 @@
 // ?implementation_description
 // ---------------------------------------------------------------------------
 //
-TInt CBTEngConnHandler::CancelNotifyConnectionEvents()
-    {
-    TRACE_FUNC_ENTRY
-    TInt err = KErrNone;
-    if( iConnEventActive && iConnEventActive->IsActive() )
-        {
-        err = iBTEng.CancelNotifyConnectionEvents();
-        iConnEventActive->CancelRequest();
-        }
-    delete iConnEventActive;
-    iConnEventActive = NULL;
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// Request server side to activate/deactivate a pair observer
-// -----------------------------------------------------------------------------
-//
-TInt CBTEngConnHandler::SetPairingObserver( const TBTDevAddr& aAddr, 
-    TBool aActivate )
-    {
-    RBTEng bteng;
-    TInt err = bteng.Connect();
-    if ( !err )
-        {
-        err = bteng.SetPairingObserver( aAddr, aActivate );
-        }
-    bteng.Close();
-    return err;
-    }
-
-// ---------------------------------------------------------------------------
-// Request BTEng to pair the device
-// ---------------------------------------------------------------------------
-//
-TInt CBTEngConnHandler::StartPairing( const TBTDevAddr& aAddr, 
-    const TBTDeviceClass& aDeviceClass )
+void CBTEngConnHandler::CancelNotifyConnectionEvents()
     {
     TRACE_FUNC_ENTRY
-    TInt err( KErrNone );
-    if( iPairActive && iPairActive->IsActive() )
-        {
-        err = KErrServerBusy;
-        }
-    
-    if( !iPairActive )
-        {
-            // Use a higher prioritty than normal, because we want 
-            // to be notified fast (e.g. to update the UI).
-        TRAP( err, iPairActive = CBTEngActive::NewL( *this, EPairDeviceId, 
-                                                  CActive::EPriorityUserInput ) );
-        }
-    if ( !err )
-        {
-        iPairAddr() = aAddr;
-        iPairDevCod = aDeviceClass.DeviceClass();
-        iBTEng.PairDevice( iPairAddr, iPairDevCod, iPairActive->RequestStatus() );
-        iPairActive->GoActive();
-        }
-    TRACE_FUNC_EXIT
-    return err;
+    delete iConnEventActive;
+    iConnEventActive = NULL;
     }
 
 // ---------------------------------------------------------------------------
-// Cancel any outstanding operation, free resources.
-// ---------------------------------------------------------------------------
-//
-void CBTEngConnHandler::CancelPairing()
-    {
-    TRACE_FUNC_ENTRY
-    if( iPairActive && iPairActive->IsActive() )
-        {
-        iBTEng.CancelPairDevice();
-        }
-    delete iPairActive;
-    iPairActive = NULL;
-    TRACE_FUNC_EXIT
-    }
-
-
-// ---------------------------------------------------------------------------
 // From class MBTEngActiveObserver.
 // Called by the active object when a change in connection status has occured.
 // ---------------------------------------------------------------------------
 //
-void CBTEngConnHandler::RequestCompletedL( CBTEngActive* aActive, TInt aId, 
+void CBTEngConnHandler::RequestCompletedL( CBTEngActive* aActive, 
     TInt aStatus )
     {
-    TRACE_FUNC_ARG( ( _L( "ID: %d status: %d" ), aId, aStatus ) )
-
+    TRACE_FUNC_ARG( ( _L( "ID: %d status: %d" ), aActive->RequestId(), aStatus ) )
     (void) aActive;
-    switch ( aId )
-        {
-        case EConnectionEventId:
-            {
-            HandleConnectionEvent( aStatus );
-            break;
-            }
-        case EPairDeviceId:
-            {
-            if ( iObserver )
-                {
-                iObserver->PairingComplete( iPairAddr(), aStatus );
-                }
-            }
-        }
-
+    ASSERT( aActive->RequestId() == EConnectionEventId );
+    HandleConnectionEvent( aStatus );
     TRACE_FUNC_EXIT
     }
 
+// ---------------------------------------------------------------------------
+// From class MBTEngActiveObserver.
+// Handles cancelation of an outstanding request
+// ---------------------------------------------------------------------------
+//
+void CBTEngConnHandler::CancelRequest( TInt aRequestId )
+    {
+    TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) )
+    ASSERT( aRequestId == EConnectionEventId );
+    ( void ) aRequestId;
+    iBTEng.CancelNotifyConnectionEvents();
+    TRACE_FUNC_EXIT 
+    }
 
 // ---------------------------------------------------------------------------
 // From class MBTEngActiveObserver.
 // Called when RequestCompletedL/RunL leaves.
 // ---------------------------------------------------------------------------
 //
-void CBTEngConnHandler::HandleError( CBTEngActive* aActive, TInt aId, TInt aError )
+void CBTEngConnHandler::HandleError( CBTEngActive* aActive, TInt aError )
     {
     TRACE_FUNC_ARG( ( _L( "error: %d" ), aError ) )
         // Should any info be passed to the client??
     (void) aActive;
-    (void) aId;
     (void) aError;
     }