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