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