bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp
branchRCL_3
changeset 61 269724087bed
parent 56 9386f31cc85b
child 72 4b59561a31c0
--- a/bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp	Wed Sep 01 12:20:04 2010 +0100
+++ b/bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp	Tue Sep 14 21:37:10 2010 +0300
@@ -42,6 +42,8 @@
 #include <csxhelp/bt.hlp.hrh> // The bt hrh info is needed, for help launching
 #endif
 
+// ================= CONSTANT =======================
+const TInt KMaxPasskeyLength = 16;
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -92,19 +94,19 @@
     }
 
 // ----------------------------------------------------------
-// CBTSSPPasskeyEntryNotifier::GetParamsL
+// CBTSSPPasskeyEntryNotifier::ProcessStartParamsL
 // Initialize parameters and check if device is already
 // in registry. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTSSPPasskeyEntryNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
+void CBTSSPPasskeyEntryNotifier::ProcessStartParamsL()
     {
-    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::ProcessStartParamsL()"));
 
-    CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage );
+    CBTNPairNotifierBase::ProcessStartParamsL();
     
     TBTPasskeyDisplayParamsPckg pckg;
-    pckg.Copy(aBuffer);
+    pckg.Copy(*iParamBuffer);
     iBTAddr = pckg().DeviceAddress();
     if ( OtherOutgoPairing(iBTAddr) )
         {
@@ -120,7 +122,7 @@
 
     ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() );
     
-    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL() completed"));
+    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::ProcessStartParamsL() completed"));
     }
 
 // ----------------------------------------------------------
@@ -135,8 +137,19 @@
     
     TBTPasskeyDisplayUpdateParamsPckg pckg;
     pckg.Copy(aBuffer);
-  
-    if(pckg().Type() != TBTNotifierUpdateParams2::EPasskeyDisplay)
+    
+    // Update devicename if needed
+    CBTNPairNotifierBase::UpdateL(aBuffer);
+        
+    if(pckg().Type() != TBTNotifierUpdateParams2::EPasskeyDisplay 
+       || !iAuthoriseDialog->IsQueryReleased())
+        {
+        TPtrC8 ret(KNullDesC8);
+        return (ret);
+        }
+    
+    TInt length = iBuf.Length();
+    if (length > KMaxPasskeyLength )
         {
         TPtrC8 ret(KNullDesC8);
         return (ret);
@@ -160,7 +173,10 @@
         case EPasskeyDigitDeleted:
             {
             // remove an '*' from the tail of iBuf
-            iBuf.Delete(iBuf.Length()-1, 1);  
+            if ( length )
+                {
+                iBuf.Delete(iBuf.Length()-1, 1);
+                }
             break;
             }
         case EPasskeyCleared: