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