bluetoothengine/bteng/btengconnman/src/btengconnman.cpp
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
    21 #include <featmgr.h>
    21 #include <featmgr.h>
    22 #include <centralrepository.h>
    22 #include <centralrepository.h>
    23 
    23 
    24 #include "btengconnman.h"
    24 #include "btengconnman.h"
    25 #include "btengconnhandler.h"
    25 #include "btengconnhandler.h"
    26 #include "btengpairinghandler.h"
       
    27 #include "debug.h"
    26 #include "debug.h"
    28 
    27 
    29 // ======== MEMBER FUNCTIONS ========
    28 // ======== MEMBER FUNCTIONS ========
    30 
    29 
    31 // ---------------------------------------------------------------------------
    30 // ---------------------------------------------------------------------------
    91 //
    90 //
    92 CBTEngConnMan::~CBTEngConnMan()
    91 CBTEngConnMan::~CBTEngConnMan()
    93     {
    92     {
    94     TRACE_FUNC_ENTRY
    93     TRACE_FUNC_ENTRY
    95     delete iConnHandler;
    94     delete iConnHandler;
    96     delete iPairingHandler;
       
    97     }
    95     }
    98 
    96 
    99 
    97 
   100 // ---------------------------------------------------------------------------
    98 // ---------------------------------------------------------------------------
   101 // ?implementation_description
    99 // ?implementation_description
   224 // ---------------------------------------------------------------------------
   222 // ---------------------------------------------------------------------------
   225 //    
   223 //    
   226 EXPORT_C TInt CBTEngConnMan::PairDevice( const TBTDevAddr& aAddr, TBTDeviceClass aDeviceClass )
   224 EXPORT_C TInt CBTEngConnMan::PairDevice( const TBTDevAddr& aAddr, TBTDeviceClass aDeviceClass )
   227     {
   225     {
   228     TRACE_FUNC_ENTRY
   226     TRACE_FUNC_ENTRY
   229     TInt err = KErrNone;
   227     return  iConnHandler->StartPairing( aAddr, aDeviceClass );
   230     if( !iPairingHandler )
   228     }
       
   229 
       
   230 
       
   231 // ---------------------------------------------------------------------------
       
   232 // Cancels an ongoing pairing.
       
   233 // ---------------------------------------------------------------------------
       
   234 //
       
   235 EXPORT_C void CBTEngConnMan::CancelPairDevice()
       
   236     {
       
   237     TRACE_FUNC_ENTRY
       
   238     if( iConnHandler )
   231         {
   239         {
   232         TRAP( err, iPairingHandler = CBTEngPairingHandler::NewL( iObserver, this ) );
   240         iConnHandler->CancelPairing();
   233         }
   241         }
   234     if( !err )
       
   235         {
       
   236         iPairingHandler->CancelPairing();
       
   237 
       
   238         TRAP( err, iPairingHandler->StartPairingL( aAddr, aDeviceClass ) );
       
   239         }
       
   240     TRACE_FUNC_RES( ( _L( "result: %d" ), err ) )
       
   241     return err;
       
   242     }
       
   243 
       
   244 // ---------------------------------------------------------------------------
       
   245 // Cancels an ongoing pairing.
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 EXPORT_C void CBTEngConnMan::CancelPairDevice()
       
   249     {
       
   250     TRACE_FUNC_ENTRY
       
   251     if( iPairingHandler )
       
   252         {
       
   253         iPairingHandler->CancelPairing();
       
   254         delete iPairingHandler;
       
   255         iPairingHandler = NULL;
       
   256         }
       
   257     }
   242     }
   258 
   243 
   259 
   244 
   260 // ---------------------------------------------------------------------------
   245 // ---------------------------------------------------------------------------
   261 // Tell BTEng to start observing the status of an ongoing pairing.
   246 // Tell BTEng to start observing the status of an ongoing pairing.
   262 // Deprecated since Symbian^4.
       
   263 // ---------------------------------------------------------------------------
   247 // ---------------------------------------------------------------------------
   264 //
   248 //
   265 EXPORT_C TInt CBTEngConnMan::StartPairingObserver( const TBTDevAddr& aAddr )
   249 EXPORT_C TInt CBTEngConnMan::StartPairingObserver( const TBTDevAddr& aAddr )
   266     {
   250     {
   267     TRACE_FUNC_ENTRY
   251     TRACE_FUNC_ENTRY
   268     (void) aAddr;
   252     return CBTEngConnHandler::SetPairingObserver( aAddr, ETrue );
   269     return KErrNone;
       
   270     }
   253     }
   271 
   254 
   272 
   255 
   273 // ---------------------------------------------------------------------------
   256 // ---------------------------------------------------------------------------
   274 // Tell BTEng to stop observing the status of an ongoing pairing.
   257 // Tell BTEng to stop observing the status of an ongoing pairing.
   279     TRACE_FUNC_ENTRY
   262     TRACE_FUNC_ENTRY
   280     (void) iConnHandler->PrepareDiscovery();
   263     (void) iConnHandler->PrepareDiscovery();
   281     }
   264     }
   282 
   265 
   283 // ---------------------------------------------------------------------------
   266 // ---------------------------------------------------------------------------
   284 // Deprecated since Symbian^4.
   267 // ?implementation_description
   285 // ---------------------------------------------------------------------------
   268 // ---------------------------------------------------------------------------
   286 //
   269 //
   287 EXPORT_C TInt CBTEngConnMan::StopPairingObserver( const TBTDevAddr& aAddr )
   270 EXPORT_C TInt CBTEngConnMan::StopPairingObserver( const TBTDevAddr& aAddr )
   288     {
   271     {
   289     TRACE_FUNC_ENTRY
   272     TRACE_FUNC_ENTRY
   290     (void) aAddr;
   273     return CBTEngConnHandler::SetPairingObserver( aAddr, EFalse );
   291     return KErrNone;
       
   292     }
   274     }
   293 
   275 
   294 // ---------------------------------------------------------------------------
   276 // ---------------------------------------------------------------------------
   295 // Check if the remote device is connectable or not.
   277 // Check if the remote device is connectable or not.
   296 // ---------------------------------------------------------------------------
   278 // ---------------------------------------------------------------------------