hotspotfw/hsclient/src/hssiaphandler.cpp
branchRCL_3
changeset 20 a9524956f6b5
parent 14 d9aaeb96a256
child 24 63be7eb3fc78
equal deleted inserted replaced
18:aaabc7526ded 20:a9524956f6b5
    28 #include <cmconnectionmethodext.h>
    28 #include <cmconnectionmethodext.h>
    29 #include <cmconnectionmethoddef.h>
    29 #include <cmconnectionmethoddef.h>
    30 #include <cmmanagerext.h>
    30 #include <cmmanagerext.h>
    31 #include <cmmanagerdef.h>
    31 #include <cmmanagerdef.h>
    32 #include <cmdestinationext.h>
    32 #include <cmdestinationext.h>
       
    33 
       
    34 // CONSTANTS
       
    35 const TInt  KRetryCount   = 20;
       
    36 const TInt  KRetryTimeout = 100000;
    33 
    37 
    34 using namespace CMManager;
    38 using namespace CMManager;
    35 
    39 
    36 // ============================ MEMBER FUNCTIONS ===============================
    40 // ============================ MEMBER FUNCTIONS ===============================
    37 
    41 
   274 	            CMDBField<TDesC8>* eaps = (CMDBField<TDesC8>*)iWLANRecord->GetFieldByIdL( KCDTIdWlanEnabledEaps );
   278 	            CMDBField<TDesC8>* eaps = (CMDBField<TDesC8>*)iWLANRecord->GetFieldByIdL( KCDTIdWlanEnabledEaps );
   275 	            //eaps->SetMaxLengthL( eapList16.Length() )
   279 	            //eaps->SetMaxLengthL( eapList16.Length() )
   276 	            eaps->SetL( enabledEapList );
   280 	            eaps->SetL( enabledEapList );
   277             	}
   281             	}
   278         }
   282         }
   279     // now update the access point
   283     
   280     iWLANRecord->ModifyL( *dbSession );
   284     // Update access point, be prepared that Commsdat might be locked
       
   285     TInt errCode( KErrLocked );
       
   286     TInt retryCount( 0 );
       
   287     
       
   288     while( errCode == KErrLocked && retryCount < KRetryCount )
       
   289         {
       
   290         TRAP( errCode, iWLANRecord->ModifyL( *dbSession ) );
       
   291 
       
   292         if ( errCode == KErrLocked )
       
   293             {	
       
   294             User::After( KRetryTimeout );
       
   295             }	
       
   296         retryCount++;	        
       
   297         }
       
   298     
       
   299     if ( errCode )
       
   300         {
       
   301         // override previous ret value only when error happened        	    	
       
   302         ret = errCode;
       
   303         }
   281     
   304     
   282     CleanupStack::PopAndDestroy( dbSession );
   305     CleanupStack::PopAndDestroy( dbSession );
   283     DEBUG("CHssIapHandler::ChangeSettingsL DONE");
   306     DEBUG("CHssIapHandler::ChangeSettingsL DONE");
   284 	return ret;
   307     return ret;
   285     }
   308     }
   286  
   309  
   287 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   288 // WriteWepKeysL
   311 // WriteWepKeysL
   289 // Writes WEP keys from aSettings to current WLANServiceTable record
   312 // Writes WEP keys from aSettings to current WLANServiceTable record
   555 //
   578 //
   556 void CHssIapHandler::GetClientIapsL( const TUid aUId, RArray<TUint>& aIapIdArray )
   579 void CHssIapHandler::GetClientIapsL( const TUid aUId, RArray<TUint>& aIapIdArray )
   557     {
   580     {
   558     DEBUG("CHssIapSettingsHandler::GetClientsIapsL");
   581     DEBUG("CHssIapSettingsHandler::GetClientsIapsL");
   559     TBuf<32> buffer;                    // Temporary buffer for found UID from destination.
   582     TBuf<32> buffer;                    // Temporary buffer for found UID from destination.
   560     TUidName uidClient = aUId.Name();   // UID of the client.
       
   561     TUint32 iapId = 0;                  // IAP Identifiier.
   583     TUint32 iapId = 0;                  // IAP Identifiier.
       
   584     TBuf<KIapNameLength> uidClient;     // UID of the client.
       
   585     
       
   586     uidClient.Copy( aUId.Name() );
       
   587     ModifyClientUid( uidClient );
   562 
   588 
   563     RArray<TUint32> destArray = RArray<TUint32>( 10 );  // KCmArrayGranularity instead of 10
   589     RArray<TUint32> destArray = RArray<TUint32>( 10 );  // KCmArrayGranularity instead of 10
   564     CleanupClosePushL( destArray );
   590     CleanupClosePushL( destArray );
   565 
   591 
   566     RCmManagerExt cmManager;
   592     RCmManagerExt cmManager;
   608 
   634 
   609     CleanupStack::PopAndDestroy( &cmManager );
   635     CleanupStack::PopAndDestroy( &cmManager );
   610     CleanupStack::PopAndDestroy( &destArray );
   636     CleanupStack::PopAndDestroy( &destArray );
   611     }
   637     }
   612 
   638 
       
   639 // -----------------------------------------------------------------------------
       
   640 // ModifyClientUid
       
   641 // -----------------------------------------------------------------------------
       
   642 //
       
   643 void CHssIapHandler::ModifyClientUid( TDes& aUid )
       
   644     {
       
   645     DEBUG("CHssIapHandler::ModifyClientUid");
       
   646     TInt indx = aUid.Find( KMark1 );
       
   647     if ( KErrNotFound != indx )
       
   648         {
       
   649         aUid.Delete( indx, 1 );
       
   650         indx = aUid.Find( KMark2 );
       
   651         if ( KErrNotFound != indx )
       
   652             {
       
   653             aUid.Delete( indx, 1 );
       
   654             }
       
   655         }
       
   656     }
       
   657 
   613 // End of File
   658 // End of File