|
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_GraphicsWservAPIServer.h" |
|
19 #include "T_DataWsSession.h" |
|
20 #include "T_DataWindowGroup.h" |
|
21 #include "T_DataBlankWindow.h" |
|
22 #include "T_DataWindow.h" |
|
23 #include "T_DataBackedUpWindow.h" |
|
24 #include "T_DataWindowGc.h" |
|
25 #include "T_DataWsBitmap.h" |
|
26 #include "T_DataWsGraphicBitmap.h" |
|
27 #include "T_DataWsGraphicMsgBuf.h" |
|
28 #include "T_DataWindowInfo.h" |
|
29 #include "T_DataWsScreenDevice.h" |
|
30 #include "T_DataFbsSession.h" |
|
31 #include "T_DataFbsFont.h" |
|
32 #include "T_DataFbsBitmap.h" |
|
33 #include "T_DataBitmapUtil.h" |
|
34 #include "T_DataFbsTypefaceStore.h" |
|
35 #include "T_DataFbsColor256BitmapUtil.h" |
|
36 #include "T_DataPalette.h" |
|
37 #include "T_DataFbsBitmapDevice.h" |
|
38 #include "T_DataFbsScreenDevice.h" |
|
39 #include "T_DataAlgStyle.h" |
|
40 #include "T_DataMeasureTextInput.h" |
|
41 #include "T_DataMeasureTextOutput.h" |
|
42 #include "T_DataWsGraphicAnimation.h" |
|
43 #include "T_DataWsGraphicFrameRate.h" |
|
44 #include "T_DataWsEvent.h" |
|
45 #include "T_DataWsRedrawEvent.h" |
|
46 #include "T_DataWsPriorityKeyEvent.h" |
|
47 #include "T_DataSoundPlugIn.h" |
|
48 #include "T_DataFbsFont.h" |
|
49 #include "T_DataWsSprite.h" |
|
50 #include "T_DataWsPointerCursor.h" |
|
51 #include "T_DataDirectScreenAccess.h" |
|
52 #include "T_DataDsaSession.h" |
|
53 #include "T_DataFbsBitGc.h" |
|
54 #include "T_DataAnimDll.h" |
|
55 #include "T_DataAnim.h" |
|
56 #include "T_DataAnimForMClass.h" |
|
57 #include "T_DataWsGraphicBitmapAnimation.h" |
|
58 #include "T_DataFrame.h" |
|
59 // EPOC Includes |
|
60 #include <rsshared.h> |
|
61 |
|
62 /** |
|
63 * @enum Constant Literals used. |
|
64 */ |
|
65 /*@{*/ |
|
66 // Graphics WSERV API |
|
67 _LIT(KDataWsSession, "RWsSession"); |
|
68 _LIT(KDataWindowGroup, "RWindowGroup"); |
|
69 _LIT(KDataBlankWindow, "RBlankWindow"); |
|
70 _LIT(KDataWindow, "RWindow"); |
|
71 _LIT(KDataBackedUpWindow, "RBackedUpWindow"); |
|
72 _LIT(KDataWindowGc, "CWindowGc"); |
|
73 _LIT(KDataWsBitmap, "CWsBitmap"); |
|
74 _LIT(KDataWsGraphicBitmap, "CWsGraphicBitmap"); |
|
75 _LIT(KDataWsGraphicMsgBuf, "RWsGraphicMsgBuf"); |
|
76 _LIT(KDataWsEvent, "TWsEvent"); |
|
77 _LIT(KDataWsPriorityKeyEvent, "TWsPriorityKeyEvent"); |
|
78 _LIT(KDataWsRedrawEvent, "TWsRedrawEvent"); |
|
79 _LIT(KDataWindowInfo, "TWindowInfo"); |
|
80 _LIT(KDataWsScreenDevice, "CWsScreenDevice"); |
|
81 _LIT(KDataWsGraphicAnimation, "TWsGraphicAnimation"); |
|
82 _LIT(KDataWsGraphicFrameRate, "TWsGraphicFrameRate"); |
|
83 _LIT(KDataSoundPlugIn, "RSoundPlugIn"); |
|
84 _LIT(KDataFbsFont, "CFbsFont"); |
|
85 _LIT(KDataWsSprite, "RWsSprite"); |
|
86 _LIT(KDataWsPointerCursor, "RWsPointerCursor"); |
|
87 _LIT(KDataCDirectScreenAccess, "CDirectScreenAccess"); |
|
88 _LIT(KDataRDirectScreenAccess, "RDirectScreenAccess"); |
|
89 _LIT(KDataFbsBitGc, "CFbsBitGc"); |
|
90 _LIT(KDataAnimDll, "RAnimDll"); |
|
91 _LIT(KDataAnim, "RAnim"); |
|
92 _LIT(KDataAnimForMClass, "RAnimForMClass"); |
|
93 _LIT(KDataWsGraphicBitmapAnimation, "CWsGraphicBitmapAnimation"); |
|
94 _LIT(KDataFrame, "CFrame"); |
|
95 //from T_FBServAPI |
|
96 _LIT(KRFbsSessionData, "RFbsSession"); |
|
97 _LIT(KCFbsFontData, "CFbsFont"); |
|
98 _LIT(KCFbsBitmapData, "CFbsBitmap"); |
|
99 _LIT(KTBitmapUtilData, "TBitmapUtil"); |
|
100 _LIT(KCFbsTypefaceStoreData, "CFbsTypefaceStore"); |
|
101 _LIT(KCFbsColor256BitmapUtil, "CFbsColor256BitmapUtil"); |
|
102 _LIT(KCPalette, "CPalette"); |
|
103 _LIT(KCFbsBitmapDevice, "CFbsBitmapDevice"); |
|
104 _LIT(KCFbsScreenDevice, "CFbsScreenDevice"); |
|
105 _LIT(KTAlgStyle, "TAlgStyle"); |
|
106 _LIT(KTMeasureTextInput, "TMeasureTextInput"); |
|
107 _LIT(KTMeasureTextOutput, "TMeasureTextOutput"); |
|
108 /*@}*/ |
|
109 |
|
110 |
|
111 inline CDataWrapper* CT_GraphicsWservAPIServer::CT_GraphicsWservAPIBlock::CreateDataL( const TDesC& aData ) |
|
112 { |
|
113 CDataWrapper* wrapper = NULL; |
|
114 |
|
115 if ( aData==KDataWsSession ) |
|
116 { |
|
117 wrapper=CT_DataWsSession::NewL(); |
|
118 } |
|
119 else if ( aData==KDataWindowGroup ) |
|
120 { |
|
121 wrapper=CT_DataWindowGroup::NewL(); |
|
122 } |
|
123 else if ( aData==KDataBlankWindow ) |
|
124 { |
|
125 wrapper=CT_DataBlankWindow::NewL(); |
|
126 } |
|
127 if ( aData==KDataWindow ) |
|
128 { |
|
129 wrapper=CT_DataWindow::NewL(); |
|
130 } |
|
131 else if ( aData==KDataBackedUpWindow ) |
|
132 { |
|
133 wrapper=CT_DataBackedUpWindow::NewL(); |
|
134 } |
|
135 else if ( aData==KDataWindowGc ) |
|
136 { |
|
137 wrapper=CT_DataWindowGc::NewL(); |
|
138 } |
|
139 else if ( aData==KDataWsBitmap ) |
|
140 { |
|
141 wrapper=CT_DataWsBitmap::NewL(); |
|
142 } |
|
143 else if ( aData==KDataWsGraphicBitmap ) |
|
144 { |
|
145 wrapper=CT_DataWsGraphicBitmap::NewL(); |
|
146 } |
|
147 else if ( aData==KDataWsGraphicMsgBuf ) |
|
148 { |
|
149 wrapper=CT_DataWsGraphicMsgBuf::NewL(); |
|
150 } |
|
151 else if ( aData==KDataWsEvent ) |
|
152 { |
|
153 wrapper=CT_DataWsEvent::NewL(); |
|
154 } |
|
155 else if ( aData==KDataWsPriorityKeyEvent ) |
|
156 { |
|
157 wrapper=CT_DataWsPriorityKeyEvent::NewL(); |
|
158 } |
|
159 else if ( aData==KDataWsRedrawEvent ) |
|
160 { |
|
161 wrapper=CT_DataWsRedrawEvent::NewL(); |
|
162 } |
|
163 else if ( aData==KDataWindowInfo ) |
|
164 { |
|
165 wrapper=CT_DataWindowInfo::NewL(); |
|
166 } |
|
167 else if ( aData==KDataWsScreenDevice ) |
|
168 { |
|
169 wrapper=CT_DataWsScreenDevice::NewL(); |
|
170 } |
|
171 else if( aData == KDataSoundPlugIn) |
|
172 { |
|
173 wrapper = CT_DataSoundPlugIn::NewL(); |
|
174 } |
|
175 else if (aData==KDataCDirectScreenAccess) |
|
176 { |
|
177 wrapper=CT_DataDirectScreenAccess::NewL(); |
|
178 } |
|
179 else if (aData==KDataRDirectScreenAccess) |
|
180 { |
|
181 wrapper=CT_DataDsaSession::NewL(); |
|
182 } |
|
183 // from T_FBServAPI |
|
184 else if (aData == KRFbsSessionData) |
|
185 { |
|
186 wrapper=CT_DataFbsSession::NewL(); |
|
187 } |
|
188 else if (aData == KCFbsFontData) |
|
189 { |
|
190 wrapper=CT_DataFbsFont::NewL(); |
|
191 } |
|
192 else if (aData == KCFbsBitmapData) |
|
193 { |
|
194 wrapper=CT_DataFbsBitmap::NewL(); |
|
195 } |
|
196 else if (aData == KTBitmapUtilData) |
|
197 { |
|
198 wrapper=CT_DataBitmapUtil::NewL(); |
|
199 } |
|
200 else if (aData == KCFbsTypefaceStoreData) |
|
201 { |
|
202 wrapper=CT_DataFbsTypefaceStore::NewL(); |
|
203 } |
|
204 else if (aData == KCFbsColor256BitmapUtil) |
|
205 { |
|
206 wrapper=CT_DataFbsColor256BitmapUtil::NewL(); |
|
207 } |
|
208 else if (aData == KCPalette) |
|
209 { |
|
210 wrapper=CT_DataPalette::NewL(); |
|
211 } |
|
212 else if ( aData==KCFbsBitmapDevice ) |
|
213 { |
|
214 wrapper=CT_DataFbsBitmapDevice::NewL(); |
|
215 } |
|
216 else if ( aData==KCFbsScreenDevice ) |
|
217 { |
|
218 wrapper=CT_DataFbsScreenDevice::NewL(); |
|
219 } |
|
220 else if ( aData==KTAlgStyle ) |
|
221 { |
|
222 wrapper=CT_DataAlgStyle::NewL(); |
|
223 } |
|
224 else if ( aData==KTMeasureTextInput ) |
|
225 { |
|
226 wrapper=CT_DataMeasureTextInput::NewL(); |
|
227 } |
|
228 else if ( aData==KTMeasureTextOutput ) |
|
229 { |
|
230 wrapper=CT_DataMeasureTextOutput::NewL(); |
|
231 } |
|
232 else if ( aData==KDataWsGraphicAnimation ) |
|
233 { |
|
234 wrapper=new (ELeave) CT_DataWsGraphicAnimation(); |
|
235 } |
|
236 else if ( aData==KDataWsGraphicFrameRate ) |
|
237 { |
|
238 wrapper=new (ELeave) CT_DataWsGraphicFrameRate(); |
|
239 } |
|
240 else if (aData==KDataFbsFont) |
|
241 { |
|
242 wrapper=CT_DataFbsFont::NewL(); |
|
243 } |
|
244 //for RWsSprite |
|
245 else if (aData==KDataWsSprite) |
|
246 { |
|
247 wrapper= CT_DataWsSprite::NewL(); |
|
248 } |
|
249 //for RWsPointerCursor |
|
250 else if (aData==KDataWsPointerCursor) |
|
251 { |
|
252 wrapper=CT_DataWsPointerCursor::NewL(); |
|
253 } |
|
254 else if (aData == KDataFbsBitGc) |
|
255 { |
|
256 wrapper=CT_DataFbsBitGc::NewL(); |
|
257 } |
|
258 else if( aData == KDataAnimDll) |
|
259 { |
|
260 wrapper = CT_DataAnimDll::NewL(); |
|
261 } |
|
262 else if( aData == KDataAnim) |
|
263 { |
|
264 wrapper = CT_DataAnim::NewL(); |
|
265 } |
|
266 else if(aData==KDataAnimForMClass) |
|
267 { |
|
268 wrapper=CT_DataAnimForMClass::NewL(); |
|
269 } |
|
270 else if( aData == KDataWsGraphicBitmapAnimation) |
|
271 { |
|
272 wrapper = CT_DataWsGraphicBitmapAnimation::NewL(); |
|
273 } |
|
274 else if( aData == KDataFrame) |
|
275 { |
|
276 wrapper = CT_DataFrame::NewL(); |
|
277 } |
|
278 return wrapper; |
|
279 } |
|
280 |
|
281 CT_GraphicsWservAPIServer* CT_GraphicsWservAPIServer::NewL() |
|
282 /** |
|
283 * @return - Instance of the test server |
|
284 * Same code for Secure and non-secure variants |
|
285 * Called inside the MainL() function to create and start the |
|
286 * CTestServer derived server. |
|
287 */ |
|
288 { |
|
289 CT_GraphicsWservAPIServer* server = new (ELeave) CT_GraphicsWservAPIServer(); |
|
290 CleanupStack::PushL(server); |
|
291 // CServer base class call |
|
292 //RProcess handle = RProcess(); |
|
293 //TParsePtrC serverName(handle.FileName()); |
|
294 server->ConstructL(); /*Parsing the server name from the file name*/ |
|
295 CleanupStack::Pop(server); |
|
296 return server; |
|
297 } |
|
298 |
|
299 |
|
300 TInt LoadDrivers() |
|
301 { |
|
302 #ifdef __WINS__ |
|
303 #define KPDDName _L("ECDRV") |
|
304 #define KLDDName _L("ECOMM") |
|
305 #else |
|
306 #define KPDDName _L("EUART1") |
|
307 #define KLDDName _L("ECOMM") |
|
308 #endif |
|
309 TInt rerr = KErrNone; |
|
310 |
|
311 rerr = StartC32(); |
|
312 if( rerr!=KErrNone && rerr!=KErrAlreadyExists ) |
|
313 { |
|
314 return rerr; |
|
315 } |
|
316 |
|
317 rerr = User::LoadPhysicalDevice(KPDDName); |
|
318 if(rerr != KErrNone && rerr != KErrAlreadyExists) |
|
319 { |
|
320 return rerr; |
|
321 } |
|
322 rerr = User::LoadLogicalDevice(KLDDName); |
|
323 if(rerr != KErrNone && rerr != KErrAlreadyExists) |
|
324 { |
|
325 return rerr; |
|
326 } |
|
327 return KErrNone; |
|
328 } |
|
329 |
|
330 LOCAL_C void MainL() |
|
331 /** |
|
332 * Secure variant |
|
333 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
334 */ |
|
335 { |
|
336 #if (defined __DATA_CAGING__) |
|
337 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
338 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
339 #endif |
|
340 CActiveScheduler* sched=NULL; |
|
341 sched=new(ELeave) CActiveScheduler; |
|
342 CActiveScheduler::Install(sched); |
|
343 CT_GraphicsWservAPIServer* server = NULL; |
|
344 // Create the CTestServer derived server |
|
345 TRAPD(err,server = CT_GraphicsWservAPIServer::NewL()); |
|
346 if(!err) |
|
347 { |
|
348 // Sync with the client and enter the active scheduler |
|
349 RProcess::Rendezvous(KErrNone); |
|
350 sched->Start(); |
|
351 } |
|
352 delete server; |
|
353 delete sched; |
|
354 } |
|
355 |
|
356 GLDEF_C TInt E32Main() |
|
357 /** |
|
358 * @return - Standard Epoc error code on process exit |
|
359 * Secure variant only |
|
360 * Process entry point. Called by client using RProcess API |
|
361 */ |
|
362 { |
|
363 TInt rerr = LoadDrivers(); |
|
364 if( rerr != KErrNone ) |
|
365 { |
|
366 return rerr; |
|
367 } |
|
368 |
|
369 __UHEAP_MARK; |
|
370 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
371 if(cleanup == NULL) |
|
372 { |
|
373 return KErrNoMemory; |
|
374 } |
|
375 #if (defined TRAP_IGNORE) |
|
376 TRAP_IGNORE(MainL()); |
|
377 #else |
|
378 TRAPD(err,MainL()); |
|
379 #endif |
|
380 delete cleanup; |
|
381 __UHEAP_MARKEND; |
|
382 return KErrNone; |
|
383 } |