bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp
changeset 42 b72428996822
parent 31 a0ea99b6fa53
child 57 5ebadcda06cb
equal deleted inserted replaced
32:19bd632b5100 42:b72428996822
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "btnotifincomingpairinghandler.h"
    18 #include "btnotifincomingpairinghandler.h"
    19 #include "btnotifpairingmanager.h"
    19 #include "btnotifsecuritymanager.h"
    20 #include "btnotifoutgoingpairinghandler.h"
    20 #include "btnotifoutgoingpairinghandler.h"
    21 #include <btengconstants.h>
    21 #include <btengconstants.h>
       
    22 #include "bluetoothtrace.h"
    22 
    23 
    23 const TInt KBTNotifWaitingForPairingOkDelay = 500000; // 0.5s
    24 const TInt KBTNotifWaitingForPairingOkDelay = 500000; // 0.5s
    24 
    25 
    25 enum TPairingStageId
    26 enum TPairingStageId
    26     {
    27     {
    35 
    36 
    36 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
    37 // C++ default constructor
    38 // C++ default constructor
    38 // ---------------------------------------------------------------------------
    39 // ---------------------------------------------------------------------------
    39 //
    40 //
    40 CBTNotifIncomingPairingHandler::CBTNotifIncomingPairingHandler( CBTNotifPairingManager& aParent, 
    41 CBTNotifIncomingPairingHandler::CBTNotifIncomingPairingHandler( CBTNotifSecurityManager& aParent, 
    41     const TBTDevAddr& aAddr) : CBTNotifBasePairingHandler( aParent, aAddr )
    42     const TBTDevAddr& aAddr) : CBTNotifBasePairingHandler( aParent, aAddr )
    42     {
    43     {
    43     }
    44     }
    44 
    45 
    45 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    46 // 2nd phase constructor
    47 // 2nd phase constructor
    47 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    48 //
    49 //
    49 void CBTNotifIncomingPairingHandler::ConstructL()
    50 void CBTNotifIncomingPairingHandler::ConstructL()
    50     {
    51     {
       
    52     BOstraceFunctionEntry0( DUMMY_DEVLIST );
    51     BaseConstructL();
    53     BaseConstructL();
    52     iActivePairingOk = CBtSimpleActive::NewL(*this, EWaitingForPairingOk );
    54     iActivePairingOk = CBtSimpleActive::NewL(*this, EWaitingForPairingOk );
    53     User::LeaveIfError( iPairingOkTimer.CreateLocal() );
    55     User::LeaveIfError( iPairingOkTimer.CreateLocal() );
       
    56     BOstraceFunctionExit0( DUMMY_DEVLIST );
    54     }
    57     }
    55 
    58 
    56 // ---------------------------------------------------------------------------
    59 // ---------------------------------------------------------------------------
    57 // NewL
    60 // NewL
    58 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    59 //
    62 //
    60 CBTNotifBasePairingHandler* CBTNotifIncomingPairingHandler::NewL( CBTNotifPairingManager& aParent, 
    63 CBTNotifBasePairingHandler* CBTNotifIncomingPairingHandler::NewL( CBTNotifSecurityManager& aParent, 
    61     const TBTDevAddr& aAddr)
    64     const TBTDevAddr& aAddr)
    62     {
    65     {
       
    66     BOstraceFunctionEntry0( DUMMY_DEVLIST );
    63     CBTNotifIncomingPairingHandler* self = new (ELeave) CBTNotifIncomingPairingHandler(aParent, aAddr);
    67     CBTNotifIncomingPairingHandler* self = new (ELeave) CBTNotifIncomingPairingHandler(aParent, aAddr);
    64     CleanupStack::PushL( self );
    68     CleanupStack::PushL( self );
    65     self->ConstructL();
    69     self->ConstructL();
    66     CleanupStack::Pop( self );
    70     CleanupStack::Pop( self );
       
    71     BOstraceFunctionExit0( DUMMY_DEVLIST );
    67     return self;
    72     return self;
    68     }
    73     }
    69 
    74 
    70 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
    71 // Destructor
    76 // Destructor
    72 // ---------------------------------------------------------------------------
    77 // ---------------------------------------------------------------------------
    73 //
    78 //
    74 CBTNotifIncomingPairingHandler::~CBTNotifIncomingPairingHandler()
    79 CBTNotifIncomingPairingHandler::~CBTNotifIncomingPairingHandler()
    75     {
    80     {
    76     // TRACE_FUNC_ENTRY
    81     BOstraceFunctionEntry0( DUMMY_DEVLIST );
    77     // Cancel all outstanding requests
    82     // Cancel all outstanding requests
    78     CancelPlaNotification();
    83     CancelPlaNotification();
    79     iPla.Close();
    84     iPla.Close();
    80     delete iActivePairingOk;
    85     delete iActivePairingOk;
    81     iPairingOkTimer.Close();
    86     iPairingOkTimer.Close();
    82     // TRACE_FUNC_EXIT
    87     BOstraceFunctionExit0( DUMMY_DEVLIST );
    83     }
    88     }
    84 
    89 
    85 // ---------------------------------------------------------------------------
    90 // ---------------------------------------------------------------------------
    86 // Accept this message only if the specified device is the same as this is
    91 // Accept this message only if the specified device is the same as this is
    87 // dealing with.
    92 // dealing with.
    88 // ---------------------------------------------------------------------------
    93 // ---------------------------------------------------------------------------
    89 //
    94 //
    90 TInt CBTNotifIncomingPairingHandler::ObserveIncomingPair( const TBTDevAddr& aAddr )
    95 TInt CBTNotifIncomingPairingHandler::ObserveIncomingPair( const TBTDevAddr& aAddr )
    91     {
    96     {
       
    97     BOstraceFunctionEntry0( DUMMY_DEVLIST );
    92     TInt err( KErrServerBusy );
    98     TInt err( KErrServerBusy );
    93     if ( iAddr == aAddr )
    99     if ( iAddr == aAddr )
    94         {
   100         {
    95         err = KErrNone;
   101         err = KErrNone;
    96         iUserAwarePairing = ETrue; // This function is called by a notifier, which means the UI has been involved
   102         // This function is called by a notifier, which means the UI has been involved
    97         // Therefore we can display it in the paired devices list
   103         // Therefore we can display it in the paired devices list
    98         if ( !iActive->IsActive() && !OpenPhysicalLinkAdaptor() )
   104         iUserAwarePairing = ETrue; 
       
   105          if ( !iActive->IsActive() && !OpenPhysicalLinkAdaptor() )
    99             {
   106             {
   100             // If we are observing physical link, or showing user a note,
   107             // If we are observing physical link, or showing user a note,
   101             // we won't interrupt it.
   108             // we won't interrupt it.
   102             UnSetPairResult();
   109             UnSetPairResult();
   103             MonitorPhysicalLink();
   110             MonitorPhysicalLink();
   104             }
   111             }
   105         }
   112         }
       
   113     BOstraceFunctionExit0( DUMMY_DEVLIST );
   106     return err;
   114     return err;
   107     }
   115     }
   108 
   116 
   109 // ---------------------------------------------------------------------------
   117 // ---------------------------------------------------------------------------
   110 // Assign the responsibility of outgoing pair handling to CBTEngOtgPair
   118 // Assign the responsibility of outgoing pair handling to CBTEngOtgPair
   111 // ---------------------------------------------------------------------------
   119 // ---------------------------------------------------------------------------
   112 //
   120 //
   113 void CBTNotifIncomingPairingHandler::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod )
   121 void CBTNotifIncomingPairingHandler::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod )
   114     {
   122     {
   115     // TRACE_FUNC_ENTRY
   123     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   116     // Outgoing pairing always takes highest priority:
   124     // Outgoing pairing always takes highest priority:
   117     CBTNotifBasePairingHandler* pairinghandler = CBTNotifOutgoingPairingHandler::NewL( iParent, aAddr );
   125     CBTNotifBasePairingHandler* pairinghandler = CBTNotifOutgoingPairingHandler::NewL( iParent, aAddr );
   118     pairinghandler->HandleOutgoingPairL( aAddr, aCod );
   126     pairinghandler->HandleOutgoingPairL( aAddr, aCod );
   119     iParent.RenewPairingHandler( pairinghandler );
   127     iParent.RenewPairingHandler( pairinghandler );
   120     // TRACE_FUNC_EXIT
   128     BOstraceFunctionExit0( DUMMY_DEVLIST );
   121     }
   129     }
   122 
   130 
   123 // ---------------------------------------------------------------------------
   131 // ---------------------------------------------------------------------------
   124 // Accept this message only if the specified device is the same as this is
   132 // Accept this message only if the specified device is the same as this is
   125 // dealing with.
   133 // dealing with.
   126 // ---------------------------------------------------------------------------
   134 // ---------------------------------------------------------------------------
   127 //
   135 //
   128 void CBTNotifIncomingPairingHandler::StopPairHandling( const TBTDevAddr& aAddr )
   136 void CBTNotifIncomingPairingHandler::StopPairHandling( const TBTDevAddr& aAddr )
   129     {
   137     {
       
   138     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   130     if ( aAddr == iAddr )
   139     if ( aAddr == iAddr )
   131         {
   140         {
   132         // TRACE_FUNC_ENTRY
       
   133         iParent.RenewPairingHandler( NULL );
   141         iParent.RenewPairingHandler( NULL );
   134         // TRACE_FUNC_EXIT
   142         }
   135         }
   143     BOstraceFunctionExit0( DUMMY_DEVLIST );
   136     }
   144     }
   137 
   145 
   138 // ---------------------------------------------------------------------------
   146 // ---------------------------------------------------------------------------
   139 // Notify user if pairing failed.
   147 // Notify user if pairing failed.
   140 // ---------------------------------------------------------------------------
   148 // ---------------------------------------------------------------------------
   141 //
   149 //
   142 void CBTNotifIncomingPairingHandler::DoHandlePairServerResult( TInt aResult )
   150 void CBTNotifIncomingPairingHandler::DoHandlePairServerResult( TInt aResult )
   143     {
   151     {
       
   152     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   144     CancelPlaNotification();
   153     CancelPlaNotification();
   145     // For a successful pairing, we need wait for registry table change.
   154     // For a successful pairing, we need wait for registry table change.
   146     if( aResult != KErrNone && aResult != KHCIErrorBase )
   155     if( aResult != KErrNone && aResult != KHCIErrorBase )
   147         {
   156         {
   148         // Pair failure situation.
   157         // Pair failure situation.
   149         SetPairResult( aResult );
   158         SetPairResult( aResult );
   150         // todo: show pairing failure note.
   159         }
   151         }
   160     BOstraceFunctionExit0( DUMMY_DEVLIST );
   152     }
   161     }
   153 
   162 
   154 // ---------------------------------------------------------------------------
   163 // ---------------------------------------------------------------------------
   155 // Kill this if the linkkey type indicates OBEX authentication.
   164 // Kill this if the linkkey type indicates OBEX authentication.
   156 // Otherwise notify user the pair result.
   165 // Otherwise notify user the pair result.
   157 // ---------------------------------------------------------------------------
   166 // ---------------------------------------------------------------------------
   158 //
   167 //
   159 void CBTNotifIncomingPairingHandler::DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev )
   168 void CBTNotifIncomingPairingHandler::DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev )
   160     {
   169     {
   161     // TRACE_FUNC_ENTRY
   170     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   162     
   171     
   163     // First of all cancel the iPairingOkTimer timer, if active
   172     // First of all cancel the iPairingOkTimer timer, if active
   164     if (iActivePairingOk->IsActive())
   173     if (iActivePairingOk->IsActive())
   165         {
   174         {
   166         iActivePairingOk->Cancel();
   175         iActivePairingOk->Cancel();
   174 		// view. In this way, user is able to disconnect the device from our UI.
   183 		// view. In this way, user is able to disconnect the device from our UI.
   175 		// Otherwise the link key has been created by a device without IO requesting 
   184 		// Otherwise the link key has been created by a device without IO requesting 
   176 		// a service connection with phone. We won't take any action (e.g. remove 
   185 		// a service connection with phone. We won't take any action (e.g. remove 
   177 		// link key) in this case. As the result, this device can't be seen in our UI, 
   186 		// link key) in this case. As the result, this device can't be seen in our UI, 
   178 		// however other applications are still freely to use its services.
   187 		// however other applications are still freely to use its services.
   179 		// TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with no IO device" ) )
   188         BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with no IO device");
   180 		TBTEngConnectionStatus status = iParent.ConnectStatus( aDev.Address() );
   189 		TBTEngConnectionStatus status = iParent.ConnectStatus( aDev.Address() );
   181 		if ( status == EBTEngConnecting || status == EBTEngConnected )
   190 		if ( status == EBTEngConnecting || status == EBTEngConnected )
   182 			{
   191 			{
   183 			// the return error is ingore as we can not have other proper 
   192 			// the return error is ingore as we can not have other proper 
   184 			// exception handling option:
   193 			// exception handling option:
   185 			(void) iParent.AddUiCookieJustWorksPaired( aDev );
   194 			(void) iParent.AddUiCookieJustWorksPaired( aDev );
   186 			}
   195 			}
       
   196 		TRAP_IGNORE(ShowPairingResultNoteL(KErrNone));
   187 		iParent.RenewPairingHandler( NULL );
   197 		iParent.RenewPairingHandler( NULL );
   188 		}
   198 		}
   189     else if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable && !iUserAwarePairing)
   199     else if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable && !iUserAwarePairing)
   190 		{
   200 		{
   191 		// The linkkey has been created  by an incoming OBEX service request
   201 		// The linkkey has been created  by an incoming OBEX service request
   192 		// which resulted a pairing event received from pair server.
   202 		// which resulted a pairing event received from pair server.
   193 		// TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with IO device" ) )
   203         BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with IO device");
   194 		  iParent.RenewPairingHandler( NULL );
   204 		iParent.RenewPairingHandler( NULL );
   195 		}
   205 		}
   196     else
   206     else
   197 		{
   207 		{
   198 		if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable || aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable)
   208 		if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable || aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable)
   199 			{
   209 			{
   200 			// The user was involved in the pairing, so display in the paired devices list
   210 			// The user was involved in the pairing, so display in the paired devices list
   201 			(void) iParent.AddUiCookieJustWorksPaired(aDev);
   211 			(void) iParent.AddUiCookieJustWorksPaired(aDev);
   202 			}
   212 			}
   203 		// TRACE_INFO(_L("[BTEng]: CBTEngIncPair: Non-JW pairing"))
   213 		BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: Non-JW pairing");
   204 		// Other pairing model than Just Works:
   214 		// Other pairing model than Just Works:
   205 		CancelPlaNotification();
   215 		CancelPlaNotification();
   206 		SetPairResult( KErrNone );
   216 		SetPairResult( KErrNone );
       
   217 		TRAP_IGNORE(ShowPairingResultNoteL(KErrNone));
   207 		iParent.RenewPairingHandler( NULL );
   218 		iParent.RenewPairingHandler( NULL );
   208 		}
   219 		}
   209     // TRACE_FUNC_EXIT
   220     BOstraceFunctionExit0( DUMMY_DEVLIST );
   210     }
   221     }
   211 
   222 
   212 // ---------------------------------------------------------------------------
   223 // ---------------------------------------------------------------------------
   213 // From class MBTNotifPairingAOObserver.
   224 // From class MBTNotifPairingAOObserver.
   214 // ---------------------------------------------------------------------------
   225 // ---------------------------------------------------------------------------
   215 //
   226 //
   216 void CBTNotifIncomingPairingHandler::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus )
   227 void CBTNotifIncomingPairingHandler::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus )
   217     {
   228     {
   218     // TRACE_FUNC_ARG( ( _L( "aId: %d, aStatus: %d"), aId, aStatus ) )
   229     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   219         // Check which request completed.
   230     // Check which request completed.
   220     switch( aActive->RequestId() )
   231     switch( aActive->RequestId() )
   221         {
   232         {
   222         case EPhysicalLinkNotify:
   233         case EPhysicalLinkNotify:
   223             {
   234             {
   224                 // Check if the link has disconnected.
   235             // Check if the link has disconnected.
   225             HandlePhysicalLinkResultL( aStatus );
   236             HandlePhysicalLinkResultL( aStatus );
   226             break;
   237             break;
   227             }
   238             }
   228         case EWaitingForPairingOk:
   239         case EWaitingForPairingOk:
   229             {
   240             {
   237                 }
   248                 }
   238             iParent.RenewPairingHandler( NULL );
   249             iParent.RenewPairingHandler( NULL );
   239             break;
   250             break;
   240             } 
   251             } 
   241         default:
   252         default:
   242                 // Should not be possible, but no need for handling.
   253             // Should not be possible, but no need for handling.
   243             break;
   254             break;
   244         }
   255         }
   245     // TRACE_FUNC_EXIT
   256     BOstraceFunctionExit0( DUMMY_DEVLIST );
   246     }
   257     }
   247 
   258 
   248 
   259 
   249 // ---------------------------------------------------------------------------
   260 // ---------------------------------------------------------------------------
   250 // From class MBTEngActiveObserver.
   261 // From class MBTNotifPairingAOObserver.
   251 // cancels an outstanding request according to the given id.
   262 // cancels an outstanding request according to the given id.
   252 // ---------------------------------------------------------------------------
   263 // ---------------------------------------------------------------------------
   253 //
   264 //
   254 void CBTNotifIncomingPairingHandler::CancelRequest( TInt aRequestId )
   265 void CBTNotifIncomingPairingHandler::CancelRequest( TInt aRequestId )
   255     {
   266     {
       
   267     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   256     switch ( aRequestId ) 
   268     switch ( aRequestId ) 
   257         {
   269         {
   258         case EPhysicalLinkNotify:
   270         case EPhysicalLinkNotify:
   259             {
   271             {
   260             iPla.CancelNextBasebandChangeEventNotifier();
   272             iPla.CancelNextBasebandChangeEventNotifier();
       
   273             break;
   261             }
   274             }
   262         case EWaitingForPairingOk:
   275         case EWaitingForPairingOk:
   263             {
   276             {
   264             iPairingOkTimer.Cancel();
   277             iPairingOkTimer.Cancel();
       
   278             break;
   265             }
   279             }
   266         }
   280         }
       
   281     BOstraceFunctionExit0( DUMMY_DEVLIST );
   267     }
   282     }
   268 
   283 
   269 // ---------------------------------------------------------------------------
   284 // ---------------------------------------------------------------------------
   270 // From class MBTNotifPairingAOObserver.
   285 // From class MBTNotifPairingAOObserver.
   271 // Handles a leave in RequestCompleted by simply self-destructing.
   286 // Handles a leave in RequestCompleted by simply self-destructing.
   272 // ---------------------------------------------------------------------------
   287 // ---------------------------------------------------------------------------
   273 //
   288 //
   274 void CBTNotifIncomingPairingHandler::HandleError( CBtSimpleActive* aActive, TInt aError )
   289 void CBTNotifIncomingPairingHandler::HandleError( CBtSimpleActive* aActive, TInt aError )
   275     {
   290     {
   276     // TRACE_FUNC_ARG( ( _L( "request id: %d, error: %d" ), aId, aError ) )
   291     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   277     (void) aActive;
   292     (void) aActive;
   278     (void) aError;
   293     (void) aError;
   279         // Our error handling is to just stop observing. 
   294     // Our error handling is to just stop observing. 
   280         // Nothing critical to be preserved here, the user 
   295     // Nothing critical to be preserved here, the user 
   281         // just won't get any notification of pairing result.
   296     // just won't get any notification of pairing result.
   282     iParent.RenewPairingHandler( NULL );
   297     iParent.RenewPairingHandler( NULL );
       
   298     BOstraceFunctionExit0( DUMMY_DEVLIST );
   283     }
   299     }
   284 
   300 
   285 // ---------------------------------------------------------------------------
   301 // ---------------------------------------------------------------------------
   286 // Subscribe to physical link notifications. 
   302 // Subscribe to physical link notifications. 
   287 // physical link must exist when calling this function.
   303 // physical link must exist when calling this function.
   288 // ---------------------------------------------------------------------------
   304 // ---------------------------------------------------------------------------
   289 //
   305 //
   290 void CBTNotifIncomingPairingHandler::MonitorPhysicalLink()
   306 void CBTNotifIncomingPairingHandler::MonitorPhysicalLink()
   291     {
   307     {
   292     // TRACE_FUNC_ENTRY
   308     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   293     iActive->SetRequestId( EPhysicalLinkNotify );
   309     iActive->SetRequestId( EPhysicalLinkNotify );
   294         // Subscribe to disconnect and error events.
   310     // Subscribe to disconnect and error events.
   295     iPla.NotifyNextBasebandChangeEvent( iBbEvent, 
   311     iPla.NotifyNextBasebandChangeEvent( iBbEvent, 
   296                             iActive->RequestStatus(), 
   312                             iActive->RequestStatus(), 
   297                             ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError );
   313                             ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError );
   298     iActive->GoActive();
   314     iActive->GoActive();
   299     // TRACE_FUNC_EXIT
   315     BOstraceFunctionExit0( DUMMY_DEVLIST );
   300     }
   316     }
   301 
   317 
   302 // ---------------------------------------------------------------------------
   318 // ---------------------------------------------------------------------------
   303 // Opens the adaptor if physical link exists.
   319 // Opens the adaptor if physical link exists.
   304 // ---------------------------------------------------------------------------
   320 // ---------------------------------------------------------------------------
   305 //
   321 //
   306 TInt CBTNotifIncomingPairingHandler::OpenPhysicalLinkAdaptor()
   322 TInt CBTNotifIncomingPairingHandler::OpenPhysicalLinkAdaptor()
   307     {
   323     {
   308     // TRACE_FUNC_ENTRY
   324     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   309     TInt err ( KErrNone );
   325     TInt err ( KErrNone );
   310     if( !iPla.IsOpen() )
   326     if( !iPla.IsOpen() )
   311         {
   327         {
   312             // Try to open the adapter in case it failed earlier.
   328         // Try to open the adapter in case it failed earlier.
   313             // This can happen for outgoing dedicated bonding with 
   329         // This can happen for outgoing dedicated bonding with 
   314             // non-SSP device, as the PIN dialog can be kept open even 
   330         // non-SSP device, as the PIN dialog can be kept open even 
   315             // though the link has dropped because of a time-out.
   331         // though the link has dropped because of a time-out.
   316         err = iPla.Open( iParent.SocketServ(), iAddr );
   332         err = iPla.Open( iParent.SocketServ(), iAddr );
   317         }
   333         }
   318     // TRACE_INFO( (_L("[BTEng]: CBTEngIncPair::HasPhysicalLink ? %d"), iPla.IsOpen() ) )
   334     BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:HasPhysicalLink ? %d", iPla.IsOpen() );
       
   335     BOstraceFunctionExit0( DUMMY_DEVLIST );
   319     return err;
   336     return err;
   320     }
   337     }
   321 
   338 
   322 // ---------------------------------------------------------------------------
   339 // ---------------------------------------------------------------------------
   323 // Cancel outstanding physical link notification
   340 // Cancel outstanding physical link notification
   324 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   325 //
   342 //
   326 void CBTNotifIncomingPairingHandler::CancelPlaNotification()
   343 void CBTNotifIncomingPairingHandler::CancelPlaNotification()
   327     {
   344     {
   328     // TRACE_FUNC_ENTRY
   345     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   329     if( iActive && iActive->RequestId() == EPhysicalLinkNotify )
   346     if( iActive && iActive->RequestId() == EPhysicalLinkNotify )
   330         {
   347         {
   331         // cancel Baseband monitor
   348         // cancel Baseband monitor
   332         iActive->Cancel();
   349         iActive->Cancel();
   333         }
   350         }
   334     // TRACE_FUNC_EXIT
   351     BOstraceFunctionExit0( DUMMY_DEVLIST );
   335     }
   352     }
   336 
   353 
   337 // ---------------------------------------------------------------------------
   354 // ---------------------------------------------------------------------------
   338 // Handle a physical link event. Notify pair failed if physical link is down.
   355 // Handle a physical link event. Notify pair failed if physical link is down.
   339 // ---------------------------------------------------------------------------
   356 // ---------------------------------------------------------------------------
   340 //
   357 //
   341 void CBTNotifIncomingPairingHandler::HandlePhysicalLinkResultL( TInt aResult )
   358 void CBTNotifIncomingPairingHandler::HandlePhysicalLinkResultL( TInt aResult )
   342     {
   359     {
   343     // TRACE_FUNC_ARG( ( _L( " BBEvent 0x%08X, code %d"), 
   360     BOstraceFunctionEntry0( DUMMY_DEVLIST );
   344     //                        iBbEvent().EventType(), iBbEvent().SymbianErrorCode() ) )
   361     // Check if the connection is still alive.
   345         // Check if the connection is still alive.
       
   346     TBool physicalLinkDown = 
   362     TBool physicalLinkDown = 
   347         ( iBbEvent().EventType() == ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError );
   363         ( iBbEvent().EventType() == ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError );
   348 
   364 
   349     if( aResult || physicalLinkDown )
   365     if( aResult || physicalLinkDown )
   350         {
   366         {
   359     else
   375     else
   360         {
   376         {
   361         // Uninteresting event, re-subscribe.
   377         // Uninteresting event, re-subscribe.
   362         MonitorPhysicalLink();
   378         MonitorPhysicalLink();
   363         }
   379         }
   364     // TRACE_FUNC_EXIT
   380     BOstraceFunctionExit0( DUMMY_DEVLIST );
   365     }
   381     }
   366 
   382 
   367 
   383 
   368 
   384