psmservices/psmserver/tsrc/PsmTestModule/PsmPluginStub/src/PSMPluginStubSecond.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 "PSMPluginStubSecond.h"
       
    22 
       
    23 // CONSTANT DEFINITIONS
       
    24 const TUint32 KCenRepUid = 0x10200EE2;
       
    25 _LIT8( KOriginalValue4, "SecondFour" );
       
    26 
       
    27 enum TPsmPluginFirstKeys
       
    28     {
       
    29     EPsmPluginSecondKey1 = 11,
       
    30     EPsmPluginSecondKey2,
       
    31     EPsmPluginSecondKey3 = 23,
       
    32     EPsmPluginSecondKey4
       
    33     };
       
    34 
       
    35 // ----------------------------------------------------------------------------------
       
    36 // CPSMPluginSecond::CPSMPluginSecond()
       
    37 // ----------------------------------------------------------------------------------
       
    38 //  
       
    39 CPSMPluginSecond::CPSMPluginSecond( TPsmPluginCTorParams& aInitParams ) :
       
    40     CPsmPluginBase( aInitParams )
       
    41 	{	
       
    42 	}
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CPSMPluginSecond::ConstructL(
       
    46 // Symbian 2nd phase constructor can leave.
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 void CPSMPluginSecond::ConstructL()
       
    50     {
       
    51     }
       
    52     
       
    53 //
       
    54 // ----------------------------------------------------------------------------------
       
    55 // CPSMPluginSecond::NewL() 
       
    56 // ----------------------------------------------------------------------------------
       
    57 //  
       
    58 // Two-phased constructor.
       
    59 CPSMPluginSecond* CPSMPluginSecond::NewL( TPsmPluginCTorParams& aInitParams )
       
    60 	{
       
    61 	CPSMPluginSecond* self = new ( ELeave ) CPSMPluginSecond( aInitParams );
       
    62 
       
    63 	CleanupStack::PushL( self );
       
    64     self->ConstructL();
       
    65     CleanupStack::Pop( self );
       
    66 
       
    67     return self;
       
    68 	}
       
    69 	
       
    70 //
       
    71 // ----------------------------------------------------------------------------------
       
    72 // CPSMPluginSecond::~CPSMPluginSecond()
       
    73 // ----------------------------------------------------------------------------------
       
    74 //  
       
    75 // Destructor.
       
    76 CPSMPluginSecond::~CPSMPluginSecond()
       
    77 	{
       
    78     RDebug::Print( _L( "CPSMPluginSecond::~CPSMPluginSecond()" ) );
       
    79     }
       
    80 
       
    81 //
       
    82 // ----------------------------------------------------------------------------------
       
    83 // CPSMPluginSecond::NotifyModeChangeL()
       
    84 // ----------------------------------------------------------------------------------
       
    85 //  
       
    86 void CPSMPluginSecond::NotifyModeChange( const TInt aMode )
       
    87     {
       
    88     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL()" ) );
       
    89 
       
    90     RConfigInfoArray infoArray;
       
    91 
       
    92     TPsmsrvConfigInfo info1;
       
    93     info1.iConfigId = EPsmPluginSecondKey1;
       
    94     info1.iConfigType = EConfigTypeInt;
       
    95     info1.iIntValue = 1;
       
    96     info1.iBlocked = ETrue;
       
    97     infoArray.Append( info1 );
       
    98 
       
    99     TPsmsrvConfigInfo info2;
       
   100     info2.iConfigId = EPsmPluginSecondKey2;
       
   101     info2.iConfigType = EConfigTypeReal;
       
   102     info2.iRealValue = 2.2;
       
   103     info2.iBlocked = EFalse;
       
   104     infoArray.Append( info2 );
       
   105 
       
   106     TPsmsrvConfigInfo info3;
       
   107     info3.iConfigId = EPsmPluginSecondKey3;
       
   108     info3.iConfigType = EConfigTypeInt;
       
   109     info3.iIntValue = 3;
       
   110     info3.iBlocked = EFalse;
       
   111     infoArray.Append( info3 );
       
   112 
       
   113     TPsmsrvConfigInfo info4;
       
   114     info4.iConfigId = EPsmPluginSecondKey4;
       
   115     info4.iConfigType = EConfigTypeBuf;
       
   116     info4.iDesValue.Append( KOriginalValue4 );
       
   117     info4.iBlocked = ETrue;
       
   118     infoArray.Append( info4 );
       
   119 
       
   120     // For printing desc. values
       
   121     TBuf16<256> buffer( KNullDesC );
       
   122     buffer.Copy( info4.iDesValue );
       
   123 
       
   124     // Print old values from array
       
   125     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): oldValue info1: %d" ), infoArray[0].iIntValue );
       
   126     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info1: %i" ), infoArray[0].iBlocked );
       
   127     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): oldValue info2: %f" ), infoArray[1].iRealValue );
       
   128     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info2: %i" ), infoArray[1].iBlocked );
       
   129     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): oldValue info3: %d" ), infoArray[2].iIntValue );
       
   130     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info3: %i" ), infoArray[2].iBlocked );
       
   131     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): oldValue info4: %S" ), &buffer );
       
   132     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info4: %i" ), infoArray[3].iBlocked );
       
   133 
       
   134 
       
   135     TRAP_IGNORE( iSettingsProvider.BackupAndGetSettingsL( infoArray, KCenRepUid ) );
       
   136 
       
   137     buffer.Copy( infoArray[3].iDesValue );
       
   138 
       
   139     // Print new values from array
       
   140     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): newValue info1: %d" ), infoArray[0].iIntValue );
       
   141     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info1: %i" ), infoArray[0].iBlocked );
       
   142     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): newValue info2: %f" ), infoArray[1].iRealValue );
       
   143     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info2: %i" ), infoArray[1].iBlocked );
       
   144     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): newValue info3: %d" ), infoArray[2].iIntValue );
       
   145     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info3: %i" ), infoArray[2].iBlocked );
       
   146     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): newValue info4: %S" ), &buffer );
       
   147     RDebug::Print( _L( "CPSMPluginSecond::NotifyModeChangeL(): blocked info4: %i" ), infoArray[3].iBlocked );
       
   148 
       
   149     infoArray.Reset();
       
   150     }
       
   151 
       
   152