|
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_SmsTestServer.h" |
|
17 #include "Te_Sms.h" |
|
18 |
|
19 _LIT(KServerName,"Te_Sms"); |
|
20 |
|
21 CSmsTestServer* CSmsTestServer::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 CSmsTestServer * testServer = new (ELeave) CSmsTestServer(); |
|
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 TInt result = StartC32(); |
|
44 if (result != KErrNone && result != KErrAlreadyExists) |
|
45 { |
|
46 User::Leave(result); |
|
47 } |
|
48 |
|
49 CActiveScheduler* sched=NULL; |
|
50 sched=new(ELeave) CActiveScheduler; |
|
51 CActiveScheduler::Install(sched); |
|
52 CSmsTestServer* testServer = NULL; |
|
53 |
|
54 // Create the CTestServer derived server |
|
55 TRAPD(err,testServer = CSmsTestServer::NewL()); |
|
56 if(!err) |
|
57 { |
|
58 // Sync with the client and enter the active scheduler |
|
59 RProcess::Rendezvous(KErrNone); |
|
60 sched->Start(); |
|
61 } |
|
62 User::After(10000000); |
|
63 delete testServer; |
|
64 delete sched; |
|
65 } |
|
66 |
|
67 GLDEF_C TInt E32Main() |
|
68 /** |
|
69 * @return - Standard Epoc error code on process exit |
|
70 * Secure variant only |
|
71 * Process entry point. Called by client using RProcess API |
|
72 */ |
|
73 { |
|
74 __UHEAP_MARK; |
|
75 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
76 if(cleanup == NULL) |
|
77 { |
|
78 return KErrNoMemory; |
|
79 } |
|
80 TRAPD(err,MainL()); |
|
81 delete cleanup; |
|
82 __UHEAP_MARKEND; |
|
83 User::After(10000000); |
|
84 return err; |
|
85 } |
|
86 |
|
87 CTestStep* CSmsTestServer::CreateTestStep(const TDesC& aStepName) |
|
88 /** |
|
89 * @return - A CTestStep derived instance |
|
90 * Secure and non-secure variants |
|
91 * Implementation of CTestServer pure virtual |
|
92 */ |
|
93 { |
|
94 CTestStep* testStep = NULL; |
|
95 |
|
96 if(aStepName == _L("TestGetCaps")) |
|
97 { |
|
98 testStep = new CTestGetCaps; |
|
99 } |
|
100 if(aStepName == _L("TestSmspList")) |
|
101 { |
|
102 testStep = new CTestSmspList; |
|
103 } |
|
104 if(aStepName == _L("TestMessageStoreInfo")) |
|
105 { |
|
106 testStep = new CTestMessageStoreInfo; |
|
107 } |
|
108 if(aStepName == _L("TestMessageStoreOps")) |
|
109 { |
|
110 testStep = new CTestMessageStoreOps; |
|
111 } |
|
112 if(aStepName == _L("TestSendSms")) |
|
113 { |
|
114 testStep = new CTestSendSms; |
|
115 } |
|
116 if(aStepName == _L("TestReceiveUnstoredSms")) |
|
117 { |
|
118 testStep = new CTestReceiveUnstoredSms; |
|
119 } |
|
120 if(aStepName == _L("TestReceiveStoredSms")) |
|
121 { |
|
122 testStep = new CTestReceiveStoredSms; |
|
123 } |
|
124 if(aStepName == _L("TestReceiveStoredSmsAndCancel")) |
|
125 { |
|
126 testStep = new CTestReceiveStoredSmsAndCancel; |
|
127 } |
|
128 if(aStepName == _L("TestSendSmsAndCancel")) |
|
129 { |
|
130 testStep = new CTestSendSmsAndCancel; |
|
131 } |
|
132 if(aStepName == _L("TestAckSmsStored")) |
|
133 { |
|
134 testStep = new CTestAckSmsStored; |
|
135 } |
|
136 if(aStepName == _L("TestAckSmsStoredCancel")) |
|
137 { |
|
138 testStep = new CTestAckSmsStoredCancel; |
|
139 } |
|
140 if(aStepName == _L("TestNackSmsStored")) |
|
141 { |
|
142 testStep = new CTestNackSmsStored; |
|
143 } |
|
144 if(aStepName == _L("TestNackSmsStoredCancel")) |
|
145 { |
|
146 testStep = new CTestNackSmsStoredCancel; |
|
147 } |
|
148 if(aStepName == _L("TestAckSmsStoredWithResponseCancel")) |
|
149 { |
|
150 testStep = new CTestAckSmsStoredWithResponseCancel; |
|
151 } |
|
152 if(aStepName == _L("TestNackSmsStoredWithResponse")) |
|
153 { |
|
154 testStep = new CTestNackSmsStoredWithResponse; |
|
155 } |
|
156 if(aStepName == _L("TestNackSmsStoredWithResponseCancel")) |
|
157 { |
|
158 testStep = new CTestNackSmsStoredWithResponseCancel; |
|
159 } |
|
160 if(aStepName == _L("TestResumeSmsReception")) |
|
161 { |
|
162 testStep = new CTestResumeSmsReception; |
|
163 } |
|
164 if(aStepName == _L("TestNotifySmsEvent")) |
|
165 { |
|
166 testStep = new CTestNotifySmsEvent; |
|
167 } |
|
168 if(aStepName == _L("TestNotifySmsEventCancel")) |
|
169 { |
|
170 testStep = new CTestNotifySmsEventCancel; |
|
171 } |
|
172 |
|
173 return testStep; |
|
174 } |