PECengine/AttributeLibrary2/SrcTransactions/PEngWVCspVersion.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Wireless Village CSP version selector.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "PEngWVCspVersion.h"
       
    20 #include "PresenceDebugPrint.h"
       
    21 #include <centralrepository.h>
       
    22 #include <wvengineInternalCRKeys.h>
       
    23 #include <E32Base.h>
       
    24 
       
    25 
       
    26 const TReal KPEngWVEngineCsp12 = 1.2;
       
    27 const TReal KPEngWVEngineCsp11 = 1.1;
       
    28 
       
    29 
       
    30 // ============================ LOCAL FUNCTIONS ===============================
       
    31 // -----------------------------------------------------------------------------
       
    32 // DoSelectVersionL()
       
    33 // -----------------------------------------------------------------------------
       
    34 void DoSelectVersionL( TPEngWVCspVersion& aVersion )
       
    35     {
       
    36     aVersion = EWVCspV11;
       
    37 
       
    38     TReal protocolValue;
       
    39     CRepository* cenRep = CRepository::NewLC( KCRUIDWVEngineVariation );
       
    40     TInt err = cenRep->Get( KWVEngineCspVersion, protocolValue );
       
    41     CleanupStack::PopAndDestroy(); //cenRep
       
    42 
       
    43     if ( ( err == KErrNone ) && ( protocolValue == KPEngWVEngineCsp12 ) )
       
    44         {
       
    45         aVersion = EWVCspV12;
       
    46         }
       
    47     }
       
    48 
       
    49 
       
    50 // ============================ MEMBER FUNCTIONS ===============================
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // PEngWVCspVersion::SelectVersionL()
       
    54 // -----------------------------------------------------------------------------
       
    55 EXPORT_C TPEngWVCspVersion PEngWVCspVersion::SelectVersionL()
       
    56     {
       
    57     PENG_DP( D_PENG_LIT( "PEngWVCspVersion::SelectVersionL() - from WV Engine CenRep" ) );
       
    58 
       
    59     TPEngWVCspVersion version = EWVCspV11;
       
    60     TRAPD( err, DoSelectVersionL( version ) );
       
    61     if ( err != KErrNotFound )
       
    62         {
       
    63         User::LeaveIfError( err );
       
    64         }
       
    65 
       
    66 
       
    67     PENG_DP( D_PENG_LIT( "PEngWVCspVersion::SelectVersionL() - Using WV CSP %d" ),
       
    68              version );
       
    69     return version;
       
    70     }
       
    71 
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // PEngWVCspVersion::SetVersionL()
       
    75 // -----------------------------------------------------------------------------
       
    76 EXPORT_C void PEngWVCspVersion::SetVersionL( TPEngWVCspVersion aVersion )
       
    77     {
       
    78     PENG_DP( D_PENG_LIT( "PEngWVCspVersion::SetVersionL() - Setting %d to WV Engine CenRep" ), aVersion );
       
    79 
       
    80 
       
    81     TReal protocolValue = KPEngWVEngineCsp11;
       
    82     if ( aVersion == EWVCspV12 )
       
    83         {
       
    84         protocolValue = KPEngWVEngineCsp12;
       
    85         }
       
    86 
       
    87     CRepository* cenRep = CRepository::NewLC( KCRUIDWVEngineVariation );
       
    88     User::LeaveIfError( cenRep->Set( KWVEngineCspVersion, protocolValue ) );
       
    89     CleanupStack::PopAndDestroy(); //cenRep
       
    90 
       
    91 
       
    92     PENG_DP( D_PENG_LIT( "PEngWVCspVersion::SetVersionL() - done" ) );
       
    93     }
       
    94 
       
    95 
       
    96 //  End of File
       
    97 
       
    98 
       
    99