|
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 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started |
|
15 // in the process of the client. The client initialises the server by calling the |
|
16 // one and only ordinal. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 #include "Te_centrep_BURSuiteServer.h" |
|
25 #include "compareStep.h" |
|
26 #include "initailiseStep.h" |
|
27 #include "modifyStep.h" |
|
28 #include "compareDefStep.h" |
|
29 #include "initialiseDefStep.h" |
|
30 |
|
31 _LIT(KServerName,"Te_centrep_BURSuite"); |
|
32 CTe_centrep_BURSuite* CTe_centrep_BURSuite::NewL() |
|
33 /** |
|
34 * @return - Instance of the test server |
|
35 * Same code for Secure and non-secure variants |
|
36 * Called inside the MainL() function to create and start the |
|
37 * CTestServer derived server. |
|
38 */ |
|
39 { |
|
40 CTe_centrep_BURSuite * server = new (ELeave) CTe_centrep_BURSuite(); |
|
41 CleanupStack::PushL(server); |
|
42 // CServer base class call which can be either StartL or ConstructL, |
|
43 // the later will permit Server Logging. |
|
44 |
|
45 server->StartL(KServerName); |
|
46 CleanupStack::Pop(server); |
|
47 return server; |
|
48 } |
|
49 |
|
50 |
|
51 // Secure variants much simpler |
|
52 // For EKA2, just an E32Main and a MainL() |
|
53 LOCAL_C void MainL() |
|
54 /** |
|
55 * Secure variant |
|
56 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
57 */ |
|
58 { |
|
59 // Leave the hooks in for platform security |
|
60 #if (defined __DATA_CAGING__) |
|
61 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
62 RProcess().DataCaging(RProcess::ESecureApiOn); |
|
63 #endif |
|
64 CActiveScheduler* sched=NULL; |
|
65 sched=new(ELeave) CActiveScheduler; |
|
66 CActiveScheduler::Install(sched); |
|
67 CTe_centrep_BURSuite* server = NULL; |
|
68 // Create the CTestServer derived server |
|
69 TRAPD(err,server = CTe_centrep_BURSuite::NewL()); |
|
70 if(!err) |
|
71 { |
|
72 // Sync with the client and enter the active scheduler |
|
73 RProcess::Rendezvous(KErrNone); |
|
74 sched->Start(); |
|
75 } |
|
76 delete server; |
|
77 delete sched; |
|
78 } |
|
79 |
|
80 |
|
81 |
|
82 GLDEF_C TInt E32Main() |
|
83 /** |
|
84 * @return - Standard Epoc error code on process exit |
|
85 * Secure variant only |
|
86 * Process entry point. Called by client using RProcess API |
|
87 */ |
|
88 { |
|
89 __UHEAP_MARK; |
|
90 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
91 if(cleanup == NULL) |
|
92 { |
|
93 return KErrNoMemory; |
|
94 } |
|
95 TRAPD(err,MainL()); |
|
96 |
|
97 delete cleanup; |
|
98 __UHEAP_MARKEND; |
|
99 |
|
100 return err; |
|
101 } |
|
102 |
|
103 |
|
104 CTestStep* CTe_centrep_BURSuite::CreateTestStep(const TDesC& aStepName) |
|
105 /** |
|
106 * @return - A CTestStep derived instance |
|
107 * Secure and non-secure variants |
|
108 * Implementation of CTestServer pure virtual |
|
109 */ |
|
110 { |
|
111 CTestStep* testStep = NULL; |
|
112 // They are created "just in time" when the worker thread is created |
|
113 // More test steps can be added below |
|
114 if(aStepName == KcompareStep) |
|
115 testStep = new CcompareStep(); |
|
116 else if(aStepName == KinitailiseStep) |
|
117 testStep = new CinitailiseStep(); |
|
118 else if(aStepName == KmodifyStep) |
|
119 testStep = new CmodifyStep(); |
|
120 else if(aStepName == KinitialiseDefStep) |
|
121 testStep = new CinitialiseDefStep(); |
|
122 else if(aStepName == KcompareDefStep) |
|
123 testStep = new CcompareDefStep(); |
|
124 |
|
125 return testStep; |
|
126 } |