|
1 /* |
|
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file tsishelperserver.cpp |
|
21 */ |
|
22 #include "tsishelperserver.h" |
|
23 #include "tsishelperstep.h" |
|
24 |
|
25 _LIT(KServerName,"tsishelperserver"); |
|
26 |
|
27 CTSISHelperServer* CTSISHelperServer::NewL() |
|
28 /** |
|
29 * @return - Instance of the test server |
|
30 * Called inside the MainL() function to create and start the |
|
31 * CTestServer derived server. |
|
32 */ |
|
33 { |
|
34 CTSISHelperServer * server = new (ELeave) CTSISHelperServer(); |
|
35 CleanupStack::PushL(server); |
|
36 |
|
37 // Either use a StartL or ConstructL, the latter will permit |
|
38 // Server Logging. |
|
39 |
|
40 //server->StartL(KServerName); |
|
41 server-> ConstructL(KServerName); |
|
42 CleanupStack::Pop(server); |
|
43 return server; |
|
44 } |
|
45 |
|
46 LOCAL_C void MainL() |
|
47 { |
|
48 // Leave the hooks in for platform security |
|
49 #if (defined __DATA_CAGING__) |
|
50 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
51 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
52 #endif |
|
53 CActiveScheduler* sched=NULL; |
|
54 sched=new(ELeave) CActiveScheduler; |
|
55 CActiveScheduler::Install(sched); |
|
56 CTSISHelperServer* server = NULL; |
|
57 // Create the CTestServer derived server |
|
58 TRAPD(err,server = CTSISHelperServer::NewL()); |
|
59 if(!err) |
|
60 { |
|
61 // Sync with the client and enter the active scheduler |
|
62 RProcess::Rendezvous(KErrNone); |
|
63 sched->Start(); |
|
64 } |
|
65 delete server; |
|
66 delete sched; |
|
67 } |
|
68 |
|
69 GLDEF_C TInt E32Main() |
|
70 /** |
|
71 * @return - Standard Epoc error code on exit |
|
72 */ |
|
73 { |
|
74 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
75 if(cleanup == NULL) |
|
76 { |
|
77 return KErrNoMemory; |
|
78 } |
|
79 TRAP_IGNORE(MainL()); |
|
80 delete cleanup; |
|
81 return KErrNone; |
|
82 } |
|
83 |
|
84 CTestStep* CTSISHelperServer::CreateTestStep(const TDesC& aStepName) |
|
85 /** |
|
86 * @return - A CTestStep derived instance |
|
87 * Implementation of CTestServer pure virtual |
|
88 */ |
|
89 { |
|
90 CTestStep* testStep = NULL; |
|
91 |
|
92 if(aStepName == KTSISHelperStepController) |
|
93 { |
|
94 testStep = new CTSISHelperStepController(); |
|
95 } |
|
96 else |
|
97 { |
|
98 if(aStepName == KTSISHelperStepData) |
|
99 { |
|
100 testStep = new CTSISHelperStepData(); |
|
101 } |
|
102 } |
|
103 return testStep; |
|
104 } |
|
105 |