|
1 // Copyright (c) 2006-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 // Name : tselectserver.cpp |
|
15 // |
|
16 |
|
17 #include <c32comm.h> |
|
18 |
|
19 #if defined (__WINS__) |
|
20 #define PDD_NAME _L("ECDRV") |
|
21 #else |
|
22 #define PDD_NAME _L("EUART1") |
|
23 #define PDD2_NAME _L("EUART2") |
|
24 #define PDD3_NAME _L("EUART3") |
|
25 #define PDD4_NAME _L("EUART4") |
|
26 #endif |
|
27 |
|
28 #define LDD_NAME _L("ECOMM") |
|
29 |
|
30 /** |
|
31 * @file |
|
32 * |
|
33 * Pipe test server implementation |
|
34 */ |
|
35 #include "taeselectserver.h" |
|
36 #include "taeselect.h" |
|
37 |
|
38 |
|
39 _LIT(KServerName, "taeselect"); |
|
40 |
|
41 CAESelectTestServer* CAESelectTestServer::NewL() |
|
42 { |
|
43 CAESelectTestServer *server = new(ELeave) CAESelectTestServer(); |
|
44 CleanupStack::PushL(server); |
|
45 server->ConstructL(KServerName); |
|
46 CleanupStack::Pop(server); |
|
47 return server; |
|
48 } |
|
49 |
|
50 static void InitCommsL() |
|
51 { |
|
52 TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
|
53 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
54 |
|
55 #ifndef __WINS__ |
|
56 ret = User::LoadPhysicalDevice(PDD2_NAME); |
|
57 ret = User::LoadPhysicalDevice(PDD3_NAME); |
|
58 ret = User::LoadPhysicalDevice(PDD4_NAME); |
|
59 #endif |
|
60 |
|
61 ret = User::LoadLogicalDevice(LDD_NAME); |
|
62 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
63 ret = StartC32(); |
|
64 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
65 } |
|
66 |
|
67 LOCAL_C void MainL() |
|
68 { |
|
69 // Leave the hooks in for platform security |
|
70 #if (defined __DATA_CAGING__) |
|
71 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
72 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
73 #endif |
|
74 InitCommsL(); |
|
75 |
|
76 CActiveScheduler* sched=NULL; |
|
77 sched=new(ELeave) CActiveScheduler; |
|
78 CActiveScheduler::Install(sched); |
|
79 CAESelectTestServer* server = NULL; |
|
80 // Create the CTestServer derived server |
|
81 TRAPD(err, server = CAESelectTestServer::NewL()); |
|
82 if(!err) |
|
83 { |
|
84 // Sync with the client and enter the active scheduler |
|
85 RProcess::Rendezvous(KErrNone); |
|
86 sched->Start(); |
|
87 } |
|
88 delete server; |
|
89 delete sched; |
|
90 } |
|
91 |
|
92 /** |
|
93 * Server entry point |
|
94 * @return Standard Epoc error code on exit |
|
95 */ |
|
96 TInt main() |
|
97 { |
|
98 __UHEAP_MARK; |
|
99 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
100 if(cleanup == NULL) |
|
101 { |
|
102 return KErrNoMemory; |
|
103 } |
|
104 TRAP_IGNORE(MainL()); |
|
105 delete cleanup; |
|
106 __UHEAP_MARKEND; |
|
107 |
|
108 return KErrNone; |
|
109 } |
|
110 |
|
111 CTestStep* CAESelectTestServer::CreateTestStep(const TDesC& aStepName) |
|
112 { |
|
113 CTestStep* testStep = NULL; |
|
114 // This server creates just one step but create as many as you want |
|
115 // They are created "just in time" when the worker thread is created |
|
116 // install steps |
|
117 if(aStepName == KTestTimeout ) |
|
118 { |
|
119 testStep = new CTestAESelect(aStepName); |
|
120 } |
|
121 else if(aStepName == KTestASelect ) |
|
122 { |
|
123 testStep = new CTestAESelect(aStepName); |
|
124 } |
|
125 else if(aStepName == KTestCancelASelect) |
|
126 { |
|
127 testStep = new CTestAESelect(aStepName); |
|
128 } |
|
129 else if(aStepName == KTestAselectRequestStatus) |
|
130 { |
|
131 testStep = new CTestAESelect(aStepName); |
|
132 } |
|
133 else if(aStepName == KTestMultipleASelect) |
|
134 { |
|
135 testStep = new CTestAESelect(aStepName); |
|
136 } |
|
137 else if(aStepName == KTestSelectwithEselect ) |
|
138 { |
|
139 testStep = new CTestAESelect(aStepName); |
|
140 } |
|
141 else if(aStepName == KTestESelect ) |
|
142 { |
|
143 testStep = new CTestAESelect(aStepName); |
|
144 } |
|
145 else if(aStepName == KTestEselectRequestStatus ) |
|
146 { |
|
147 testStep = new CTestAESelect(aStepName); |
|
148 } |
|
149 else if(aStepName == KTestESelectTimeout ) |
|
150 { |
|
151 testStep = new CTestAESelect(aStepName); |
|
152 } |
|
153 else if(aStepName == KTestEselectInvalidInput_01 ) |
|
154 { |
|
155 testStep = new CTestAESelect(aStepName); |
|
156 } |
|
157 else if(aStepName == KTestEselectInvalidInput_02 ) |
|
158 { |
|
159 testStep = new CTestAESelect(aStepName); |
|
160 } |
|
161 return testStep; |
|
162 } |
|
163 |