|
1 // Copyright (c) 2007-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 // UnloadPhoneModule |
|
17 // [Action Parameters] |
|
18 // HBufC TsyName <input-optional>: Name of the Tsy to use. Defaults to "SIM". |
|
19 // RTelServer etelServer Stored RTelserver object name is passed, using this unloading phone module is done |
|
20 // [Action Description] |
|
21 // Unloads Phone module and closes the object |
|
22 // Should be called as the last test step for all the tests where ever symtsy is used. |
|
23 // [APIs Used] |
|
24 // __ACTION_INFO_END__ |
|
25 // |
|
26 // |
|
27 |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <e32property.h> |
|
31 #include <simtsy.h> |
|
32 #include <etelmm.h> |
|
33 #include <es_ini.h> |
|
34 #include <commsdattypesv1_1.h> |
|
35 #include <commsdat.h> |
|
36 using namespace CommsDat; |
|
37 #include "CMtfTestActionUnloadPhoneModule.h" |
|
38 #include "CMtfTestCase.h" |
|
39 #include "CMtfTestActionParameters.h" |
|
40 |
|
41 const TInt KMsvTestUidPhonePwrValue=0x100052C5; |
|
42 enum TMsvTestPhoneStatus |
|
43 { |
|
44 EMsvTestPhoneOff = 0, |
|
45 EMsvTestPhoneOn |
|
46 }; |
|
47 |
|
48 CMtfTestAction* CMtfTestActionUnloadPhoneModule::NewL(CMtfTestCase& aTestCase, CMtfTestActionParameters* aActionParameters) |
|
49 { |
|
50 CMtfTestActionUnloadPhoneModule* self = new (ELeave) CMtfTestActionUnloadPhoneModule(aTestCase); |
|
51 CleanupStack::PushL(self); |
|
52 self->ConstructL(aActionParameters); |
|
53 CleanupStack::Pop(self); |
|
54 return self; |
|
55 } |
|
56 |
|
57 CMtfTestActionUnloadPhoneModule::CMtfTestActionUnloadPhoneModule(CMtfTestCase& aTestCase) |
|
58 : CMtfSynchronousTestAction(aTestCase) |
|
59 { |
|
60 } |
|
61 |
|
62 CMtfTestActionUnloadPhoneModule::~CMtfTestActionUnloadPhoneModule() |
|
63 { |
|
64 } |
|
65 |
|
66 void CMtfTestActionUnloadPhoneModule::ExecuteActionL() |
|
67 { |
|
68 TestCase().Logger().Write(_L("CMtfTestActionUnloadPhoneModule::ExecuteActionL IN")); |
|
69 _LIT(KDefaultTsyName, "SIM"); |
|
70 TPtrC defaultTsyName(KDefaultTsyName); |
|
71 HBufC* defaultTsyNameBuf = defaultTsyName.AllocLC(); |
|
72 HBufC* tsyName = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(0), defaultTsyNameBuf); |
|
73 |
|
74 UnloadPhoneModuleL(tsyName); |
|
75 CleanupStack::PopAndDestroy(1, defaultTsyNameBuf); //tsyName |
|
76 |
|
77 TestCase().ActionCompletedL(*this); |
|
78 TestCase().Logger().Write(_L("CMtfTestActionUnloadPhoneModule::ExecuteActionL OUT")); |
|
79 } |
|
80 |
|
81 //Unloading phone module and sets TestPhoneOff |
|
82 void CMtfTestActionUnloadPhoneModule::UnloadPhoneModuleL(HBufC* aTsyName) |
|
83 { |
|
84 TInt testState; |
|
85 if(KErrNone != RProperty::Get(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testState)) |
|
86 { |
|
87 User::LeaveIfError(RProperty::Define(KUidPSSimTsyCategory, KPSSimTsyTestNumber, RProperty::EInt)); |
|
88 } |
|
89 TInt ret; |
|
90 ret = RProperty::Set(KUidSystemCategory, KMsvTestUidPhonePwrValue, EMsvTestPhoneOff); |
|
91 if(ret!=KErrNone) |
|
92 { |
|
93 TestCase().Logger().Write(_L("UnloadPhoneModule: Unable to set back to EMsvTestPhoneOff")); |
|
94 } |
|
95 RTelServer etelServer = ObtainValueParameterL<RTelServer>(TestCase(),ActionParameters().Parameter(1)); |
|
96 ret = etelServer.UnloadPhoneModule(aTsyName->Des()); |
|
97 if(ret!=KErrNone) |
|
98 { |
|
99 TestCase().Logger().Write(_L("UnloadPhoneModule: Unable to unload the phone module")); |
|
100 } |
|
101 etelServer.Close(); |
|
102 } |
|
103 |