bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp
changeset 57 5ebadcda06cb
parent 42 b72428996822
child 70 f5508c13dfe0
equal deleted inserted replaced
51:625f43ae9362 57:5ebadcda06cb
    20 #include "btnotifoutgoingpairinghandler.h"
    20 #include "btnotifoutgoingpairinghandler.h"
    21 #include <btengconstants.h>
    21 #include <btengconstants.h>
    22 #include "bluetoothtrace.h"
    22 #include "bluetoothtrace.h"
    23 
    23 
    24 const TInt KBTNotifWaitingForPairingOkDelay = 500000; // 0.5s
    24 const TInt KBTNotifWaitingForPairingOkDelay = 500000; // 0.5s
       
    25 const TInt KBTNotif10SecondTimer = 10000000;
    25 
    26 
    26 enum TPairingStageId
    27 enum TPairingStageId
    27     {
    28     {
    28     /**
    29     /**
    29      * is monitoring physical link status
    30      * is monitoring physical link status
   154     // For a successful pairing, we need wait for registry table change.
   155     // For a successful pairing, we need wait for registry table change.
   155     if( aResult != KErrNone && aResult != KHCIErrorBase )
   156     if( aResult != KErrNone && aResult != KHCIErrorBase )
   156         {
   157         {
   157         // Pair failure situation.
   158         // Pair failure situation.
   158         SetPairResult( aResult );
   159         SetPairResult( aResult );
       
   160         TRAPD(err , ShowPairingResultNoteL(KErrGeneral));
       
   161         if(!err && iNotification)
       
   162             {
       
   163             iNotification->SetCloseTimer(KBTNotif10SecondTimer);
       
   164             }
   159         }
   165         }
   160     BOstraceFunctionExit0( DUMMY_DEVLIST );
   166     BOstraceFunctionExit0( DUMMY_DEVLIST );
   161     }
   167     }
   162 
   168 
   163 // ---------------------------------------------------------------------------
   169 // ---------------------------------------------------------------------------
   172     // First of all cancel the iPairingOkTimer timer, if active
   178     // First of all cancel the iPairingOkTimer timer, if active
   173     if (iActivePairingOk->IsActive())
   179     if (iActivePairingOk->IsActive())
   174         {
   180         {
   175         iActivePairingOk->Cancel();
   181         iActivePairingOk->Cancel();
   176         UnSetPairResult();  // we might have set it before (if the link went down) so we want to reset it.   
   182         UnSetPairResult();  // we might have set it before (if the link went down) so we want to reset it.   
       
   183         }
       
   184     // If the user checked the trusted checkbox then we trust the device
       
   185     if(iTrustDevice)
       
   186         {
       
   187         iParent.TrustDevice(iAddr);
   177         }
   188         }
   178     if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable && !iUserAwarePairing)
   189     if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable && !iUserAwarePairing)
   179 		{
   190 		{
   180 		// If an application uses btengconnman API to connect a service of 
   191 		// If an application uses btengconnman API to connect a service of 
   181 		// this device and JW pairing occurred as part of security enforcement,
   192 		// this device and JW pairing occurred as part of security enforcement,
   243                 {
   254                 {
   244                 // iPairResult must have been set as an error. if it's not it means somewhere else
   255                 // iPairResult must have been set as an error. if it's not it means somewhere else
   245                 // it has been reset. But we need to have it set to an error as we are notifying 
   256                 // it has been reset. But we need to have it set to an error as we are notifying 
   246                 // the "unable to pair" message.
   257                 // the "unable to pair" message.
   247                 SetPairResult(KErrGeneral);
   258                 SetPairResult(KErrGeneral);
       
   259                 TRAPD(err , ShowPairingResultNoteL(KErrGeneral));
       
   260                 if(!err && iNotification)
       
   261                     {
       
   262                     iNotification->SetCloseTimer(KBTNotif10SecondTimer);
       
   263                     }
   248                 }
   264                 }
   249             iParent.RenewPairingHandler( NULL );
   265             iParent.RenewPairingHandler( NULL );
   250             break;
   266             break;
   251             } 
   267             } 
   252         default:
   268         default: