|
1 /* |
|
2 * Copyright (c) 2004-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 * for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started |
|
16 * in the process of the client. The client initialises the server by calling the |
|
17 * one and only ordinal. |
|
18 * |
|
19 */ |
|
20 |
|
21 /** |
|
22 @internalTechnology |
|
23 */ |
|
24 #include "CUsbMsTestServer.h" |
|
25 #include "CUsbMsTestStep.h" |
|
26 |
|
27 _LIT(KServerName, "te_msclasscontroller"); |
|
28 |
|
29 CUsbMsTestServer* CUsbMsTestServer::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 CUsbMsTestServer * server = new (ELeave) CUsbMsTestServer(); |
|
37 CleanupStack::PushL(server); |
|
38 // CServer base class call |
|
39 server->StartL(KServerName); |
|
40 CleanupStack::Pop(server); |
|
41 return server; |
|
42 } |
|
43 |
|
44 // EKA2 much simpler |
|
45 // Just an E32Main and a MainL() |
|
46 LOCAL_C void MainL() |
|
47 /** |
|
48 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
49 */ |
|
50 { |
|
51 // Leave the hooks in for platform security |
|
52 #if (defined __DATA_CAGING__) |
|
53 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
54 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
55 #endif |
|
56 |
|
57 CActiveScheduler* sched=NULL; |
|
58 sched=new(ELeave) CActiveScheduler; |
|
59 CActiveScheduler::Install(sched); |
|
60 CUsbMsTestServer* server = NULL; |
|
61 // Create the CTestServer derived server |
|
62 TRAPD(err,server = CUsbMsTestServer::NewL()); |
|
63 if(!err) |
|
64 { |
|
65 // Sync with the client and enter the active scheduler |
|
66 RProcess::Rendezvous(KErrNone); |
|
67 sched->Start(); |
|
68 } |
|
69 delete server; |
|
70 delete sched; |
|
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 TRAP_IGNORE(MainL()); |
|
84 delete cleanup; |
|
85 return KErrNone; |
|
86 } |
|
87 |
|
88 // Create a thread in the calling process |
|
89 // Emulator typhoon and earlier |
|
90 |
|
91 CTestStep* CUsbMsTestServer::CreateTestStep(const TDesC& aStepName) |
|
92 /** |
|
93 * @return - A CTestStep derived instance |
|
94 * Implementation of CTestServer pure virtual |
|
95 */ |
|
96 { |
|
97 CTestStep* testStep = NULL; |
|
98 |
|
99 if (aStepName == KConfigItemTest) |
|
100 { |
|
101 testStep = new CConfigItemTest(); |
|
102 } |
|
103 else if (aStepName == KReadMsConfigTest) |
|
104 { |
|
105 testStep = new CReadMsConfigTest(); |
|
106 } |
|
107 |
|
108 return testStep; |
|
109 } |
|
110 |