messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionSetNetRegStatus.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // SetNetworkRegistrationStatus
       
    17 // [Action Parameters]
       
    18 // TInt		status		<input>: The new network registration status.
       
    19 // [Action Description]
       
    20 // Asks SimTsy to change the network registration status to the value specified.
       
    21 // [APIs Used]
       
    22 // __ACTION_INFO_END__
       
    23 // 
       
    24 //
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32property.h>
       
    28 #include "CMtfTestActionSetNetRegStatus.h"
       
    29 #include "CMtfTestCase.h"
       
    30 #include "CMtfTestActionParameters.h"
       
    31 #include <simtsy.h>
       
    32 
       
    33 const TUint KMtfFakeRegStatChange = 0x1FFFFFFE;
       
    34  
       
    35 CMtfTestAction* CMtfTestActionSetNetRegStatus::NewL(CMtfTestCase& aTestCase, CMtfTestActionParameters* aActionParameters)
       
    36  	{
       
    37  	CMtfTestActionSetNetRegStatus* self = new (ELeave) CMtfTestActionSetNetRegStatus(aTestCase);
       
    38  	CleanupStack::PushL(self);
       
    39  	self->ConstructL(aActionParameters);
       
    40  	CleanupStack::Pop(self);
       
    41  	return self;
       
    42  	}
       
    43  
       
    44 CMtfTestActionSetNetRegStatus::CMtfTestActionSetNetRegStatus(CMtfTestCase& aTestCase)
       
    45  	: CMtfSynchronousTestAction(aTestCase)
       
    46  	{
       
    47  	TInt temp;
       
    48  	TInt ret = RProperty::Get(KUidPSSimTsyCategory, KPSSimTsyRegStatChange, temp);
       
    49  	if (ret == KErrNotFound)
       
    50  		{
       
    51  		RProperty::Define(KUidPSSimTsyCategory, KPSSimTsyRegStatChange, KPSSimTsyRegStatChangeKeyType);
       
    52  		}
       
    53  	ret = RProperty::Get(KUidSystemCategory, KMtfFakeRegStatChange, temp);
       
    54  	if( ret == KErrNotFound )
       
    55  		{
       
    56  		RProperty::Define(KUidSystemCategory, KMtfFakeRegStatChange, RProperty::EInt);
       
    57  		} 			
       
    58  	}
       
    59 
       
    60 void CMtfTestActionSetNetRegStatus::ExecuteActionL()
       
    61 	{
       
    62 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetNetRegStatus);
       
    63 	TInt status = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0));
       
    64 	
       
    65 	TestCase().Logger().WriteFormat(_L("CMtfTestActionSetNetRegStatus:: new state: %d"), status);
       
    66 	User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyRegStatChange, status));
       
    67 	User::LeaveIfError(RProperty::Set(KUidSystemCategory, KMtfFakeRegStatChange, status));
       
    68 
       
    69 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetNetRegStatus);
       
    70 	TestCase().ActionCompletedL(*this);
       
    71 	}
       
    72