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