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 #include "testserversymbianexcludeusb.h" |
|
19 #include <e32std.h> |
|
20 #include <rsshared.h> |
|
21 |
|
22 // Put all of the test step header files here... |
|
23 #include "cteststepusbromconfig001.h" |
|
24 #include "cteststepusbromconfig002.h" |
|
25 #include "cteststepusbromconfig003.h" |
|
26 #include "cteststepusbromconfig004.h" |
|
27 |
|
28 _LIT(KServerName,"TestServerSymbianExcludeUsb"); |
|
29 |
|
30 TInt LoadDrivers() |
|
31 { |
|
32 #ifdef __WINS__ |
|
33 #define KPDDName _L("ECDRV") |
|
34 #define KLDDName _L("ECOMM") |
|
35 #else |
|
36 #define KPDDName _L("EUART1") |
|
37 #define KLDDName _L("ECOMM") |
|
38 #endif |
|
39 TInt rerr = KErrNone; |
|
40 |
|
41 rerr = StartC32(); |
|
42 if ( rerr!=KErrNone && rerr!=KErrAlreadyExists ) |
|
43 { |
|
44 return rerr; |
|
45 } |
|
46 |
|
47 rerr = User::LoadPhysicalDevice(KPDDName); |
|
48 if (rerr != KErrNone && rerr != KErrAlreadyExists) |
|
49 { |
|
50 return rerr; |
|
51 } |
|
52 |
|
53 rerr = User::LoadLogicalDevice(KLDDName); |
|
54 if (rerr != KErrNone && rerr != KErrAlreadyExists) |
|
55 { |
|
56 return rerr; |
|
57 } |
|
58 return KErrNone; |
|
59 } |
|
60 |
|
61 |
|
62 /** |
|
63 Called inside the MainL() function to create and start the test |
|
64 @return Instance of the test server |
|
65 */ |
|
66 CTestServerSymbianExcludeUsb* CTestServerSymbianExcludeUsb::NewL() |
|
67 |
|
68 { |
|
69 CTestServerSymbianExcludeUsb* server = new (ELeave) CTestServerSymbianExcludeUsb; |
|
70 CleanupStack::PushL(server); |
|
71 server->ConstructL(KServerName); |
|
72 CleanupStack::Pop(server); |
|
73 return server; |
|
74 } |
|
75 |
|
76 LOCAL_C void MainL() |
|
77 { |
|
78 CActiveScheduler* sched = new (ELeave) CActiveScheduler; |
|
79 CleanupStack::PushL(sched); |
|
80 CActiveScheduler::Install(sched); |
|
81 |
|
82 // this registers the server with the active scheduler and calls SetActive |
|
83 CTestServerSymbianExcludeUsb* server = CTestServerSymbianExcludeUsb::NewL(); |
|
84 |
|
85 // signal to the client that we are ready by |
|
86 // rendevousing process |
|
87 RProcess::Rendezvous(KErrNone); |
|
88 |
|
89 // run the active scheduler |
|
90 sched->Start(); |
|
91 |
|
92 // clean up |
|
93 delete server; |
|
94 CleanupStack::PopAndDestroy(sched); |
|
95 } |
|
96 |
|
97 /** |
|
98 @return Standard Epoc error code on exit |
|
99 */ |
|
100 GLDEF_C TInt E32Main() |
|
101 { |
|
102 TInt rerr = LoadDrivers(); |
|
103 if (rerr!=KErrNone) |
|
104 { |
|
105 return rerr; |
|
106 } |
|
107 |
|
108 __UHEAP_MARK; |
|
109 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
110 |
|
111 if (cleanup == NULL) |
|
112 { |
|
113 return KErrNoMemory; |
|
114 } |
|
115 |
|
116 TRAPD(err,MainL()); |
|
117 |
|
118 delete cleanup; |
|
119 __UHEAP_MARKEND; |
|
120 return err; |
|
121 } |
|
122 |
|
123 /** |
|
124 Implementation of CTestServer pure virtual |
|
125 @return A CTestStep derived instance |
|
126 */ |
|
127 CTestStep* CTestServerSymbianExcludeUsb::CreateTestStep(const TDesC& aStepName) |
|
128 { |
|
129 if ( aStepName==KTestName001 ) |
|
130 { |
|
131 return CTestStepUsbRomConfig001::New(*this); |
|
132 } |
|
133 if ( aStepName==KTestName002 ) |
|
134 { |
|
135 return CTestStepUsbRomConfig002::New(*this); |
|
136 } |
|
137 if ( aStepName==KTestName003 ) |
|
138 { |
|
139 return CTestStepUsbRomConfig003::New(*this); |
|
140 } |
|
141 if ( aStepName==KTestName004 ) |
|
142 { |
|
143 return CTestStepUsbRomConfig004::New(*this); |
|
144 } |
|
145 return NULL; |
|
146 } |
|
147 |
|
148 // EOF |
|