|
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 "startcaasserver.h" |
|
17 #include "startcaasstep.h" |
|
18 |
|
19 #define UNUSED_VAR(a) a = a |
|
20 |
|
21 _LIT(KServerName,"StartCAAS"); |
|
22 |
|
23 |
|
24 CStartCAASServer* CStartCAASServer::NewL() |
|
25 /** |
|
26 * @return - Instance of the test server |
|
27 * Called inside the MainL() function to create and start the CTestServer derived server. |
|
28 */ |
|
29 { |
|
30 CStartCAASServer* server = new (ELeave) CStartCAASServer(); |
|
31 CleanupStack::PushL(server); |
|
32 |
|
33 //server->StartL(KServerName); // either use a StartL or ConstructL, |
|
34 server->ConstructL(KServerName); // the latter permits Server Logging. |
|
35 |
|
36 CleanupStack::Pop(server); |
|
37 return server; |
|
38 } |
|
39 |
|
40 |
|
41 // EKA2 much simpler |
|
42 // Just an E32Main and a MainL() |
|
43 LOCAL_C void MainL() |
|
44 /** |
|
45 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
46 */ |
|
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 |
|
57 CStartCAASServer* server = NULL; |
|
58 TRAPD(err,server = CStartCAASServer::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 |
|
70 // Only a DLL on emulator for typhoon and earlier |
|
71 |
|
72 |
|
73 GLDEF_C TInt E32Main() |
|
74 /** |
|
75 * @return - Standard Epoc error code on exit |
|
76 */ |
|
77 { |
|
78 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
79 if(cleanup == NULL) |
|
80 { |
|
81 return KErrNoMemory; |
|
82 } |
|
83 TRAPD(err,MainL()); |
|
84 UNUSED_VAR(err); |
|
85 delete cleanup; |
|
86 return KErrNone; |
|
87 } |
|
88 |
|
89 |
|
90 // Create a thread in the calling process |
|
91 // Emulator typhoon and earlier |
|
92 |
|
93 |
|
94 CTestStep* CStartCAASServer::CreateTestStep(const TDesC& aStepName) |
|
95 /** |
|
96 * @return - A CTestStep derived instance |
|
97 * Implementation of CTestServer pure virtual |
|
98 */ |
|
99 { |
|
100 CTestStep* testStep = NULL; |
|
101 if (aStepName == KStepNameStartCAAS) |
|
102 { |
|
103 testStep = new(ELeave) CStartCAASStep; // Method could leave while construction |
|
104 } |
|
105 return testStep; |
|
106 } |