|
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 // CMtfTestActionSetNetRegStatus.cpp |
|
15 // __ACTION_INFO_BEGIN__ |
|
16 // [Action Name] |
|
17 // SetSignalStrength |
|
18 // [Action Parameters] |
|
19 // TInt strength <input>: The new signal strength. |
|
20 // [Action Description] |
|
21 // Asks SimTsy to change the signal strength to the value specified. |
|
22 // [APIs Used] |
|
23 // __ACTION_INFO_END__ |
|
24 // |
|
25 // |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <e32property.h> |
|
29 #include "CMtfTestActionSetSignalStrength.h" |
|
30 #include "CMtfTestActionSetNetRegStatus.h" |
|
31 #include "CMtfTestCase.h" |
|
32 #include "CMtfTestActionParameters.h" |
|
33 #include <simtsy.h> |
|
34 |
|
35 const TUint KMtfFakeSignalStrengthChange = 0x1FFFFFFF; |
|
36 |
|
37 CMtfTestAction* CMtfTestActionSetSignalStrength::NewL(CMtfTestCase& aTestCase, CMtfTestActionParameters* aActionParameters) |
|
38 { |
|
39 CMtfTestActionSetSignalStrength* self = new (ELeave) CMtfTestActionSetSignalStrength(aTestCase); |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(aActionParameters); |
|
42 CleanupStack::Pop(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 CMtfTestActionSetSignalStrength::CMtfTestActionSetSignalStrength(CMtfTestCase& aTestCase) |
|
47 : CMtfSynchronousTestAction(aTestCase) |
|
48 { |
|
49 TInt temp; |
|
50 TInt ret = RProperty::Get(KUidPSSimTsyCategory, KPSSimTsySignalStrengthChange, temp); |
|
51 if (ret == KErrNotFound) |
|
52 { |
|
53 RProperty::Define(KUidPSSimTsyCategory, KPSSimTsySignalStrengthChange, KPSSimTsySignalStrengthChangeKeyType); |
|
54 } |
|
55 ret = RProperty::Get(KUidSystemCategory, KMtfFakeSignalStrengthChange, temp); |
|
56 if( ret == KErrNotFound ) |
|
57 { |
|
58 RProperty::Define(KUidSystemCategory, KMtfFakeSignalStrengthChange, RProperty::EInt); |
|
59 } |
|
60 } |
|
61 |
|
62 void CMtfTestActionSetSignalStrength::ExecuteActionL() |
|
63 { |
|
64 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetSignalStrength); |
|
65 TInt status = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0)); |
|
66 |
|
67 TestCase().Logger().WriteFormat(_L("CMtfTestActionSetSignalStrength:: new state: %d"), status); |
|
68 User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsySignalStrengthChange, status)); |
|
69 User::LeaveIfError(RProperty::Set(KUidSystemCategory, KMtfFakeSignalStrengthChange, status)); |
|
70 |
|
71 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetSignalStrength); |
|
72 TestCase().ActionCompletedL(*this); |
|
73 } |
|
74 |