1 /* |
|
2 * Copyright (c) 2005-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 "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 * Name : CTe_RegScriptCommandServer.cpp |
|
16 * Author : Jason Zhou |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #include "te_regscriptcommandserver.h" |
|
23 #include "accessstep.h" |
|
24 #include "globalsharestep.h" |
|
25 #include "starttimestep.h" |
|
26 #include "checktimestep.h" |
|
27 #include "checklogfilestep.h" |
|
28 #include "checkprogramstep.h" |
|
29 #include "checkfolderandfilestep.h" |
|
30 |
|
31 _LIT(KServerName, "Te_RegScriptCommandServer"); |
|
32 |
|
33 CTe_RegScriptCommandServer::CTe_RegScriptCommandServer() |
|
34 { |
|
35 // No implementation required |
|
36 } |
|
37 |
|
38 CTe_RegScriptCommandServer::~CTe_RegScriptCommandServer() |
|
39 { |
|
40 } |
|
41 |
|
42 CTe_RegScriptCommandServer* CTe_RegScriptCommandServer::NewLC() |
|
43 { |
|
44 CTe_RegScriptCommandServer* self = new (ELeave) CTe_RegScriptCommandServer(); |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL(KServerName); |
|
47 return self; |
|
48 } |
|
49 |
|
50 CTe_RegScriptCommandServer* CTe_RegScriptCommandServer::NewL() |
|
51 { |
|
52 CTe_RegScriptCommandServer* self = CTe_RegScriptCommandServer::NewLC(); |
|
53 CleanupStack::Pop(); // self; |
|
54 return self; |
|
55 } |
|
56 |
|
57 // EKA2 much simpler |
|
58 // Just an E32Main and a MainL() |
|
59 LOCAL_C void MainL() |
|
60 /** |
|
61 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
62 */ |
|
63 { |
|
64 // Leave the hooks in for platform security |
|
65 #if (defined __DATA_CAGING__) |
|
66 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
67 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
68 #endif |
|
69 CActiveScheduler* sched=NULL; |
|
70 sched=new(ELeave) CActiveScheduler; |
|
71 CActiveScheduler::Install(sched); |
|
72 // __EDIT_ME__ Your server name |
|
73 CTe_RegScriptCommandServer* server = NULL; |
|
74 // Create the CTestServer derived server |
|
75 // __EDIT_ME__ Your server name |
|
76 TRAPD(err,server = CTe_RegScriptCommandServer::NewL()); |
|
77 if(!err) |
|
78 { |
|
79 // Sync with the client and enter the active scheduler |
|
80 RProcess::Rendezvous(KErrNone); |
|
81 sched->Start(); |
|
82 } |
|
83 delete server; |
|
84 delete sched; |
|
85 } |
|
86 |
|
87 // Main Entry point |
|
88 GLDEF_C TInt E32Main() |
|
89 /** |
|
90 * @return - Standard Epoc error code on exit |
|
91 */ |
|
92 { |
|
93 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
94 if(cleanup == NULL) |
|
95 { |
|
96 return KErrNoMemory; |
|
97 } |
|
98 TRAP_IGNORE(MainL()); |
|
99 delete cleanup; |
|
100 return KErrNone; |
|
101 } |
|
102 |
|
103 // Create a thread in the calling process |
|
104 |
|
105 // __EDIT_ME__ - Use your own server class name |
|
106 CTestStep* CTe_RegScriptCommandServer::CreateTestStep(const TDesC& aStepName) |
|
107 /** |
|
108 * @aStepName - Provided along with script command |
|
109 * This is the name of the Test Step to be executed |
|
110 * @return - A CTestStep derived instance |
|
111 * Implementation of CTestServer pure virtual |
|
112 */ |
|
113 { |
|
114 CTestStep* testStep = NULL; |
|
115 // __EDIT_ME__ - Create your own test steps here |
|
116 // This server creates just one step but create as many as you want |
|
117 // They are created "just in time" when the worker thread is created |
|
118 if(aStepName == KGlobalShareStep1) |
|
119 { |
|
120 testStep = new CGlobalShareStep1(); |
|
121 } |
|
122 |
|
123 else if(aStepName == KGlobalShareStep2) |
|
124 { |
|
125 testStep = new CGlobalShareStep2(); |
|
126 } |
|
127 |
|
128 else if(aStepName == KAccessStep1) |
|
129 { |
|
130 testStep = new CAccessStep1(); |
|
131 } |
|
132 |
|
133 else if(aStepName == KAccessStep2) |
|
134 { |
|
135 testStep = new CAccessStep2(); |
|
136 } |
|
137 |
|
138 else if (aStepName==KStartTimeStep()) |
|
139 { |
|
140 testStep = new (ELeave) CStartTimeStep(this); |
|
141 } |
|
142 |
|
143 else if (aStepName==KCheckTimeStep()) |
|
144 { |
|
145 testStep = new (ELeave) CCheckTimeStep(this); |
|
146 } |
|
147 |
|
148 else if (aStepName==KCheckLogFileStep()) |
|
149 { |
|
150 testStep = new (ELeave) CCheckLogFileStep(); |
|
151 } |
|
152 |
|
153 else if (aStepName==KCheckProgramStep()) |
|
154 { |
|
155 testStep = new (ELeave) CCheckProgramStep(); |
|
156 } |
|
157 |
|
158 else if (aStepName==KCheckFolderAndFileStep()) |
|
159 { |
|
160 testStep = new (ELeave) CCheckFolderAndFileStep(); |
|
161 } |
|
162 |
|
163 return testStep; |
|
164 } |
|