|
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 /** |
|
17 @file Te_LbsApiSuiteServer.cpp |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #include "te_lbsapisuiteserver.h" |
|
22 #include "calculationmethodsstep.h" |
|
23 #include "criteriaclassesstep.h" |
|
24 #include "dataclassesstep.h" |
|
25 #include "genericinfostep.h" |
|
26 #include "moduleclassesstep.h" |
|
27 #include "nomemorystep.h" |
|
28 #include "reminderstep.h" |
|
29 #include "noserverstep.h" |
|
30 #include "requestorclassesstep.h" |
|
31 |
|
32 _LIT(KServerName,"Te_LbsApiSuite"); |
|
33 CTe_LbsApiSuite* CTe_LbsApiSuite::NewL() |
|
34 /** |
|
35 * @return - Instance of the test server |
|
36 * Same code for Secure and non-secure variants |
|
37 * Called inside the MainL() function to create and start the |
|
38 * CTestServer derived server. |
|
39 */ |
|
40 { |
|
41 CTe_LbsApiSuite * server = new (ELeave) CTe_LbsApiSuite(); |
|
42 CleanupStack::PushL(server); |
|
43 |
|
44 server->ConstructL(KServerName); |
|
45 CleanupStack::Pop(server); |
|
46 return server; |
|
47 } |
|
48 |
|
49 |
|
50 // Secure variants much simpler |
|
51 // For EKA2, just an E32Main and a MainL() |
|
52 LOCAL_C void MainL() |
|
53 /** |
|
54 * Secure variant |
|
55 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
56 */ |
|
57 { |
|
58 // Leave the hooks in for platform security |
|
59 #if (defined __DATA_CAGING__) |
|
60 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
61 RProcess().DataCaging(RProcess::ESecureApiOn); |
|
62 #endif |
|
63 CActiveScheduler* sched=NULL; |
|
64 sched=new(ELeave) CActiveScheduler; |
|
65 CActiveScheduler::Install(sched); |
|
66 CTe_LbsApiSuite* server = NULL; |
|
67 // Create the CTestServer derived server |
|
68 TRAPD(err,server = CTe_LbsApiSuite::NewL()); |
|
69 if(!err) |
|
70 { |
|
71 // Sync with the client and enter the active scheduler |
|
72 RProcess::Rendezvous(KErrNone); |
|
73 sched->Start(); |
|
74 } |
|
75 delete server; |
|
76 delete sched; |
|
77 } |
|
78 |
|
79 |
|
80 |
|
81 GLDEF_C TInt E32Main() |
|
82 /** |
|
83 * @return - Standard Epoc error code on process exit |
|
84 * Secure variant only |
|
85 * Process entry point. Called by client using RProcess API |
|
86 */ |
|
87 { |
|
88 __UHEAP_MARK; |
|
89 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
90 if(cleanup == NULL) |
|
91 { |
|
92 return KErrNoMemory; |
|
93 } |
|
94 TRAPD(err,MainL()); |
|
95 delete cleanup; |
|
96 __UHEAP_MARKEND; |
|
97 return err; |
|
98 } |
|
99 |
|
100 |
|
101 CTestStep* CTe_LbsApiSuite::CreateTestStep(const TDesC& aStepName) |
|
102 /** |
|
103 * @return - A CTestStep derived instance |
|
104 * Secure and non-secure variants |
|
105 * Implementation of CTestServer pure virtual |
|
106 */ |
|
107 { |
|
108 CTestStep* testStep = NULL; |
|
109 |
|
110 |
|
111 |
|
112 if(aStepName == KCalculationMethodsStep) |
|
113 testStep = new CCalculationMethodsStep(); |
|
114 else if(aStepName == KCriteriaClassesStep) |
|
115 testStep = new CCriteriaClassesStep(); |
|
116 else if(aStepName == KDataClassesStep) |
|
117 testStep = new CDataClassesStep(); |
|
118 else if(aStepName == KGenericInfoStep) |
|
119 testStep = new CGenericInfoStep(); |
|
120 else if(aStepName == KModuleClassesStep) |
|
121 testStep = new CModuleClassesStep(); |
|
122 else if(aStepName == KNoMemoryStep) |
|
123 #if defined(__WINS__) && defined(__DEBUG__) |
|
124 testStep = new CNoMemoryStep(); |
|
125 #else |
|
126 testStep = new CReminderStep(); |
|
127 #endif |
|
128 else if(aStepName == KNoServerStep) |
|
129 testStep = new CNoServerStep(); |
|
130 else if(aStepName == KRequestorClassesStep) |
|
131 testStep = new CRequestorClassesStep(); |
|
132 return testStep; |
|
133 } |