|
1 // Copyright (c) 2005-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 // |
|
15 |
|
16 #include "Te_MiscTestServer.h" |
|
17 #include "Te_Misc.h" |
|
18 |
|
19 _LIT(KServerName,"Te_Misc"); |
|
20 |
|
21 CMiscTestServer* CMiscTestServer::NewL() |
|
22 /** |
|
23 * @return - Instance of the test server |
|
24 * Same code for Secure and non-secure variants |
|
25 * Called inside the MainL() function to create and start the |
|
26 * CTestServer derived server. |
|
27 */ |
|
28 { |
|
29 CMiscTestServer * testServer = new (ELeave) CMiscTestServer(); |
|
30 CleanupStack::PushL(testServer); |
|
31 |
|
32 testServer->ConstructL(KServerName); |
|
33 CleanupStack::Pop(testServer); |
|
34 return testServer; |
|
35 } |
|
36 |
|
37 LOCAL_C void MainL() |
|
38 /** |
|
39 * Secure variant |
|
40 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
41 */ |
|
42 { |
|
43 CActiveScheduler* sched=NULL; |
|
44 sched=new(ELeave) CActiveScheduler; |
|
45 CActiveScheduler::Install(sched); |
|
46 CMiscTestServer* testServer = NULL; |
|
47 |
|
48 // Create the CTestServer derived server |
|
49 TRAPD(err,testServer = CMiscTestServer::NewL()); |
|
50 if(!err) |
|
51 { |
|
52 // Sync with the client and enter the active scheduler |
|
53 RProcess::Rendezvous(KErrNone); |
|
54 sched->Start(); |
|
55 } |
|
56 delete testServer; |
|
57 delete sched; |
|
58 } |
|
59 |
|
60 GLDEF_C TInt E32Main() |
|
61 /** |
|
62 * @return - Standard Epoc error code on process exit |
|
63 * Secure variant only |
|
64 * Process entry point. Called by client using RProcess API |
|
65 */ |
|
66 { |
|
67 __UHEAP_MARK; |
|
68 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
69 if(cleanup == NULL) |
|
70 { |
|
71 return KErrNoMemory; |
|
72 } |
|
73 TRAPD(err,MainL()); |
|
74 delete cleanup; |
|
75 __UHEAP_MARKEND; |
|
76 return err; |
|
77 } |
|
78 |
|
79 CTestStep* CMiscTestServer::CreateTestStep(const TDesC& aStepName) |
|
80 /** |
|
81 * @return - A CTestStep derived instance |
|
82 * Secure and non-secure variants |
|
83 * Implementation of CTestServer pure virtual |
|
84 */ |
|
85 { |
|
86 CTestStep* testStep = NULL; |
|
87 |
|
88 if(aStepName == _L("ServerInfo")) |
|
89 { |
|
90 testStep = new CServerInfo; |
|
91 } |
|
92 else if(aStepName == _L("SignalAndBatteryStrengthTest")) |
|
93 { |
|
94 testStep = new CSignalAndBatteryStrengthTest; |
|
95 } |
|
96 else if(aStepName == _L("ManufacturerInfoTest")) |
|
97 { |
|
98 testStep = new CManufacturerInfoTest; |
|
99 } |
|
100 else if(aStepName == _L("SubscriberIdTest")) |
|
101 { |
|
102 testStep = new CSubscriberIdTest; |
|
103 } |
|
104 else if(aStepName == _L("PhoneStoreTest")) |
|
105 { |
|
106 testStep = new CPhoneStoreTest; |
|
107 } |
|
108 else if(aStepName == _L("OwnNumberTest")) |
|
109 { |
|
110 testStep = new COwnNumberTest; |
|
111 } |
|
112 else if(aStepName == _L("GetCaps")) |
|
113 { |
|
114 testStep = new CGetCaps; |
|
115 } |
|
116 else if(aStepName == _L("GetLinesStatus")) |
|
117 { |
|
118 testStep = new CGetLinesStatus; |
|
119 } |
|
120 else if(aStepName == _L("GetMultimodeCaps")) |
|
121 { |
|
122 testStep = new CGetMultimodeCaps; |
|
123 } |
|
124 else if(aStepName == _L("GetNetworkCaps")) |
|
125 { |
|
126 testStep = new CGetNetworkCaps; |
|
127 } |
|
128 else if(aStepName == _L("GetCurrentMode")) |
|
129 { |
|
130 testStep = new CGetCurrentMode; |
|
131 } |
|
132 else if(aStepName == _L("GetAsyncNetList")) |
|
133 { |
|
134 testStep = new CGetAsyncNetList; |
|
135 } |
|
136 else if(aStepName == _L("IsSupportedByModuleTest")) |
|
137 { |
|
138 testStep = new CIsSupportedByModuleTest; |
|
139 } |
|
140 |
|
141 return testStep; |
|
142 } |