wlansecuritysettings/wepsecuritysettingsui/src/WEPSecuritySettingsImpl.cpp
branchRCL_3
changeset 37 75a6055b8ce3
parent 7 7b8801c4c2d9
equal deleted inserted replaced
23:3634639e6dc7 37:75a6055b8ce3
    14 * Description: Implementation of class CWEPSecuritySettingsImpl.     
    14 * Description: Implementation of class CWEPSecuritySettingsImpl.     
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: tr1cfwln#26 %
    19 * %version: tr1cfwln#27 %
    20 */
    20 */
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 
    23 
    24 #include "WEPSecuritySettingsImpl.h"
    24 #include "WEPSecuritySettingsImpl.h"
   532 // ---------------------------------------------------------
   532 // ---------------------------------------------------------
   533 //
   533 //
   534 void CWEPSecuritySettingsImpl::SaveL( TUint32 aIapId, 
   534 void CWEPSecuritySettingsImpl::SaveL( TUint32 aIapId, 
   535                                       CMDBSession& aSession ) const
   535                                       CMDBSession& aSession ) const
   536     {
   536     {
       
   537     const TInt KRetryWait = 100000;    // Wait time between retries in TTimeIntervalMicroSeconds32
       
   538     const TInt KRetryCount = 50;       // Max retry count
       
   539 
   537     // Load WLAN service table
   540     // Load WLAN service table
   538     // first get WLAN table id
   541     // first get WLAN table id
   539     CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
   542     CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
   540         ( CCDRecordBase::RecordFactoryL( 0 ) );
   543         ( CCDRecordBase::RecordFactoryL( 0 ) );
   541     CleanupStack::PushL( generic );    
   544     CleanupStack::PushL( generic );    
   586     formatKey3Field->SetL( iKeyFormat[ KThirdKey ] );
   589     formatKey3Field->SetL( iKeyFormat[ KThirdKey ] );
   587     CMDBField<TUint>* formatKey4Field = static_cast<CMDBField<TUint>*>
   590     CMDBField<TUint>* formatKey4Field = static_cast<CMDBField<TUint>*>
   588                             ( generic->GetFieldByIdL( KCDTIdWlanFormatKey4 ) );
   591                             ( generic->GetFieldByIdL( KCDTIdWlanFormatKey4 ) );
   589     formatKey4Field->SetL( iKeyFormat[ KFourthKey ] );
   592     formatKey4Field->SetL( iKeyFormat[ KFourthKey ] );
   590     
   593     
   591     // If table existed modify it
   594     TInt error( KErrNone );
   592     if( found )
   595     
   593         {
   596     // Saving changes
   594         generic->ModifyL( aSession );
   597     for ( TInt i( 0 ); i < KRetryCount; i++ )
   595         }
   598         {
   596     // Otherwise store a new record
   599         
   597     else
   600         // If table existed modify it
   598         {
   601         if( found )
   599         generic->SetRecordId( KCDNewRecordRequest );
   602             {
   600         generic->StoreL( aSession );
   603             TRAP( error, generic->ModifyL( aSession ) );
   601         }
   604             }
       
   605                    
       
   606         // Otherwise store a new record
       
   607         else
       
   608             {
       
   609             generic->SetRecordId( KCDNewRecordRequest );
       
   610             TRAP( error, generic->StoreL( aSession ) );
       
   611             }
       
   612                   
       
   613         // If operation failed with KErrLocked, we'll retry.
       
   614         if ( KErrLocked == error )
       
   615             {
       
   616             User::After( KRetryWait );
       
   617             }
       
   618         
       
   619         // Otherwise break the retry loop.
       
   620         else 
       
   621             {
       
   622             break;        
       
   623             }
       
   624         }
       
   625     
       
   626     // If the save operation failed, leave now. 
       
   627     User::LeaveIfError( error );
       
   628 
   602     CleanupStack::PopAndDestroy( generic );
   629     CleanupStack::PopAndDestroy( generic );
   603     }
   630     }
   604 
   631 
   605 
   632 
   606 // End of File
   633 // End of File