|
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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file CUCCServer.cpp |
|
22 */ |
|
23 |
|
24 #include "CUCCServer.h" |
|
25 #include "CUCCTest.h" |
|
26 |
|
27 _LIT(KServerName,"UCCControlTE"); |
|
28 |
|
29 CUCCServer* CUCCServer::NewL() |
|
30 /** |
|
31 * @return - Instance of the test server |
|
32 * Called inside the MainL() function to create and start the |
|
33 * CTestServer derived server. |
|
34 */ |
|
35 { |
|
36 CUCCServer * server = new (ELeave) CUCCServer(); |
|
37 CleanupStack::PushL(server); |
|
38 |
|
39 // Either use a StartL or ConstructL, the latter will permit |
|
40 // Server Logging. |
|
41 |
|
42 //server->StartL(KServerName); |
|
43 server-> ConstructL(KServerName); |
|
44 CleanupStack::Pop(server); |
|
45 return server; |
|
46 } |
|
47 |
|
48 // EKA2 much simpler |
|
49 // Just an E32Main and a MainL() |
|
50 LOCAL_C void MainL() |
|
51 /** |
|
52 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
53 */ |
|
54 { |
|
55 // Leave the hooks in for platform security |
|
56 #if (defined __DATA_CAGING__) |
|
57 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
58 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
59 #endif |
|
60 CActiveScheduler* sched=NULL; |
|
61 sched=new(ELeave) CActiveScheduler; |
|
62 CActiveScheduler::Install(sched); |
|
63 CUCCServer* server = NULL; |
|
64 // Create the CTestServer derived server |
|
65 TRAPD(err,server = CUCCServer::NewL()); |
|
66 if(!err) |
|
67 { |
|
68 // Sync with the client and enter the active scheduler |
|
69 RProcess::Rendezvous(KErrNone); |
|
70 sched->Start(); |
|
71 } |
|
72 delete server; |
|
73 delete sched; |
|
74 } |
|
75 |
|
76 // Only a DLL on emulator for and earlier |
|
77 |
|
78 GLDEF_C TInt E32Main() |
|
79 /** |
|
80 * @return - Standard Epoc error code on exit |
|
81 */ |
|
82 { |
|
83 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
84 if(cleanup == NULL) |
|
85 { |
|
86 return KErrNoMemory; |
|
87 } |
|
88 TRAP_IGNORE(MainL()); |
|
89 delete cleanup; |
|
90 return KErrNone; |
|
91 } |
|
92 |
|
93 // Create a thread in the calling process |
|
94 // Emulator and earlier |
|
95 |
|
96 CTestStep* CUCCServer::CreateTestStep(const TDesC& aStepName) |
|
97 /** |
|
98 * @return - A CTestStep derived instance |
|
99 * Implementation of CTestServer pure virtual |
|
100 */ |
|
101 { |
|
102 CTestStep* testStep = NULL; |
|
103 |
|
104 if(aStepName == KTestStartUseCase) |
|
105 testStep = new CUCCTestStartUseCase(); |
|
106 if(aStepName == KTestSignal) |
|
107 testStep = new CUCCTestSignal(); |
|
108 if(aStepName == KTestRendezvous) |
|
109 testStep = new CUCCTestRendezvous(); |
|
110 if(aStepName == KTestWaitfor) |
|
111 testStep = new CUCCTestWaitfor(); |
|
112 if(aStepName == KTestEndUseCase) |
|
113 testStep = new CUCCTestEndUseCase(); |
|
114 if(aStepName == KTestGetVariableName) |
|
115 testStep = new CUCCTestGetVariableName(); |
|
116 if(aStepName == KTestSetDeviceID) |
|
117 testStep = new CUCCTestSetDeviceID(); |
|
118 if(aStepName == KTestRunCommand ) |
|
119 testStep = new CUCCTestRunCommand(); |
|
120 |
|
121 return testStep; |
|
122 } |
|
123 |