|
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 // Non-secure 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 @internalComponent - Internal Symbian test code |
|
23 */ |
|
24 |
|
25 #include "TEgulTestServer.h" |
|
26 #include "T_ColorStep.h" |
|
27 #include "TBorderstep.h" |
|
28 #include "T_DigitWidth.h" |
|
29 #include "TEgulAlignmentStep.h" |
|
30 |
|
31 |
|
32 |
|
33 _LIT(KServerName,"TEgulTestServer"); |
|
34 CTEgulTestServer* CTEgulTestServer::NewL() |
|
35 /** |
|
36 @return - Instance of the test server |
|
37 Same code for Secure and non-secure variants |
|
38 Called inside the MainL() function to create and start the |
|
39 CTestServer derived server. |
|
40 */ |
|
41 { |
|
42 CTEgulTestServer * server = new (ELeave) CTEgulTestServer(); |
|
43 CleanupStack::PushL(server); |
|
44 // CServer base class call |
|
45 server->StartL(KServerName); |
|
46 CleanupStack::Pop(server); |
|
47 return server; |
|
48 } |
|
49 |
|
50 |
|
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 #if (defined __DATA_CAGING__) |
|
58 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
59 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
60 #endif |
|
61 CActiveScheduler* sched=NULL; |
|
62 sched=new(ELeave) CActiveScheduler; |
|
63 CActiveScheduler::Install(sched); |
|
64 CTEgulTestServer* server = NULL; |
|
65 // Create the CTestServer derived server |
|
66 TRAPD(err,server = CTEgulTestServer::NewL()); |
|
67 if(!err) |
|
68 { |
|
69 // Sync with the client and enter the active scheduler |
|
70 RProcess::Rendezvous(KErrNone); |
|
71 sched->Start(); |
|
72 } |
|
73 delete server; |
|
74 delete sched; |
|
75 } |
|
76 |
|
77 GLDEF_C TInt E32Main() |
|
78 /* |
|
79 @return - Standard Epoc error code on process exit |
|
80 Secure variant only |
|
81 Process entry point. Called by client using RProcess API |
|
82 */ |
|
83 { |
|
84 __UHEAP_MARK; |
|
85 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
86 if(cleanup == NULL) |
|
87 { |
|
88 return KErrNoMemory; |
|
89 } |
|
90 TRAP_IGNORE(MainL()); |
|
91 delete cleanup; |
|
92 __UHEAP_MARKEND; |
|
93 return KErrNone; |
|
94 } |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 CTestStep* CTEgulTestServer::CreateTestStep(const TDesC& aStepName) |
|
100 /** |
|
101 @return - A CTestStep derived instance |
|
102 Secure and non-secure variants |
|
103 Implementation of CTestServer pure virtual |
|
104 */ |
|
105 { |
|
106 CTestStep* testStep = NULL; |
|
107 // This server creates just one step but create as many as you want |
|
108 // They are created "just in time" when the worker thread is created |
|
109 if(aStepName == KT_ColorStep) |
|
110 testStep = new CT_ColorStep(); |
|
111 else if(aStepName == KTBorderStep) |
|
112 testStep = new CTBorderStep(); |
|
113 else if(aStepName == KT_DigitWidth) |
|
114 testStep= new CT_DigitWidth(); |
|
115 else if(aStepName == KTAlignmentStep) |
|
116 testStep= new CTAlignmentStep(); |
|
117 |
|
118 return testStep; |
|
119 } |