hotspotfw/hsclient/src/hssiaphandler.cpp
branchRCL_3
changeset 20 a9524956f6b5
parent 14 d9aaeb96a256
child 24 63be7eb3fc78
--- a/hotspotfw/hsclient/src/hssiaphandler.cpp	Wed Jun 09 10:53:40 2010 +0300
+++ b/hotspotfw/hsclient/src/hssiaphandler.cpp	Mon Jun 21 16:55:05 2010 +0300
@@ -31,6 +31,10 @@
 #include <cmmanagerdef.h>
 #include <cmdestinationext.h>
 
+// CONSTANTS
+const TInt  KRetryCount   = 20;
+const TInt  KRetryTimeout = 100000;
+
 using namespace CMManager;
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -276,12 +280,31 @@
 	            eaps->SetL( enabledEapList );
             	}
         }
-    // now update the access point
-    iWLANRecord->ModifyL( *dbSession );
+    
+    // Update access point, be prepared that Commsdat might be locked
+    TInt errCode( KErrLocked );
+    TInt retryCount( 0 );
+    
+    while( errCode == KErrLocked && retryCount < KRetryCount )
+        {
+        TRAP( errCode, iWLANRecord->ModifyL( *dbSession ) );
+
+        if ( errCode == KErrLocked )
+            {	
+            User::After( KRetryTimeout );
+            }	
+        retryCount++;	        
+        }
+    
+    if ( errCode )
+        {
+        // override previous ret value only when error happened        	    	
+        ret = errCode;
+        }
     
     CleanupStack::PopAndDestroy( dbSession );
     DEBUG("CHssIapHandler::ChangeSettingsL DONE");
-	return ret;
+    return ret;
     }
  
 // -----------------------------------------------------------------------------
@@ -557,8 +580,11 @@
     {
     DEBUG("CHssIapSettingsHandler::GetClientsIapsL");
     TBuf<32> buffer;                    // Temporary buffer for found UID from destination.
-    TUidName uidClient = aUId.Name();   // UID of the client.
     TUint32 iapId = 0;                  // IAP Identifiier.
+    TBuf<KIapNameLength> uidClient;     // UID of the client.
+    
+    uidClient.Copy( aUId.Name() );
+    ModifyClientUid( uidClient );
 
     RArray<TUint32> destArray = RArray<TUint32>( 10 );  // KCmArrayGranularity instead of 10
     CleanupClosePushL( destArray );
@@ -610,4 +636,23 @@
     CleanupStack::PopAndDestroy( &destArray );
     }
 
+// -----------------------------------------------------------------------------
+// ModifyClientUid
+// -----------------------------------------------------------------------------
+//
+void CHssIapHandler::ModifyClientUid( TDes& aUid )
+    {
+    DEBUG("CHssIapHandler::ModifyClientUid");
+    TInt indx = aUid.Find( KMark1 );
+    if ( KErrNotFound != indx )
+        {
+        aUid.Delete( indx, 1 );
+        indx = aUid.Find( KMark2 );
+        if ( KErrNotFound != indx )
+            {
+            aUid.Delete( indx, 1 );
+            }
+        }
+    }
+
 // End of File