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