psmservices/psmserver/tsrc/PsmTestModule/PsmPluginStub/src/PSMPluginStubFirst.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Stub imlementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <psmsettingsprovider.h>
       
    21 #include "PSMPluginStubFirst.h"
       
    22 
       
    23 // CONSTANT DEFINITIONS
       
    24 const TUint32 KCenRepUid = 0x10200EE1;
       
    25 
       
    26 enum TPsmPluginFirstKeys
       
    27     {
       
    28     EPsmPluginFirstKey1 = 1,
       
    29     EPsmPluginFirstKey2,
       
    30     EPsmPluginFirstKey3,
       
    31     EPsmPluginFirstKey4
       
    32     };
       
    33 
       
    34 _LIT8( KOriginalValue4, "Four" );
       
    35 
       
    36 //
       
    37 // ----------------------------------------------------------------------------------
       
    38 // CPSMPluginFirst::CPSMPluginFirst()
       
    39 // ----------------------------------------------------------------------------------
       
    40 //  
       
    41 CPSMPluginFirst::CPSMPluginFirst( TPsmPluginCTorParams& aInitParams ) :
       
    42     CPsmPluginBase( aInitParams )
       
    43 	{	
       
    44 	}
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CPSMPluginFirst::ConstructL(
       
    48 // Symbian 2nd phase constructor can leave.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CPSMPluginFirst::ConstructL()
       
    52     {
       
    53     }
       
    54     
       
    55 //
       
    56 // ----------------------------------------------------------------------------------
       
    57 // CPSMPluginFirst::NewL() 
       
    58 // ----------------------------------------------------------------------------------
       
    59 //  
       
    60 // Two-phased constructor.
       
    61 CPSMPluginFirst* CPSMPluginFirst::NewL( TPsmPluginCTorParams& aInitParams )
       
    62 	{
       
    63 	CPSMPluginFirst* self = new ( ELeave ) CPSMPluginFirst( aInitParams );
       
    64 
       
    65 	CleanupStack::PushL( self );
       
    66     self->ConstructL();
       
    67     CleanupStack::Pop( self );
       
    68 
       
    69     return self;
       
    70 	}
       
    71 	
       
    72 //
       
    73 // ----------------------------------------------------------------------------------
       
    74 // CPSMPluginFirst::~CPSMPluginFirst()
       
    75 // ----------------------------------------------------------------------------------
       
    76 //  
       
    77 // Destructor.
       
    78 CPSMPluginFirst::~CPSMPluginFirst()
       
    79 	{
       
    80     RDebug::Print( _L( "CPSMPluginFirst::~CPSMPluginFirst()" ) );
       
    81 	}
       
    82 
       
    83 //
       
    84 // ----------------------------------------------------------------------------------
       
    85 // CPSMPluginFirst::NotifyModeChangeL()
       
    86 // ----------------------------------------------------------------------------------
       
    87 //  
       
    88 void CPSMPluginFirst::NotifyModeChange( const TInt aMode )
       
    89     {
       
    90     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL()" ) );
       
    91 
       
    92     RConfigInfoArray infoArray;
       
    93 
       
    94     TPsmsrvConfigInfo info1;
       
    95     info1.iConfigId = EPsmPluginFirstKey1;
       
    96     info1.iConfigType = EConfigTypeInt;
       
    97     info1.iIntValue = 1;
       
    98     infoArray.Append( info1 );
       
    99 
       
   100     TPsmsrvConfigInfo info2;
       
   101     info2.iConfigId = EPsmPluginFirstKey2;
       
   102     info2.iConfigType = EConfigTypeReal;
       
   103     info2.iRealValue = 2.2;
       
   104     infoArray.Append( info2 );
       
   105 
       
   106     TPsmsrvConfigInfo info3;
       
   107     info3.iConfigId = EPsmPluginFirstKey3;
       
   108     info3.iConfigType = EConfigTypeInt;
       
   109     info3.iIntValue = 3;
       
   110     infoArray.Append( info3 );
       
   111 
       
   112     TPsmsrvConfigInfo info4;
       
   113     info4.iConfigId = EPsmPluginFirstKey4;
       
   114     info4.iConfigType = EConfigTypeBuf;
       
   115     info4.iDesValue.Append( KOriginalValue4 );
       
   116     infoArray.Append( info4 );
       
   117 
       
   118     // For printing desc. values
       
   119     TBuf16<256> buffer( KNullDesC );
       
   120     buffer.Copy( info4.iDesValue );
       
   121 
       
   122     // Print old values from array
       
   123     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): oldValue info1: %d" ), infoArray[0].iIntValue );
       
   124     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): oldValue info2: %f" ), infoArray[1].iRealValue );
       
   125     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): oldValue info3: %d" ), infoArray[2].iIntValue );
       
   126     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): oldValue info4: %S" ), &buffer );
       
   127 
       
   128     // Backup settings...
       
   129     TRAP_IGNORE( iSettingsProvider.BackupSettingsL( infoArray, KCenRepUid ) );
       
   130 
       
   131     // ...And get new ones
       
   132     TRAP_IGNORE( iSettingsProvider.GetSettingsL( infoArray, KCenRepUid ) );
       
   133 
       
   134     buffer.Copy( infoArray[3].iDesValue );
       
   135 
       
   136     // Print new values from array
       
   137     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): newValue info1: %d" ), infoArray[0].iIntValue );
       
   138     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): newValue info2: %f" ), infoArray[1].iRealValue );
       
   139     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): newValue info3: %d" ), infoArray[2].iIntValue );
       
   140     RDebug::Print( _L( "CPSMPluginFirst::NotifyModeChangeL(): newValue info4: %S" ), &buffer );
       
   141 
       
   142     infoArray.Reset();
       
   143     }
       
   144 
       
   145