idlefw/tsrc/devicestatusplugin/mt_devstaplg/testingtools.h
branchRCL_3
changeset 28 053c6c7c14f3
equal deleted inserted replaced
27:2c7f27287390 28:053c6c7c14f3
       
     1 /*
       
     2 * Copyright (c) 2004 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TESTINGTOOLS_H
       
    20 #define TESTINGTOOLS_H
       
    21 
       
    22 #include <btsapinternalpskeys.h>
       
    23 //#include <telephonyinternalpskeys.h>
       
    24 #include <activeidle2domainpskeys.h>
       
    25 #include <e32property.h>
       
    26 #include "stubdataholder.h"
       
    27 
       
    28 LOCAL_C void ChangeBTSAPValueL( TInt aValue )
       
    29     {
       
    30     RProperty::Define( KPSUidBluetoothSapConnectionState,
       
    31                                 KBTSapConnectionState,
       
    32                                 RProperty::EInt );
       
    33                                 
       
    34     User::LeaveIfError( RProperty::Set( KPSUidBluetoothSapConnectionState,
       
    35                     KBTSapConnectionState,
       
    36                     aValue ) );
       
    37     
       
    38     }
       
    39     
       
    40 LOCAL_C void DeleteBTSAPKey()
       
    41     {
       
    42     RProperty::Delete( KPSUidBluetoothSapConnectionState,
       
    43                                 KBTSapConnectionState );
       
    44     }
       
    45     
       
    46     
       
    47 LOCAL_C void EmulateSimRegFailEvent()
       
    48     {
       
    49     
       
    50         // Read capability: ReadUserData.
       
    51     _LIT_SECURITY_POLICY_C1( KReadUserPolicy, ECapabilityReadUserData ); 
       
    52     // Write capability: WriteDeviceData.
       
    53     _LIT_SECURITY_POLICY_C1( KWriteDevicePolicy, ECapabilityWriteDeviceData );
       
    54 
       
    55     RProperty::Define( 
       
    56          	KPSUidAiInformation,
       
    57          	KActiveIdleState,
       
    58          	RProperty::EInt,
       
    59             KReadUserPolicy,
       
    60             KWriteDevicePolicy );
       
    61 
       
    62     
       
    63     User::LeaveIfError( RProperty::Set( KPSUidAiInformation,
       
    64                     KActiveIdleState,
       
    65                     EPSAiForeground ) );    
       
    66     TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
       
    67     nwInfo->iRegistrationStatus = ENWRegistrationDenied;
       
    68 
       
    69     CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkConnectionFailure );
       
    70     }
       
    71 
       
    72 
       
    73 LOCAL_C void EmulateHCZEvent( const TDesC& aZoneName )
       
    74     {
       
    75     TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
       
    76     nwInfo->iViagIndicatorType = ENWViagIndicatorTypeHomeZone;
       
    77     nwInfo->iViagTextTag.Copy( aZoneName );
       
    78 
       
    79     CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageCurrentHomeZoneMessage );
       
    80     }
       
    81 
       
    82 LOCAL_C void EmulateMCNEvent( const TDesC& aName )
       
    83     {
       
    84     TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
       
    85     nwInfo->iMCNIndicatorType = ENWMCNIndicatorTypeActive;
       
    86     nwInfo->iMCNName.Copy( aName );
       
    87 
       
    88     CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageCurrentCellInfoMessage );
       
    89     }
       
    90 
       
    91 LOCAL_C void EmulateCUGEvent( TInt aIndex )
       
    92     {
       
    93     CStubDataHolder::Instance()->RemoveSSSetting( ESSSettingsCug );    
       
    94     CStubDataHolder::Instance()->SetSSSettingsValueL( ESSSettingsCug, aIndex );        
       
    95     RArray<MSSSettingsObserver*> observers = CStubDataHolder::Instance()->SSSettingsObservers();
       
    96     
       
    97     for( TInt i( 0 ); i < observers.Count(); i++ )
       
    98         {
       
    99         observers[i]->PhoneSettingChanged( ESSSettingsCug, aIndex );        
       
   100         }    
       
   101     }
       
   102 
       
   103 
       
   104 LOCAL_C void EncodePLMNField( TDes& aBuf, TBool aShowSPN, TInt aMCC, TInt aMNC )
       
   105     {
       
   106     TPtr8 ptr( (TUint8*)aBuf.Ptr(), aBuf.MaxSize() );
       
   107     ptr.Append( TChar( aShowSPN ) );    
       
   108     
       
   109     //one PLMN pair
       
   110     ptr.Append( TChar( 1 ) );    
       
   111     
       
   112     TBuf8<3> mcc;
       
   113     TBuf8<3> mnc;
       
   114     
       
   115 //    mcc.Format( _L8("%d"), aMCC );
       
   116   //  mnc.Format( _L8("%d"), aMNC );
       
   117     mcc.AppendNumFixedWidthUC( aMCC, EDecimal, 3 );//"241"
       
   118     mnc.AppendNumFixedWidthUC( aMNC, EDecimal, 3 );//"091"
       
   119     
       
   120     ptr.Append( TChar( ( mcc[0] - 48 ) | ( ( mcc[1] - 48 ) << 4 ) ) );    
       
   121     ptr.Append( TChar( ( mcc[2] - 48 ) | ( ( mnc[2] - 48 ) << 4 ) ) );    
       
   122     ptr.Append( TChar( ( mnc[0] - 48 ) | ( ( mnc[1] - 48 ) << 4 ) ) );    
       
   123     
       
   124     aBuf.SetLength( 3 );
       
   125         
       
   126     }
       
   127 
       
   128 
       
   129 #endif      //  TESTINGTOOLS_H
       
   130