|
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 "T_DigitiserDriverServer.h" |
|
19 #include "T_DigitiserDriverData.h" |
|
20 #include "T_RConsoleData.h" |
|
21 |
|
22 |
|
23 /*@{*/ |
|
24 _LIT(KT_DigitserDriverData, "HalData"); |
|
25 _LIT(KT_RConsoleDigitiser, "RConsole"); |
|
26 |
|
27 /*@}*/ |
|
28 |
|
29 CT_DigitiserDriverServer* CT_DigitiserDriverServer::NewL() |
|
30 /** |
|
31 * @return - Instance of the test server |
|
32 * Same code for Secure and non-secure variants |
|
33 * Called inside the MainL() function to create and start the |
|
34 * CTestServer derived server. |
|
35 */ |
|
36 { |
|
37 CT_DigitiserDriverServer* server = new (ELeave) CT_DigitiserDriverServer(); |
|
38 CleanupStack::PushL(server); |
|
39 server->ConstructL(); |
|
40 CleanupStack::Pop(server); |
|
41 return server; |
|
42 } |
|
43 |
|
44 |
|
45 |
|
46 LOCAL_C void MainL() |
|
47 /** |
|
48 * Secure variant |
|
49 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
50 */ |
|
51 { |
|
52 // Leave the hooks in for platform security |
|
53 #if (defined __DATA_CAGING__) |
|
54 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
55 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
56 #endif |
|
57 CActiveScheduler* sched=NULL; |
|
58 sched=new(ELeave) CActiveScheduler; |
|
59 //Install me as current ActiveScheduler |
|
60 CActiveScheduler::Install(sched); |
|
61 CT_DigitiserDriverServer* server = NULL; |
|
62 // Create CT_DigitiserDriverServer(the CTestServer derived server) |
|
63 TRAPD(err,server = CT_DigitiserDriverServer::NewL()); |
|
64 if(!err) |
|
65 { |
|
66 // Sync with the client and enter the active scheduler |
|
67 RProcess::Rendezvous(KErrNone); |
|
68 sched->Start(); |
|
69 } |
|
70 |
|
71 delete server; |
|
72 delete sched; |
|
73 } |
|
74 |
|
75 |
|
76 GLDEF_C TInt E32Main() |
|
77 /** |
|
78 * @return - Standard Epoc error code on process exit |
|
79 * Secure variant only |
|
80 * Process entry point. Called by client using RProcess API |
|
81 */ |
|
82 { |
|
83 __UHEAP_MARK; |
|
84 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
85 if(cleanup == NULL) |
|
86 { |
|
87 return KErrNoMemory; |
|
88 } |
|
89 |
|
90 #if (defined TRAP_IGNORE) |
|
91 TRAP_IGNORE(MainL()); |
|
92 #else |
|
93 TRAPD(err,MainL()); |
|
94 #endif |
|
95 |
|
96 delete cleanup; |
|
97 __UHEAP_MARKEND; |
|
98 return KErrNone; |
|
99 } |
|
100 |
|
101 |
|
102 CDataWrapper* CT_DigitiserDriverServer::CT_DigitiserDriverBlock::CreateDataL(const TDesC& aData) |
|
103 /** |
|
104 * @return - A CDataWrapper derived instance |
|
105 */ |
|
106 { |
|
107 CDataWrapper* wrapper=NULL; |
|
108 |
|
109 if( aData==KT_DigitserDriverData() ) |
|
110 { |
|
111 wrapper=CT_DigitiserDriverData::NewL(); |
|
112 } |
|
113 else if ( aData==KT_RConsoleDigitiser() ) |
|
114 { |
|
115 wrapper=CT_RConsoleData::NewL(); |
|
116 } |
|
117 |
|
118 return wrapper; |
|
119 } |