|
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_R6SMSserver.h" |
|
17 #include "TE_testR6SMS.h" |
|
18 |
|
19 |
|
20 _LIT(KServerName,"TE_R6SMS"); |
|
21 |
|
22 |
|
23 CR6SMSTestServer* CR6SMSTestServer::NewL() |
|
24 /** |
|
25 * @return - Instance of the test server |
|
26 * Same code for Secure and non-secure variants |
|
27 * Called inside the MainL() function to create and start the |
|
28 * CTestServer derived server. |
|
29 */ |
|
30 { |
|
31 CR6SMSTestServer * server = new (ELeave) CR6SMSTestServer(); |
|
32 CleanupStack::PushL(server); |
|
33 // CServer base class call |
|
34 server->StartL(KServerName); |
|
35 CleanupStack::Pop(server); |
|
36 return server; |
|
37 } |
|
38 |
|
39 LOCAL_C void MainL() |
|
40 /** |
|
41 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
42 */ |
|
43 { |
|
44 CActiveScheduler* sched=NULL; |
|
45 sched=new(ELeave) CActiveScheduler; |
|
46 CActiveScheduler::Install(sched); |
|
47 CR6SMSTestServer* server = NULL; |
|
48 // Create the CTestServer derived server |
|
49 TRAPD(err,server = CR6SMSTestServer::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 server; |
|
57 delete sched; |
|
58 } |
|
59 |
|
60 GLDEF_C TInt E32Main() |
|
61 /** |
|
62 * @return - Standard Epoc error code on exit |
|
63 */ |
|
64 { |
|
65 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
66 if(cleanup == NULL) |
|
67 { |
|
68 return KErrNoMemory; |
|
69 } |
|
70 TRAPD(err,MainL()); |
|
71 |
|
72 delete cleanup; |
|
73 |
|
74 return err; |
|
75 } |
|
76 |
|
77 CTestStep* CR6SMSTestServer::CreateTestStep(const TDesC& aStepName) |
|
78 /** |
|
79 * @return - A CTestStep derived instance |
|
80 * Secure and non-secure variants |
|
81 * Implementation of CTestServer pure virtual |
|
82 */ |
|
83 { |
|
84 CTestStep* testStep = NULL; |
|
85 |
|
86 // |
|
87 // Here the test step is created when it is needed. Note that this |
|
88 // function is non-leaving so we cannot use new(ELeave). Therefore |
|
89 // the new could return NULL, but that is not a problem as it implies |
|
90 // the test step is missing and this will be marked in the log file. |
|
91 // |
|
92 if (aStepName == _L("CTestCSmsMessageAdditionalAttributes1")) |
|
93 { |
|
94 testStep = new CTestCSmsMessageAdditionalAttributes1; |
|
95 } |
|
96 else if (aStepName == _L("CTestCSmsMessageAdditionalAttributes2")) |
|
97 { |
|
98 testStep = new CTestCSmsMessageAdditionalAttributes2; |
|
99 } |
|
100 else if (aStepName == _L("CTestCSmsMessageAdditionalAttributes3")) |
|
101 { |
|
102 testStep = new CTestCSmsMessageAdditionalAttributes3; |
|
103 } |
|
104 else if (aStepName == _L("CTestR6CSmsMessage")) |
|
105 { |
|
106 testStep = new CTestR6CSmsMessage; |
|
107 } |
|
108 else if (aStepName == _L("CTestAddingIEsViaNewAndExistingInterfaces")) |
|
109 { |
|
110 testStep = new CTestAddingIEsViaNewAndExistingInterfaces; |
|
111 } |
|
112 else if (aStepName == _L("CTestIECategoryDefinitions")) |
|
113 { |
|
114 testStep = new CTestIECategoryDefinitions; |
|
115 } |
|
116 else if (aStepName == _L("CTestR6DCS")) |
|
117 { |
|
118 testStep = new CTestR6DCS; |
|
119 } |
|
120 |
|
121 // |
|
122 // Set the test step name here to save code!!! |
|
123 // |
|
124 if (testStep != NULL) |
|
125 { |
|
126 testStep->SetTestStepName(aStepName); |
|
127 } |
|
128 |
|
129 return testStep; |
|
130 } |