bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp
branchRCL_3
changeset 72 4b59561a31c0
parent 61 269724087bed
equal deleted inserted replaced
64:1934667b0e2b 72:4b59561a31c0
    40 #ifdef __SERIES60_HELP
    40 #ifdef __SERIES60_HELP
    41 #include <hlplch.h>
    41 #include <hlplch.h>
    42 #include <csxhelp/bt.hlp.hrh> // The bt hrh info is needed, for help launching
    42 #include <csxhelp/bt.hlp.hrh> // The bt hrh info is needed, for help launching
    43 #endif
    43 #endif
    44 
    44 
    45 // ================= CONSTANT =======================
       
    46 const TInt KMaxPasskeyLength = 16;
       
    47 
    45 
    48 // ================= MEMBER FUNCTIONS =======================
    46 // ================= MEMBER FUNCTIONS =======================
    49 
    47 
    50 // ----------------------------------------------------------
    48 // ----------------------------------------------------------
    51 // CBTSSPPasskeyEntryNotifier::NewL
    49 // CBTSSPPasskeyEntryNotifier::NewL
    92     iInfo.iPriority = ENotifierPriorityVHigh;
    90     iInfo.iPriority = ENotifierPriorityVHigh;
    93     return iInfo;
    91     return iInfo;
    94     }
    92     }
    95 
    93 
    96 // ----------------------------------------------------------
    94 // ----------------------------------------------------------
    97 // CBTSSPPasskeyEntryNotifier::ProcessStartParamsL
    95 // CBTSSPPasskeyEntryNotifier::GetParamsL
    98 // Initialize parameters and check if device is already
    96 // Initialize parameters and check if device is already
    99 // in registry. Jump to RunL as soon as possible.
    97 // in registry. Jump to RunL as soon as possible.
   100 // ----------------------------------------------------------
    98 // ----------------------------------------------------------
   101 //
    99 //
   102 void CBTSSPPasskeyEntryNotifier::ProcessStartParamsL()
   100 void CBTSSPPasskeyEntryNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
   103     {
   101     {
   104     FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::ProcessStartParamsL()"));
   102     FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL()"));
   105 
   103 
   106     CBTNPairNotifierBase::ProcessStartParamsL();
   104     CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage );
   107     
   105     
   108     TBTPasskeyDisplayParamsPckg pckg;
   106     TBTPasskeyDisplayParamsPckg pckg;
   109     pckg.Copy(*iParamBuffer);
   107     pckg.Copy(aBuffer);
   110     iBTAddr = pckg().DeviceAddress();
   108     iBTAddr = pckg().DeviceAddress();
   111     if ( OtherOutgoPairing(iBTAddr) )
   109     if ( OtherOutgoPairing(iBTAddr) )
   112         {
   110         {
   113         // We won't allow incoming pairing during outgoing pairing:
   111         // We won't allow incoming pairing during outgoing pairing:
   114         FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier: outgoing pair in progress, reject incoming pair"));
   112         FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier: outgoing pair in progress, reject incoming pair"));
   120     iPasskey.AppendNumFixedWidth(pckg().NumericalValue(), EDecimal, KPassKeylength);
   118     iPasskey.AppendNumFixedWidth(pckg().NumericalValue(), EDecimal, KPassKeylength);
   121     iPasskey.Insert(3,_L(" "));
   119     iPasskey.Insert(3,_L(" "));
   122 
   120 
   123     ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() );
   121     ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() );
   124     
   122     
   125     FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::ProcessStartParamsL() completed"));
   123     FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL() completed"));
   126     }
   124     }
   127 
   125 
   128 // ----------------------------------------------------------
   126 // ----------------------------------------------------------
   129 // CBTSSPPasskeyEntryNotifier::UpdateL
   127 // CBTSSPPasskeyEntryNotifier::UpdateL
   130 // Notifier update. Stores the received bluetooth
   128 // Notifier update. Stores the received bluetooth
   135     {
   133     {
   136     FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::UpdateL()"));
   134     FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::UpdateL()"));
   137     
   135     
   138     TBTPasskeyDisplayUpdateParamsPckg pckg;
   136     TBTPasskeyDisplayUpdateParamsPckg pckg;
   139     pckg.Copy(aBuffer);
   137     pckg.Copy(aBuffer);
   140     
   138   
   141     // Update devicename if needed
   139     if(pckg().Type() != TBTNotifierUpdateParams2::EPasskeyDisplay)
   142     CBTNPairNotifierBase::UpdateL(aBuffer);
       
   143         
       
   144     if(pckg().Type() != TBTNotifierUpdateParams2::EPasskeyDisplay 
       
   145        || !iAuthoriseDialog->IsQueryReleased())
       
   146         {
       
   147         TPtrC8 ret(KNullDesC8);
       
   148         return (ret);
       
   149         }
       
   150     
       
   151     TInt length = iBuf.Length();
       
   152     if (length > KMaxPasskeyLength )
       
   153         {
   140         {
   154         TPtrC8 ret(KNullDesC8);
   141         TPtrC8 ret(KNullDesC8);
   155         return (ret);
   142         return (ret);
   156         }
   143         }
   157     
   144     
   171             break;
   158             break;
   172             }
   159             }
   173         case EPasskeyDigitDeleted:
   160         case EPasskeyDigitDeleted:
   174             {
   161             {
   175             // remove an '*' from the tail of iBuf
   162             // remove an '*' from the tail of iBuf
   176             if ( length )
   163             iBuf.Delete(iBuf.Length()-1, 1);  
   177                 {
       
   178                 iBuf.Delete(iBuf.Length()-1, 1);
       
   179                 }
       
   180             break;
   164             break;
   181             }
   165             }
   182         case EPasskeyCleared:
   166         case EPasskeyCleared:
   183             {
   167             {
   184             // remove all '*'
   168             // remove all '*'