|
1 // Copyright (c) 1997-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 // The Implementation of the REComSession singleton class which |
|
15 // maintains the connection to ECom framework services. |
|
16 // Include Files |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @internalComponent |
|
22 @file |
|
23 */ |
|
24 |
|
25 #include <s32mem.h> |
|
26 #include "EComDebug.h" |
|
27 #include <ecom/ecom.h> |
|
28 #include "LoadManager.h" |
|
29 #include "TlsData.h" |
|
30 #include "EComServerStart.h" |
|
31 #include "EComMessageIds.h" |
|
32 |
|
33 //patchable constant defining the default size of buffer used during ListImplementations |
|
34 #include "EComPatchData.h" |
|
35 #include "EComUidCodes.h" |
|
36 |
|
37 // |
|
38 // Forward declarations |
|
39 |
|
40 // |
|
41 // Global Constants |
|
42 |
|
43 // The maximum number of attempts the client should make to |
|
44 // start up the server. |
|
45 const TInt KMaxStartAttempts = 2; |
|
46 // The buffer for passing the extended interface list. Each extended interface |
|
47 // takes up 4 bytes. Currently the maximum extended interface is 8. By setting to the maximum, |
|
48 // the KErrOverFlow should not happen during the request of ListExtendedInterfacesL. |
|
49 const TInt KListExtendedInterfaceBufferSize = 32; |
|
50 |
|
51 // |
|
52 // Functions & Methods |
|
53 static void CleanupFinalClose(TAny* /*aPtr*/) |
|
54 { |
|
55 REComSession::FinalClose(); |
|
56 } |
|
57 |
|
58 static void ResetAndDestroyArray(TAny* aPtr) |
|
59 { |
|
60 (static_cast<RImplInfoPtrArray*>(aPtr))->ResetAndDestroy(); |
|
61 } |
|
62 |
|
63 static void ResetArray(TAny* aPtr) |
|
64 { |
|
65 (static_cast<RExtendedInterfacesArray*>(aPtr))->Reset(); |
|
66 } |
|
67 |
|
68 // Start the server process/thread which lives in an EPOCEXE object |
|
69 // |
|
70 static TInt StartServer() |
|
71 { |
|
72 const TUidType serverUid(KNullUid,KNullUid,KEComServerUid3); |
|
73 |
|
74 // |
|
75 // |
|
76 // EPOC is easy, we just create a new server process. Simultaneous launching |
|
77 // of two such processes should be detected when the second one attempts to |
|
78 // create the server object, failing with KErrAlreadyExists. |
|
79 // |
|
80 RProcess server; |
|
81 TInt error = server.Create(KEComServerImg,KNullDesC,serverUid); |
|
82 |
|
83 if (error != KErrNone) |
|
84 { |
|
85 return error; |
|
86 } |
|
87 |
|
88 TRequestStatus stat; |
|
89 server.Rendezvous(stat); |
|
90 if (stat!=KRequestPending) |
|
91 server.Kill(0); // abort startup |
|
92 else |
|
93 server.Resume(); // logon OK - start the server |
|
94 User::WaitForRequest(stat); // wait for start or death |
|
95 // we can't use the 'exit reason' if the server panicked as this |
|
96 // is the panic 'reason' and may be '0' which cannot be distinguished |
|
97 // from KErrNone |
|
98 error=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); |
|
99 server.Close(); |
|
100 return error; |
|
101 } |
|
102 |
|
103 EXPORT_C REComSession::REComSession() : |
|
104 iReserved1(0), |
|
105 iReserved2(0) |
|
106 { |
|
107 } |
|
108 |
|
109 /** |
|
110 This method returns a reference to the singleton client/server session object |
|
111 maintained by the ECOM client library, referenced counted. If it does |
|
112 not exist it is initialised and then returned. Clients should store the handle |
|
113 returned by refernce or by pointer. Storage by value is highly discouraged. |
|
114 |
|
115 It is only necessary to use the Open()/Close() API directly if you need access |
|
116 to the notification methods. Access to the static API does not require these |
|
117 to be used. Please remeber each call to Open() must have an equivalent Close(). |
|
118 |
|
119 @return Reference to the open singleton session |
|
120 @leave KErrNoMemory |
|
121 @leave One of the system-wide error codes |
|
122 @post REComSession is connected and ready to issue ECOM requests. |
|
123 */ |
|
124 EXPORT_C REComSession& REComSession::OpenL() |
|
125 { |
|
126 //CGlobalData::NewL() will create just one CGlobalData instance. |
|
127 //Every next CGlobalData::NewL() call will return a pointer to the already created |
|
128 //CGlobalData instance. |
|
129 CGlobalData* globalData = CGlobalData::NewL(); |
|
130 globalData->IncRefCnt(); |
|
131 return globalData->EComSession(); |
|
132 } |
|
133 |
|
134 /** |
|
135 This method returns a reference to the singleton client/server session object |
|
136 maintained by the ECOM client library, referenced counted. If it does |
|
137 not exist it is initialised and then returned. |
|
138 |
|
139 @return Reference to the open singleton session which is on the cleanupstack |
|
140 @leave KErrNoMemory |
|
141 @leave One of the system-wide error codes |
|
142 @post REComSession is connected and ready to issue ECOM requests. |
|
143 */ |
|
144 REComSession& REComSession::OpenLC() |
|
145 { |
|
146 REComSession& ecomSession = REComSession::OpenL(); |
|
147 CleanupClosePushL(ecomSession); |
|
148 return ecomSession; |
|
149 } |
|
150 |
|
151 /** |
|
152 Initialisation phase of two phase construction. |
|
153 |
|
154 @leave One of the system-wide error codes |
|
155 @post REComSession is fully initialised. |
|
156 */ |
|
157 void REComSession::ConstructL() |
|
158 { |
|
159 // Now connect to the ECom server |
|
160 TInt retry=KMaxStartAttempts; |
|
161 for (;;) |
|
162 { |
|
163 // create session with unlimited message slots due to notification API being asynchronous |
|
164 TInt error = CreateSession(KEComServerName,TVersion(KEComServerMajorVN,KEComServerMinorVN,KEComServerBuildVN),-1); |
|
165 if(error == KErrNone) |
|
166 { |
|
167 return; // Success |
|
168 } |
|
169 else if (error != KErrNotFound && error != KErrServerTerminated) |
|
170 User::Leave(error); |
|
171 if (--retry==0) |
|
172 User::Leave(error); |
|
173 error = StartServer(); |
|
174 if (error != KErrNone && error != KErrAlreadyExists) |
|
175 User::Leave(error); |
|
176 } |
|
177 } |
|
178 |
|
179 /** |
|
180 Closes the open handle on the ECOM framework. |
|
181 Reference count is decremented and the ECOM client/server session is closed. |
|
182 |
|
183 @pre REComSession must have been opened. |
|
184 @post REComSession reference count is decremented, server session closed |
|
185 */ |
|
186 EXPORT_C void REComSession::Close() |
|
187 { |
|
188 // Switch close protection flag |
|
189 |
|
190 CGlobalData* globalData = CGlobalData::Instance(); |
|
191 if(globalData) |
|
192 { |
|
193 //Decrement the reference count. Do not destroy the object. It will be used in FinalClose(). |
|
194 globalData->DecRefCnt(); |
|
195 } |
|
196 else |
|
197 { |
|
198 ReallyClose(); |
|
199 } |
|
200 } |
|
201 |
|
202 /** |
|
203 The method will close the ECOM session connection. |
|
204 @pre REComSession must have been opened |
|
205 @post The session is closed |
|
206 */ |
|
207 void REComSession::ReallyClose() |
|
208 { |
|
209 // Now disconnect from the ECom server |
|
210 RSessionBase::Close(); |
|
211 } |
|
212 |
|
213 /** |
|
214 This method is used in processes that have utilised the ECOM framework, it |
|
215 does nothing if the ECOM framework has not been initialised. Its main purpose |
|
216 is to release memory and close handles held on unused plug-in implementations |
|
217 and their associated DLLs. If is found (through reference counting) that the |
|
218 ECOM framework is no longer in use in the calling thread the session to the |
|
219 ECOM's server is also closed. |
|
220 |
|
221 This method is called by direct users of the ECOM framework wherever possible |
|
222 (e.g. library, server or test code). It is safe to call it at any time outside |
|
223 of plug-in code as the user's scenario dictates. This maybe during a test case |
|
224 or just before process termination. |
|
225 |
|
226 Note: It must never be called from within a plug-in implementations class |
|
227 destructor, especially following a DestroyImplementation() as there is a risk |
|
228 that the plug-in's supporting DLL may immediately be unloaded by the Kernel due |
|
229 to the closure of RLibrary handles. It can result in a KERN-EXEC if the |
|
230 destructor call stack is still inside the DLL that is unloaded. |
|
231 |
|
232 Note: Processes that utilise the ECOM framework that do not use this call |
|
233 are at risk of a UHEAP_MARKEND generated panic in debug builds. |
|
234 */ |
|
235 EXPORT_C void REComSession::FinalClose() |
|
236 { |
|
237 CGlobalData* globalData = CGlobalData::Instance(); |
|
238 if(globalData) |
|
239 { |
|
240 // Clear out any garbage unload policies that may exist in the LoadManager. |
|
241 globalData->LoadManager().ClearGarbage(); |
|
242 // With ref count greater than 0 indicates there is still open session |
|
243 // within this thread, otherwise clean up |
|
244 if(globalData->RefCnt() <= 0) |
|
245 { |
|
246 __ASSERT_DEBUG(globalData->LoadManager().PolicyArraysEmpty(), User::Invariant()); |
|
247 delete globalData; |
|
248 } |
|
249 } |
|
250 } |
|
251 |
|
252 /** |
|
253 Registers for notification messages when the underlying ECOM registration |
|
254 data changes. |
|
255 The client must not call this api again until their request is Completed |
|
256 as this could result in a 'stray signal'. |
|
257 This api should be placed first in the RunL of an Active Object otherwise |
|
258 changes could be lost. |
|
259 RunError should be implemented to cater for any Leaves. |
|
260 For example, it could retry after a second if the ECom server is busy rebuilding its |
|
261 indexes. |
|
262 CancelNotifyOnChange should be called to cancel this request and should NOT be |
|
263 part of the RunL. |
|
264 |
|
265 @param aStatus A request status object to complete for notification signalling. |
|
266 @pre REComSession must have been opened. |
|
267 @post The caller is registered for receipt of notifications |
|
268 if the server's registry data changes. |
|
269 */ |
|
270 EXPORT_C void REComSession::NotifyOnChange(TRequestStatus& aStatus) |
|
271 { |
|
272 aStatus=KRequestPending; |
|
273 SendReceive(ENotifyOnChange,TIpcArgs(&aStatus), aStatus); |
|
274 } |
|
275 |
|
276 /** |
|
277 De-registers for notification messages. |
|
278 @param aStatus The request status object originally passed |
|
279 to NotifyOnChange() for notification signalling. |
|
280 @pre REComSession must have been opened. |
|
281 @post The caller's registeration for reciept of notifications |
|
282 of registry data changes has been cancelled. |
|
283 */ |
|
284 EXPORT_C void REComSession::CancelNotifyOnChange(TRequestStatus& aStatus) |
|
285 { |
|
286 if (aStatus!=KRequestPending) |
|
287 return; |
|
288 |
|
289 SendReceive(ECancelNotifyOnChange,TIpcArgs(&aStatus)); |
|
290 } |
|
291 |
|
292 // ___________________________________________________________________________ |
|
293 // Message passing methods |
|
294 |
|
295 //ListImplementationsL - LI1 |
|
296 /** |
|
297 Retrieves a list of all the implementations which satisfy the specified interface. |
|
298 The aImplInfoArray on exit contains the plug-in implementations who's plug-in |
|
299 DLLs have sufficient capabilities to be loaded by the calling client process. |
|
300 @leave KErrNoMemory |
|
301 @leave KErrNotConnected |
|
302 @leave KErrArgument |
|
303 @param aInterfaceUid A UID specifying the required interface. |
|
304 @param aImplInfoArray A reference to a client owned array which will be filled |
|
305 with interface implementation data. The array will first be cleared and |
|
306 all items destroyed before adding new data. |
|
307 @post REComSession has not changed, and aImplInfoArray |
|
308 contains the list of Implementation information for the interface. |
|
309 */ |
|
310 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
311 RImplInfoPtrArray& aImplInfoArray) |
|
312 { |
|
313 RExtendedInterfacesArray extendedInterfaces; |
|
314 CleanupClosePushL(extendedInterfaces); |
|
315 ListImplementationsL(aInterfaceUid,extendedInterfaces,aImplInfoArray); |
|
316 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
317 } |
|
318 |
|
319 //ListImplementationsL - LI2 |
|
320 /** |
|
321 Retrieves a list of all the implementations which |
|
322 satisfy the specified interface with selection restriction to |
|
323 the specified parameters. |
|
324 The aImplInfoArray on exit contains the plug-in implementations who's plug-in |
|
325 DLLs have sufficient capabilities to be loaded by the calling client process. |
|
326 |
|
327 @leave KErrNoMemory |
|
328 @leave KErrNotConnected |
|
329 @leave KErrArgument |
|
330 @since 7.0 |
|
331 @param aInterfaceUid A UID specifying the required interface. |
|
332 @param aResolutionParameters Specifies any additional implementation |
|
333 characteristics to be fulfilled, maybe empty. |
|
334 @param aImplInfoArray A reference to a client owned array which will be filled |
|
335 with interface implementation data. The array will first be cleared and |
|
336 all items destroyed before adding new data. |
|
337 @post REComSession has not changed, and aImplInfoArray |
|
338 contains the list of Implementation information for the interface. |
|
339 @see TEComResolverParams |
|
340 */ |
|
341 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
342 const TEComResolverParams& aResolutionParameters, |
|
343 RImplInfoPtrArray& aImplInfoArray) |
|
344 { |
|
345 RExtendedInterfacesArray extendedInterfaces; |
|
346 CleanupClosePushL(extendedInterfaces); |
|
347 ListImplementationsL(aInterfaceUid,extendedInterfaces,aResolutionParameters,aImplInfoArray); |
|
348 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
349 } |
|
350 |
|
351 //ListImplementationsL - LI3 |
|
352 /** |
|
353 Retrieves a list of all the implementations which satisfy the |
|
354 specified interface with selection restriction to |
|
355 the specified parameters. |
|
356 The aImplInfoArray on exit contains the plug-in implementations who's plug-in |
|
357 DLLs have sufficient capabilities to be loaded by the calling client process. |
|
358 Overload with a client provided CResolver. |
|
359 |
|
360 @leave KErrNoMemory |
|
361 @leave KErrNotConnected |
|
362 @leave KErrArgument |
|
363 @leave KErrPermissionDenied |
|
364 @param aInterfaceUid A UID specifying the required interface. |
|
365 @param aResolutionParameters Specifies any additional implementation |
|
366 characteristics to be fulfilled, maybe empty. |
|
367 @param aResolverUid The CResolver UID which identifies the resolver |
|
368 implementation with the required client defined behaviour. |
|
369 @param aImplInfoArray A reference to a client owned array which will be filled |
|
370 with interface implementation data. The array will first be cleared and |
|
371 all items destroyed before adding new data. |
|
372 @post REComSession has not changed, and aImplInfoArray |
|
373 contains the list of Implementation information for the interface. |
|
374 @see TEComResolverParams |
|
375 */ |
|
376 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
377 const TEComResolverParams& aResolutionParameters, |
|
378 TUid aResolverUid, |
|
379 RImplInfoPtrArray& aImplInfoArray) |
|
380 { |
|
381 RExtendedInterfacesArray extendedInterfaces; |
|
382 CleanupClosePushL(extendedInterfaces); |
|
383 ListImplementationsL(aInterfaceUid,extendedInterfaces,aResolutionParameters,aResolverUid,aImplInfoArray); |
|
384 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
385 } |
|
386 |
|
387 //ListImplementationsL - LI4 |
|
388 /** |
|
389 Retrieves a list of all the implementations which satisfy the specified interface, extended Interfaces. |
|
390 The aImplInfoArray on exit contains the plug-in implementations who's plug-in |
|
391 DLLs have sufficient capabilities to be loaded by the calling client process. |
|
392 @leave KErrNoMemory |
|
393 @leave KErrNotConnected |
|
394 @leave KErrArgument |
|
395 @leave Or any of the System Wide error codes |
|
396 @param aInterfaceUid A UID specifying the required interface. |
|
397 @param aExtendedInterfaces Identifies a set of zero or many extended interfaces to match. |
|
398 Must match all extended interfaces for a match to occur. |
|
399 @param aImplInfoArray A reference to a client owned array which will be filled |
|
400 with interface implementation data. The array will first be cleared and |
|
401 all items destroyed before adding new data. |
|
402 @post REComSession has not changed, and aImplInfoArray |
|
403 contains the list of Implementation information for the interface. |
|
404 @publishedPartner |
|
405 @released |
|
406 */ |
|
407 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
408 RExtendedInterfacesArray& aExtendedInterfaces, |
|
409 RImplInfoPtrArray& aImplInfoArray) |
|
410 { |
|
411 if( aInterfaceUid.iUid == 0 ) |
|
412 User::Leave(KErrArgument); |
|
413 |
|
414 // call FinalClose() in the event of a leave |
|
415 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
416 |
|
417 // Open a local instance for the |
|
418 // interface creation, because this is a static |
|
419 // method and we may be not created yet. |
|
420 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
421 // using the global instance which is returned. |
|
422 TEComResolverParams resolutionParameters; |
|
423 ecomSession.ListImplementationsL(EListImplementations, |
|
424 aInterfaceUid, |
|
425 aExtendedInterfaces, |
|
426 resolutionParameters, |
|
427 KNullUid, |
|
428 aImplInfoArray); |
|
429 |
|
430 CleanupStack::PopAndDestroy(&ecomSession); |
|
431 CleanupStack::Pop(); // CleanupFinalClose |
|
432 } |
|
433 |
|
434 //ListImplementationsL - LI5 |
|
435 /** |
|
436 Retrieves a list of all the implementations which |
|
437 satisfy the specified interface, extended interfaces, with selection restriction to |
|
438 the specified parameters. |
|
439 The aImplInfoArray on exit contains the plug-in implementations who's plug-in |
|
440 DLLs have sufficient capabilities to be loaded by the calling client process. |
|
441 |
|
442 @leave KErrNoMemory |
|
443 @leave KErrNotConnected |
|
444 @leave KErrArgument |
|
445 @leave Or any of the System Wide error codes |
|
446 @param aInterfaceUid A UID specifying the required interface. |
|
447 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
448 Must match all extended interfaces for a match to occur. |
|
449 @param aResolutionParameters Specifies any additional implementation |
|
450 characteristics to be fulfilled, maybe empty. |
|
451 @param aImplInfoArray A reference to a client owned array which will be filled |
|
452 with interface implementation data. The array will first be cleared and |
|
453 all items destroyed before adding new data. |
|
454 @post REComSession has not changed, and aImplInfoArray |
|
455 contains the list of Implementation information for the interface. |
|
456 @see TEComResolverParams |
|
457 @publishedPartner |
|
458 @released |
|
459 */ |
|
460 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
461 RExtendedInterfacesArray& aExtendedInterfaces, |
|
462 const TEComResolverParams& aResolutionParameters, |
|
463 RImplInfoPtrArray& aImplInfoArray) |
|
464 { |
|
465 if( aInterfaceUid.iUid == 0) |
|
466 User::Leave(KErrArgument); |
|
467 |
|
468 // call FinalClose() in the event of a leave |
|
469 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
470 |
|
471 // Open a local instance for the |
|
472 // interface creation, because this is a static |
|
473 // method and we may be not created yet. |
|
474 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
475 // using the global instance which is returned. |
|
476 ecomSession.ListImplementationsL(EListResolvedImplementations, |
|
477 aInterfaceUid, |
|
478 aExtendedInterfaces, |
|
479 aResolutionParameters, |
|
480 KNullUid, |
|
481 aImplInfoArray); |
|
482 |
|
483 CleanupStack::PopAndDestroy(&ecomSession); |
|
484 CleanupStack::Pop(); // CleanupFinalClose |
|
485 } |
|
486 |
|
487 //ListImplementationsL - LI6 |
|
488 /** |
|
489 Retrieves a list of all the implementations which satisfy the |
|
490 specified interface, extended Interfaces, with selection restriction to |
|
491 the specified parameters. |
|
492 The aImplInfoArray on exit contains the plug-in implementations who's plug-in |
|
493 DLLs have sufficient capabilities to be loaded by the calling client process. |
|
494 Overload with a client provided CResolver. |
|
495 |
|
496 @leave KErrNoMemory |
|
497 @leave KErrNotConnected |
|
498 @leave KErrArgument |
|
499 @leave KErrPermissionDenied |
|
500 @leave Or any of the System Wide error codes |
|
501 @param aInterfaceUid A UID specifying the required interface. |
|
502 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
503 Must match all extended interfaces for a match to occur. |
|
504 @param aResolutionParameters Specifies any additional implementation |
|
505 characteristics to be fulfilled, maybe empty. |
|
506 @param aResolverUid The CResolver UID which identifies the resolver |
|
507 implementation with the required client defined behaviour. |
|
508 @param aImplInfoArray A reference to a client owned array which will be filled |
|
509 with interface implementation data. The array will first be cleared and |
|
510 all items destroyed before adding new data. |
|
511 @post REComSession has not changed, and aImplInfoArray |
|
512 contains the list of Implementation information for the interface. |
|
513 @see TEComResolverParams |
|
514 @publishedPartner |
|
515 @released |
|
516 */ |
|
517 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
518 RExtendedInterfacesArray& aExtendedInterfaces, |
|
519 const TEComResolverParams& aResolutionParameters, |
|
520 TUid aResolverUid, |
|
521 RImplInfoPtrArray& aImplInfoArray) |
|
522 { |
|
523 if( aInterfaceUid.iUid == 0 || |
|
524 aResolverUid.iUid == 0) |
|
525 User::Leave(KErrArgument); |
|
526 |
|
527 // call FinalClose() in the event of a leave |
|
528 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
529 |
|
530 // Open a local instance for the |
|
531 // interface creation, because this is a static |
|
532 // method and we may be not created yet. |
|
533 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
534 // using the global instance which is returned. |
|
535 ecomSession.ListImplementationsL(EListCustomResolvedImplementations, |
|
536 aInterfaceUid, |
|
537 aExtendedInterfaces, |
|
538 aResolutionParameters, |
|
539 aResolverUid, |
|
540 aImplInfoArray); |
|
541 |
|
542 CleanupStack::PopAndDestroy(&ecomSession); |
|
543 CleanupStack::Pop(); // CleanupFinalClose |
|
544 } |
|
545 |
|
546 |
|
547 //ListImplementationsL - LI7 |
|
548 /** |
|
549 Retrieves a list of all the implementations which satisfy the specified interface. |
|
550 This method does not do capability check. |
|
551 The aImplInfoArray on exit contains the plug-in implementations . |
|
552 @leave KErrNoMemory |
|
553 @leave KErrNotConnected |
|
554 @leave KErrArgument |
|
555 @param aInterfaceUid A UID specifying the required interface. |
|
556 @param aImplInfoArray A reference to a client owned array which will be filled |
|
557 with interface implementation data. The array will first be cleared and |
|
558 all items destroyed before adding new data. |
|
559 @param aCapabilityCheck A boolean value EFalse , if no capability check is required ETrue otherwise. |
|
560 @post REComSession has not changed, and aImplInfoArray |
|
561 contains the list of Implementation information for the interface. |
|
562 */ |
|
563 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
564 RImplInfoPtrArray& aImplInfoArray,TBool aCapabilityCheck) |
|
565 { |
|
566 RExtendedInterfacesArray extendedInterfaces; |
|
567 CleanupClosePushL(extendedInterfaces); |
|
568 if( aInterfaceUid.iUid == 0 ) |
|
569 User::Leave(KErrArgument); |
|
570 // call FinalClose() in the event of a leave |
|
571 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
572 // Open a local instance for the |
|
573 // interface creation, because this is a static |
|
574 // method and we may be not created yet. |
|
575 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
576 // using the global instance which is returned. |
|
577 TEComResolverParams resolutionParameters; |
|
578 ecomSession.ListImplementationsL(EListImplementations, |
|
579 aInterfaceUid, |
|
580 extendedInterfaces, |
|
581 resolutionParameters, |
|
582 KNullUid, |
|
583 aImplInfoArray, |
|
584 aCapabilityCheck); |
|
585 |
|
586 CleanupStack::PopAndDestroy(&ecomSession); |
|
587 CleanupStack::Pop(); // CleanupFinalClose |
|
588 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
589 |
|
590 |
|
591 } |
|
592 |
|
593 //ListImplementationsL - LI8 |
|
594 /** |
|
595 Retrieves a list of all the implementations which |
|
596 satisfy the specified interface with selection restriction to |
|
597 the specified parameters.This method does not do capability check. |
|
598 The aImplInfoArray on exit contains the plug-in implementations . |
|
599 |
|
600 @leave KErrNoMemory |
|
601 @leave KErrNotConnected |
|
602 @leave KErrArgument |
|
603 @since 7.0 |
|
604 @param aInterfaceUid A UID specifying the required interface. |
|
605 @param aResolutionParameters Specifies any additional implementation |
|
606 characteristics to be fulfilled, maybe empty. |
|
607 @param aImplInfoArray A reference to a client owned array which will be filled |
|
608 with interface implementation data. The array will first be cleared and |
|
609 all items destroyed before adding new data. |
|
610 @param aCapabilityCheck A boolean value EFalse , if no capability check is required ETrue otherwise. |
|
611 @post REComSession has not changed, and aImplInfoArray |
|
612 contains the list of Implementation information for the interface. |
|
613 @see TEComResolverParams |
|
614 */ |
|
615 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
616 const TEComResolverParams& aResolutionParameters, |
|
617 RImplInfoPtrArray& aImplInfoArray,TBool aCapabilityCheck) |
|
618 { |
|
619 RExtendedInterfacesArray extendedInterfaces; |
|
620 CleanupClosePushL(extendedInterfaces); |
|
621 if( aInterfaceUid.iUid == 0) |
|
622 User::Leave(KErrArgument); |
|
623 |
|
624 // call FinalClose() in the event of a leave |
|
625 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
626 |
|
627 // Open a local instance for the |
|
628 // interface creation, because this is a static |
|
629 // method and we may be not created yet. |
|
630 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
631 // using the global instance which is returned. |
|
632 ecomSession.ListImplementationsL(EListResolvedImplementations, |
|
633 aInterfaceUid, |
|
634 extendedInterfaces, |
|
635 aResolutionParameters, |
|
636 KNullUid, |
|
637 aImplInfoArray, |
|
638 aCapabilityCheck); |
|
639 |
|
640 CleanupStack::PopAndDestroy(&ecomSession); |
|
641 CleanupStack::Pop(); // CleanupFinalClose |
|
642 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
643 |
|
644 |
|
645 |
|
646 } |
|
647 |
|
648 //ListImplementationsL - LI9 |
|
649 /** |
|
650 Retrieves a list of all the implementations which satisfy the |
|
651 specified interface with selection restriction to |
|
652 the specified parameters.This method does not do capability check. |
|
653 The aImplInfoArray on exit contains the plug-in implementations . |
|
654 Overload with a client provided CResolver. |
|
655 |
|
656 @leave KErrNoMemory |
|
657 @leave KErrNotConnected |
|
658 @leave KErrArgument |
|
659 @leave KErrPermissionDenied |
|
660 @param aInterfaceUid A UID specifying the required interface. |
|
661 @param aResolutionParameters Specifies any additional implementation |
|
662 characteristics to be fulfilled, maybe empty. |
|
663 @param aResolverUid The CResolver UID which identifies the resolver |
|
664 implementation with the required client defined behaviour. |
|
665 @param aImplInfoArray A reference to a client owned array which will be filled |
|
666 with interface implementation data. The array will first be cleared and |
|
667 all items destroyed before adding new data. |
|
668 @param aCapabilityCheck A boolean value EFalse , if no capability check is required ETrue otherwise. |
|
669 @post REComSession has not changed, and aImplInfoArray |
|
670 contains the list of Implementation information for the interface. |
|
671 @see TEComResolverParams |
|
672 */ |
|
673 EXPORT_C void REComSession::ListImplementationsL(TUid aInterfaceUid, |
|
674 const TEComResolverParams& aResolutionParameters, |
|
675 TUid aResolverUid, |
|
676 RImplInfoPtrArray& aImplInfoArray,TBool aCapabilityCheck) |
|
677 { |
|
678 RExtendedInterfacesArray extendedInterfaces; |
|
679 CleanupClosePushL(extendedInterfaces); |
|
680 if( aInterfaceUid.iUid == 0 || |
|
681 aResolverUid.iUid == 0) |
|
682 User::Leave(KErrArgument); |
|
683 |
|
684 // call FinalClose() in the event of a leave |
|
685 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
686 |
|
687 // Open a local instance for the |
|
688 // interface creation, because this is a static |
|
689 // method and we may be not created yet. |
|
690 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
691 // using the global instance which is returned. |
|
692 ecomSession.ListImplementationsL(EListCustomResolvedImplementations, |
|
693 aInterfaceUid, |
|
694 extendedInterfaces, |
|
695 aResolutionParameters, |
|
696 aResolverUid, |
|
697 aImplInfoArray, |
|
698 aCapabilityCheck); |
|
699 |
|
700 CleanupStack::PopAndDestroy(&ecomSession); |
|
701 CleanupStack::Pop(); // CleanupFinalClose |
|
702 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
703 |
|
704 |
|
705 } |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 //CreateImplementationL - CI1 |
|
711 /** |
|
712 Instantiates an interface implementation to satisfy the specified interface. |
|
713 @leave KErrNoMemory |
|
714 @leave KErrNotConnected |
|
715 @leave KErrArgument |
|
716 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
717 1. There is a capability mismatch between the process creating the implementation |
|
718 and the DLL containing the implementation |
|
719 2. The plugin DLL installed on the media card was not properly installed, |
|
720 either the system hash value of this plugin is missing or it is inconsistent |
|
721 with that calculated for the plugin DLL at load time. |
|
722 @param aImplementationUid A UID specifying the required interface implementation. |
|
723 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
724 This instance key should be passed as an argument to the DestroyedImplementation() |
|
725 method to identify the implementation for destruction. |
|
726 No meaning should be attached to this instance key by ECOM clients |
|
727 and it should not be used for any other purpose. |
|
728 @return TAny* A pointer to the instantiated interface implementation. |
|
729 @post The requested interface implementation is identified, |
|
730 and the instantiation method pointer is returned. |
|
731 */ |
|
732 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aImplementationUid, |
|
733 TUid& aInstanceKey) |
|
734 { |
|
735 TUid tempInstanceKey = aInstanceKey = KNullUid; |
|
736 TBool instParamsFlag = EFalse; |
|
737 |
|
738 if( aImplementationUid.iUid == 0 ) |
|
739 User::Leave(KErrArgument); |
|
740 |
|
741 // call FinalClose() in the event of a leave |
|
742 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
743 |
|
744 // Open a local instance for the |
|
745 // interface creation, because this is a static |
|
746 // method and we may be not created yet. |
|
747 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
748 // using the global instance which is returned. |
|
749 // Use the default resolver in the overloaded method. |
|
750 TAny* result = ecomSession.ResolveAndCreateImplL(aImplementationUid, tempInstanceKey, NULL, instParamsFlag); |
|
751 |
|
752 CleanupStack::Pop(&ecomSession); |
|
753 CleanupStack::Pop(); // CleanupFinalClose |
|
754 |
|
755 aInstanceKey = tempInstanceKey; |
|
756 |
|
757 return result; |
|
758 } |
|
759 |
|
760 //CreateImplementationL - CI2 |
|
761 /** |
|
762 Instantiates an interface implementation to satisfy the specified interface. |
|
763 @leave KErrNoMemory |
|
764 @leave KErrNotConnected |
|
765 @leave KErrArgument |
|
766 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
767 1. There is a capability mismatch between the process creating the implementation |
|
768 and the DLL containing the implementation |
|
769 2. The plugin DLL installed on the media card was not properly installed, |
|
770 either the system hash value of this plugin is missing or it is inconsistent |
|
771 with that calculated for the plugin DLL at load time. |
|
772 @param aImplementationUid A UID specifying the required interface implementation. |
|
773 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
774 identify this instance to the framework. |
|
775 @return TAny* A pointer to the instantiated interface implementation. |
|
776 @post The requested interface implementation is identified, |
|
777 and the instantiation method pointer is returned. |
|
778 */ |
|
779 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aImplementationUid, |
|
780 TInt32 aKeyOffset) |
|
781 { |
|
782 TUid key; |
|
783 |
|
784 // Get the instance using the overload which gives us the key back |
|
785 TAny* instance = CreateImplementationL(aImplementationUid, key); |
|
786 |
|
787 // Find the key location using the offset and store it |
|
788 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
789 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
790 *instanceKey = key; |
|
791 |
|
792 return instance; |
|
793 } |
|
794 |
|
795 //CreateImplementationL - CI3 |
|
796 /** |
|
797 Instantiates an interface implementation to satisfy the specified interface. |
|
798 @leave KErrNoMemory |
|
799 @leave KErrNotConnected |
|
800 @leave KErrArgument |
|
801 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
802 1. There is a capability mismatch between the process creating the implementation |
|
803 and the DLL containing the implementation |
|
804 2. The plugin DLL installed on the media card was not properly installed, |
|
805 either the system hash value of this plugin is missing or it is inconsistent |
|
806 with that calculated for the plugin DLL at load time. |
|
807 @param aImplementationUid A UID specifying the required interface implementation. |
|
808 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
809 This instance key should be passed as an argument to the DestroyedImplementation() |
|
810 method to identify the implementation for destruction. |
|
811 No meaning should be attached to this instance key by ECOM clients |
|
812 and it should not be used for any other purpose. |
|
813 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
814 @return TAny* A pointer to the instantiated interface implementation. |
|
815 @post The requested interface implementation is identified, |
|
816 and the instantiation method pointer is returned. |
|
817 */ |
|
818 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aImplementationUid, |
|
819 TUid& aInstanceKey, |
|
820 TAny* aInstantiationParams) |
|
821 { |
|
822 TUid tempInstanceKey = aInstanceKey = KNullUid; |
|
823 TBool instParamsFlag = ETrue; |
|
824 |
|
825 if( aImplementationUid.iUid == 0) |
|
826 User::Leave(KErrArgument); |
|
827 |
|
828 // call FinalClose() in the event of a leave |
|
829 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
830 |
|
831 // Open a local instance for the |
|
832 // interface creation, because this is a static |
|
833 // method and we may be not created yet. |
|
834 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
835 // using the global instance which is returned. |
|
836 // Use the default resolver in the overloaded method. |
|
837 TAny* result = ecomSession.ResolveAndCreateImplL(aImplementationUid, tempInstanceKey, aInstantiationParams, instParamsFlag); |
|
838 |
|
839 CleanupStack::Pop(&ecomSession); |
|
840 CleanupStack::Pop(); // CleanupFinalClose |
|
841 |
|
842 aInstanceKey = tempInstanceKey; |
|
843 |
|
844 return result; |
|
845 } |
|
846 |
|
847 //CreateImplementationL - CI4 |
|
848 /** |
|
849 Instantiates an interface implementation to satisfy the specified interface. |
|
850 @leave KErrNoMemory |
|
851 @leave KErrNotConnected |
|
852 @leave KErrArgument |
|
853 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
854 1. There is a capability mismatch between the process creating the implementation |
|
855 and the DLL containing the implementation |
|
856 2. The plugin DLL installed on the media card was not properly installed, |
|
857 either the system hash value of this plugin is missing or it is inconsistent |
|
858 with that calculated for the plugin DLL at load time. |
|
859 @param aImplementationUid A UID specifying the required interface implementation. |
|
860 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
861 identify this instance to the framework. |
|
862 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
863 @return TAny* A pointer to the instantiated interface implementation. |
|
864 @post The requested interface implementation is identified, |
|
865 and the instantiation method pointer is returned. |
|
866 */ |
|
867 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aImplementationUid, |
|
868 TInt32 aKeyOffset, |
|
869 TAny* aInstantiationParams) |
|
870 { |
|
871 TUid key; |
|
872 |
|
873 // Get the instance using the overload which gives us the key back |
|
874 TAny* instance = CreateImplementationL(aImplementationUid, key, aInstantiationParams); |
|
875 |
|
876 // Find the key location using the offset and store it |
|
877 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
878 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
879 *instanceKey = key; |
|
880 return instance; |
|
881 } |
|
882 |
|
883 //CreateImplementationL - CI5 |
|
884 /** |
|
885 Instantiates an interface implementation to satisfy the specified interface. |
|
886 |
|
887 @leave KErrNoMemory |
|
888 @leave KErrNotConnected |
|
889 @leave KErrArgument |
|
890 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
891 1. There is a capability mismatch between the process creating the implementation |
|
892 and the DLL containing the implementation |
|
893 2. The plugin DLL installed on the media card was not properly installed, |
|
894 either the system hash value of this plugin is missing or it is inconsistent |
|
895 with that calculated for the plugin DLL at load time. |
|
896 @param aInterfaceUid A UID specifying the required interface. |
|
897 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
898 This instance key should be passed as an argument to the DestroyedImplementation() |
|
899 method to identify the implementation for destruction. |
|
900 No meaning should be attached to this instance key by ECOM clients |
|
901 and it should not be used for any other purpose. |
|
902 @param aResolutionParameters Specifies any additional implementation |
|
903 characteristics to be fulfilled, maybe empty. |
|
904 @return TAny* A pointer to the instantiated interface implementation. |
|
905 @post The requested interface implementation is identified, |
|
906 and the instantiation method pointer is returned. |
|
907 @see TEComResolverParams |
|
908 */ |
|
909 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
910 TUid& aInstanceKey, |
|
911 const TEComResolverParams& aResolutionParameters) |
|
912 |
|
913 { |
|
914 TUid tempInstanceKey = aInstanceKey = KNullUid; |
|
915 TBool instParamsFlag = EFalse; |
|
916 |
|
917 if( aInterfaceUid.iUid == 0) |
|
918 User::Leave(KErrArgument); |
|
919 |
|
920 // call FinalClose() in the event of a leave |
|
921 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
922 |
|
923 // Open a local instance for the |
|
924 // interface creation, because this is a static |
|
925 // method and we may be not created yet. |
|
926 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
927 |
|
928 // Use the default resolver in the overloaded method. |
|
929 TAny* result = ecomSession.ResolveAndCreateImplL(aInterfaceUid, aResolutionParameters, tempInstanceKey, NULL,instParamsFlag); |
|
930 |
|
931 CleanupStack::Pop(&ecomSession); |
|
932 CleanupStack::Pop(); // CleanupFinalClose |
|
933 |
|
934 aInstanceKey = tempInstanceKey; |
|
935 |
|
936 return result; |
|
937 } |
|
938 |
|
939 //CreateImplementationL - CI6 |
|
940 /** |
|
941 Instantiates an interface implementation to satisfy the specified interface. |
|
942 |
|
943 @leave KErrNoMemory |
|
944 @leave KErrNotConnected |
|
945 @leave KErrArgument |
|
946 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
947 1. There is a capability mismatch between the process creating the implementation |
|
948 and the DLL containing the implementation |
|
949 2. The plugin DLL installed on the media card was not properly installed, |
|
950 either the system hash value of this plugin is missing or it is inconsistent |
|
951 with that calculated for the plugin DLL at load time. |
|
952 @param aInterfaceUid A UID specifying the required interface. |
|
953 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
954 identify this instance to the framework. |
|
955 @param aResolutionParameters Specifies any additional implementation |
|
956 characteristics to be fulfilled, maybe empty. |
|
957 @return TAny* A pointer to the instantiated interface implementation. |
|
958 @post The requested interface implementation is identified, |
|
959 and the instantiation method pointer is returned. |
|
960 @see TEComResolverParams |
|
961 */ |
|
962 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
963 TInt32 aKeyOffset, |
|
964 const TEComResolverParams& aResolutionParameters) |
|
965 { |
|
966 TUid key; |
|
967 |
|
968 // Get the instance using the overload which gives us the key back |
|
969 TAny* instance = CreateImplementationL( aInterfaceUid, |
|
970 key, |
|
971 aResolutionParameters); |
|
972 |
|
973 // Find the key location using the offset and store it |
|
974 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
975 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
976 *instanceKey = key; |
|
977 |
|
978 return instance; |
|
979 } |
|
980 |
|
981 //CreateImplementationL - CI7 |
|
982 /** |
|
983 Instantiates an interface implementation to satisfy the specified interface. |
|
984 |
|
985 @leave KErrNoMemory |
|
986 @leave KErrNotConnected |
|
987 @leave KErrArgument |
|
988 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
989 1. There is a capability mismatch between the process creating the implementation |
|
990 and the DLL containing the implementation |
|
991 2. The plugin DLL installed on the media card was not properly installed, |
|
992 either the system hash value of this plugin is missing or it is inconsistent |
|
993 with that calculated for the plugin DLL at load time. |
|
994 @param aInterfaceUid A UID specifying the required interface. |
|
995 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
996 This instance key should be passed as an argument to the DestroyedImplementation() |
|
997 method to identify the implementation for destruction. |
|
998 No meaning should be attached to this instance key by ECOM clients |
|
999 and it should not be used for any other purpose. |
|
1000 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1001 @param aResolutionParameters Specifies any additional implementation |
|
1002 characteristics to be fulfilled, maybe empty. |
|
1003 return TAny* A pointer to the instantiated interface implementation. |
|
1004 @post The requested interface implementation is identified, |
|
1005 and the instantiation method pointer is returned. |
|
1006 @see TEComResolverParams |
|
1007 */ |
|
1008 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1009 TUid& aInstanceKey, |
|
1010 TAny* aInstantiationParams, |
|
1011 const TEComResolverParams& aResolutionParameters) |
|
1012 { |
|
1013 RExtendedInterfacesArray extendedInterfaces; |
|
1014 CleanupClosePushL(extendedInterfaces); |
|
1015 TAny* instance = CreateImplementationL(aInterfaceUid, |
|
1016 extendedInterfaces, |
|
1017 aInstanceKey, |
|
1018 aResolutionParameters, |
|
1019 aInstantiationParams); |
|
1020 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
1021 return instance; |
|
1022 } |
|
1023 |
|
1024 //CreateImplementationL - CI8 |
|
1025 /** |
|
1026 Instantiates an interface implementation to satisfy the specified interface. |
|
1027 |
|
1028 @leave KErrNoMemory |
|
1029 @leave KErrNotConnected |
|
1030 @leave KErrArgument |
|
1031 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1032 1. There is a capability mismatch between the process creating the implementation |
|
1033 and the DLL containing the implementation |
|
1034 2. The plugin DLL installed on the media card was not properly installed, |
|
1035 either the system hash value of this plugin is missing or it is inconsistent |
|
1036 with that calculated for the plugin DLL at load time. |
|
1037 @param aInterfaceUid A UID specifying the required interface. |
|
1038 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
1039 identify this instance to the framework. |
|
1040 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1041 @param aResolutionParameters Specifies any additional implementation |
|
1042 characteristics to be fulfilled, maybe empty. |
|
1043 @return TAny* A pointer to the instantiated interface implementation. |
|
1044 @post The requested interface implementation is identified, |
|
1045 and the instantiation method pointer is returned. |
|
1046 @see TEComResolverParams |
|
1047 */ |
|
1048 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1049 TInt32 aKeyOffset, |
|
1050 TAny* aInstantiationParams, |
|
1051 const TEComResolverParams& aResolutionParameters) |
|
1052 { |
|
1053 TUid key; |
|
1054 |
|
1055 // Get the instance using the overload which gives us the key back |
|
1056 TAny* instance = CreateImplementationL( aInterfaceUid, |
|
1057 key, |
|
1058 aInstantiationParams, |
|
1059 aResolutionParameters); |
|
1060 |
|
1061 // Find the key location using the offset and store it |
|
1062 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
1063 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
1064 *instanceKey = key; |
|
1065 |
|
1066 return instance; |
|
1067 } |
|
1068 |
|
1069 //CreateImplementationL - CI9 |
|
1070 /** |
|
1071 Instantiates an interface implementation to satisfy the specified interface. |
|
1072 |
|
1073 @leave KErrNoMemory |
|
1074 @leave KErrNotConnected |
|
1075 @leave KErrArgument |
|
1076 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1077 1. There is a capability mismatch between the process creating the implementation |
|
1078 and the DLL containing the implementation |
|
1079 2. The plugin DLL installed on the media card was not properly installed, |
|
1080 either the system hash value of this plugin is missing or it is inconsistent |
|
1081 with that calculated for the plugin DLL at load time. |
|
1082 @param aInterfaceUid A UID specifying the required interface. |
|
1083 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
1084 This instance key should be passed as an argument to the DestroyedImplementation() |
|
1085 method to identify the implementation for destruction. |
|
1086 No meaning should be attached to this instance key by ECOM clients |
|
1087 and it should not be used for any other purpose. |
|
1088 @param aResolutionParameters Specifies any additional implementation |
|
1089 characteristics to be fulfilled, maybe empty. |
|
1090 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
1091 @return TAny* A pointer to the instantiated interface implementation. |
|
1092 @post The requested interface implementation is identified, |
|
1093 and the instantiation method pointer is returned. |
|
1094 @see TEComResolverParams |
|
1095 */ |
|
1096 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1097 TUid& aInstanceKey, |
|
1098 const TEComResolverParams& aResolutionParameters, |
|
1099 TUid aResolverUid) |
|
1100 { |
|
1101 TUid tempInstanceKey = aInstanceKey = KNullUid; |
|
1102 TBool instParamsFlag = EFalse; |
|
1103 |
|
1104 if( aInterfaceUid.iUid == 0 || |
|
1105 aResolverUid.iUid == 0) |
|
1106 User::Leave(KErrArgument); |
|
1107 |
|
1108 // call FinalClose() in the event of a leave |
|
1109 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
1110 |
|
1111 // Open a local instance for the |
|
1112 // interface creation, because this is a static |
|
1113 // method and we may be not created yet. |
|
1114 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
1115 // using the global instance which is returned. |
|
1116 // Use the default resolver in the overloaded method. |
|
1117 TAny* result = ecomSession.ResolveAndCreateImplL(aInterfaceUid, aResolutionParameters, aResolverUid, tempInstanceKey, NULL,instParamsFlag); |
|
1118 |
|
1119 CleanupStack::Pop(&ecomSession); |
|
1120 CleanupStack::Pop(); // CleanupFinalClose |
|
1121 |
|
1122 aInstanceKey = tempInstanceKey; |
|
1123 |
|
1124 return result; |
|
1125 } |
|
1126 |
|
1127 //CreateImplementationL - CI10 |
|
1128 /** |
|
1129 Instantiates an interface implementation to satisfy the specified interface. |
|
1130 |
|
1131 @leave KErrNoMemory |
|
1132 @leave KErrNotConnected |
|
1133 @leave KErrArgument |
|
1134 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1135 1. There is a capability mismatch between the process creating the implementation |
|
1136 and the DLL containing the implementation |
|
1137 2. The plugin DLL installed on the media card was not properly installed, |
|
1138 either the system hash value of this plugin is missing or it is inconsistent |
|
1139 with that calculated for the plugin DLL at load time. |
|
1140 @param aInterfaceUid A UID specifying the required interface. |
|
1141 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
1142 identify this instance to the framework. |
|
1143 @param aResolutionParameters Specifies any additional implementation |
|
1144 characteristics to be fulfilled, maybe empty. |
|
1145 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
1146 @return TAny* A pointer to the instantiated interface implementation. |
|
1147 @post The requested interface implementation is identified, |
|
1148 and the instantiation method pointer is returned. |
|
1149 @see TEComResolverParams |
|
1150 */ |
|
1151 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1152 TInt32 aKeyOffset, |
|
1153 const TEComResolverParams& aResolutionParameters, |
|
1154 TUid aResolverUid) |
|
1155 { |
|
1156 TUid key; |
|
1157 |
|
1158 // Get the instance using the overload which gives us the key back |
|
1159 TAny* instance = CreateImplementationL( aInterfaceUid, |
|
1160 key, |
|
1161 aResolutionParameters, |
|
1162 aResolverUid); |
|
1163 |
|
1164 // Find the key location using the offset and store it |
|
1165 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
1166 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
1167 *instanceKey = key; |
|
1168 |
|
1169 return instance; |
|
1170 } |
|
1171 |
|
1172 //CreateImplementationL - CI11 |
|
1173 /** |
|
1174 Instantiates an interface implementation to satisfy the specified interface. |
|
1175 |
|
1176 @leave KErrNoMemory |
|
1177 @leave KErrNotConnected |
|
1178 @leave KErrArgument |
|
1179 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1180 1. There is a capability mismatch between the process creating the implementation |
|
1181 and the DLL containing the implementation |
|
1182 2. The plugin DLL installed on the media card was not properly installed, |
|
1183 either the system hash value of this plugin is missing or it is inconsistent |
|
1184 with that calculated for the plugin DLL at load time. |
|
1185 @param aInterfaceUid A UID specifying the required interface. |
|
1186 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
1187 This instance key should be passed as an argument to the DestroyedImplementation() |
|
1188 method to identify the implementation for destruction. |
|
1189 No meaning should be attached to this instance key by ECOM clients |
|
1190 and it should not be used for any other purpose. |
|
1191 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1192 @param aResolutionParameters Specifies any additional implementation |
|
1193 characteristics to be fulfilled, maybe empty. |
|
1194 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
1195 @return TAny* A pointer to the instantiated interface implementation. |
|
1196 @post The requested interface implementation is identified, |
|
1197 and the instantiation method pointer is returned. |
|
1198 @see TEComResolverParams |
|
1199 */ |
|
1200 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1201 TUid& aInstanceKey, |
|
1202 TAny* aInstantiationParams, |
|
1203 const TEComResolverParams& aResolutionParameters, |
|
1204 TUid aResolverUid) |
|
1205 { |
|
1206 RExtendedInterfacesArray extendedInterfaces; |
|
1207 CleanupClosePushL(extendedInterfaces); |
|
1208 TAny* instance = CreateImplementationL(aInterfaceUid, |
|
1209 extendedInterfaces, |
|
1210 aInstanceKey, |
|
1211 aResolutionParameters, |
|
1212 aResolverUid, |
|
1213 aInstantiationParams); |
|
1214 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
1215 return instance; |
|
1216 } |
|
1217 |
|
1218 //CreateImplementationL - CI12 |
|
1219 /** |
|
1220 Instantiates an interface implementation to satisfy the specified interface. |
|
1221 |
|
1222 @leave KErrNoMemory |
|
1223 @leave KErrNotConnected |
|
1224 @leave KErrArgument |
|
1225 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1226 1. There is a capability mismatch between the process creating the implementation |
|
1227 and the DLL containing the implementation |
|
1228 2. The plugin DLL installed on the media card was not properly installed, |
|
1229 either the system hash value of this plugin is missing or it is inconsistent |
|
1230 with that calculated for the plugin DLL at load time. |
|
1231 @param aInterfaceUid A UID specifying the required interface. |
|
1232 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
1233 identify this instance to the framework. |
|
1234 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1235 @param aResolutionParameters Specifies any additional implementation |
|
1236 characteristics to be fulfilled, maybe empty. |
|
1237 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
1238 @return TAny* A pointer to the instantiated interface implementation. |
|
1239 @post The requested interface implementation is identified, |
|
1240 and the instantiation method pointer is returned. |
|
1241 @see TEComResolverParams |
|
1242 */ |
|
1243 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1244 TInt32 aKeyOffset, |
|
1245 TAny* aInstantiationParams, |
|
1246 const TEComResolverParams& aResolutionParameters, |
|
1247 TUid aResolverUid) |
|
1248 { |
|
1249 TUid key; |
|
1250 |
|
1251 // Get the instance using the overload which gives us the key back |
|
1252 TAny* instance = CreateImplementationL( aInterfaceUid, |
|
1253 key, |
|
1254 aInstantiationParams, |
|
1255 aResolutionParameters, |
|
1256 aResolverUid); |
|
1257 |
|
1258 // Find the key location using the offset and store it |
|
1259 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
1260 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
1261 *instanceKey = key; |
|
1262 |
|
1263 return instance; |
|
1264 } |
|
1265 |
|
1266 //CreateImplementationL - CI13 |
|
1267 /** |
|
1268 Instantiates an interface implementation to satisfy the specified interface. |
|
1269 |
|
1270 @leave KErrNoMemory |
|
1271 @leave KErrNotConnected |
|
1272 @leave KErrArgument |
|
1273 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1274 1. There is a capability mismatch between the process creating the implementation |
|
1275 and the DLL containing the implementation |
|
1276 2. The plugin DLL installed on the media card was not properly installed, |
|
1277 either the system hash value of this plugin is missing or it is inconsistent |
|
1278 with that calculated for the plugin DLL at load time. |
|
1279 @leave Or any of the System Wide error codes |
|
1280 @param aInterfaceUid A UID specifying the required interface implementation. |
|
1281 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
1282 Must match all extended interfaces for a match to occur. |
|
1283 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
1284 This instance key should be passed as an argument to the DestroyedImplementation() |
|
1285 method to identify the implementation for destruction. |
|
1286 No meaning should be attached to this instance key by ECOM clients |
|
1287 and it should not be used for any other purpose. |
|
1288 @param aResolutionParameters Specifies any additional implementation |
|
1289 characteristics to be fulfilled, maybe empty. |
|
1290 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1291 Default value is NULL. |
|
1292 @return TAny* A pointer to the instantiated interface implementation. |
|
1293 @post The requested interface implementation is identified, |
|
1294 and the instantiation method pointer is returned. |
|
1295 @see TEComResolverParams |
|
1296 @publishedPartner |
|
1297 @released |
|
1298 */ |
|
1299 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1300 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
1301 TUid& aInstanceKey, |
|
1302 const TEComResolverParams& aResolutionParameters, |
|
1303 TAny* aInstantiationParams) |
|
1304 { |
|
1305 TUid tempInstanceKey = aInstanceKey = KNullUid; |
|
1306 TBool instParamsFlag = ETrue; |
|
1307 |
|
1308 if( aInterfaceUid.iUid == 0) |
|
1309 User::Leave(KErrArgument); |
|
1310 |
|
1311 // call FinalClose() in the event of a leave |
|
1312 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
1313 |
|
1314 // Open a local instance for the |
|
1315 // interface creation, because this is a static |
|
1316 // method and we may be not created yet. |
|
1317 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
1318 // using the global instance which is returned. |
|
1319 // Use the default resolver in the overloaded method. |
|
1320 TAny* result = ecomSession.ResolveAndCreateImplL(aInterfaceUid, aExtendedInterfaces, aResolutionParameters, tempInstanceKey, aInstantiationParams, instParamsFlag); |
|
1321 |
|
1322 CleanupStack::Pop(&ecomSession); |
|
1323 CleanupStack::Pop(); // CleanupFinalClose |
|
1324 |
|
1325 aInstanceKey = tempInstanceKey; |
|
1326 return result; |
|
1327 } |
|
1328 |
|
1329 //CreateImplementationL - CI14 |
|
1330 /** |
|
1331 Instantiates an interface implementation to satisfy the specified interface. |
|
1332 |
|
1333 @leave KErrNoMemory |
|
1334 @leave KErrNotConnected |
|
1335 @leave KErrArgument |
|
1336 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1337 1. There is a capability mismatch between the process creating the implementation |
|
1338 and the DLL containing the implementation |
|
1339 2. The plugin DLL installed on the media card was not properly installed, |
|
1340 either the system hash value of this plugin is missing or it is inconsistent |
|
1341 with that calculated for the plugin DLL at load time. |
|
1342 @leave Or any of the System Wide error codes |
|
1343 @param aInterfaceUid A UID specifying the required interface implementation. |
|
1344 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
1345 Must match all extended interfaces for a match to occur. |
|
1346 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
1347 identify this instance to the framework. |
|
1348 @param aResolutionParameters Specifies any additional implementation |
|
1349 characteristics to be fulfilled, maybe empty. |
|
1350 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1351 Default value is NULL. |
|
1352 @return TAny* A pointer to the instantiated interface implementation. |
|
1353 @post The requested interface implementation is identified, |
|
1354 and the instantiation method pointer is returned. |
|
1355 @see TEComResolverParams |
|
1356 @publishedPartner |
|
1357 @released |
|
1358 */ |
|
1359 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1360 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
1361 TInt32 aKeyOffset, |
|
1362 const TEComResolverParams& aResolutionParameters, |
|
1363 TAny* aInstantiationParams) |
|
1364 { |
|
1365 TUid key; |
|
1366 |
|
1367 // Get the instance using the overload which gives us the key back |
|
1368 TAny* instance = CreateImplementationL( aInterfaceUid, |
|
1369 aExtendedInterfaces, |
|
1370 key, |
|
1371 aResolutionParameters, |
|
1372 aInstantiationParams); |
|
1373 |
|
1374 // Find the key location using the offset and store it |
|
1375 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
1376 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
1377 *instanceKey = key; |
|
1378 |
|
1379 return instance; |
|
1380 } |
|
1381 |
|
1382 //CreateImplementationL - CI15 |
|
1383 /** |
|
1384 Instantiates an interface implementation to satisfy the specified interface. |
|
1385 |
|
1386 @leave KErrNoMemory |
|
1387 @leave KErrNotConnected |
|
1388 @leave KErrArgument |
|
1389 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1390 1. There is a capability mismatch between the process creating the implementation |
|
1391 and the DLL containing the implementation |
|
1392 2. The plugin DLL installed on the media card was not properly installed, |
|
1393 either the system hash value of this plugin is missing or it is inconsistent |
|
1394 with that calculated for the plugin DLL at load time. |
|
1395 @leave Or any of the System Wide error codes |
|
1396 @param aInterfaceUid A UID specifying the required interface implementation. |
|
1397 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
1398 Must match all extended interfaces for a match to occur. |
|
1399 @param aInstanceKey A 32-bit instance key that is returned by the ECom framework. |
|
1400 This instance key should be passed as an argument to the DestroyedImplementation() |
|
1401 method to identify the implementation for destruction. |
|
1402 No meaning should be attached to this instance key by ECOM clients |
|
1403 and it should not be used for any other purpose. |
|
1404 @param aResolutionParameters Specifies any additional implementation |
|
1405 characteristics to be fulfilled, maybe empty. |
|
1406 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
1407 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1408 Default value is NULL. |
|
1409 @return TAny* A pointer to the instantiated interface implementation. |
|
1410 @post The requested interface implementation is identified, |
|
1411 and the instantiation method pointer is returned. |
|
1412 @see TEComResolverParams |
|
1413 @publishedPartner |
|
1414 @released |
|
1415 */ |
|
1416 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1417 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
1418 TUid& aInstanceKey, |
|
1419 const TEComResolverParams& aResolutionParameters, |
|
1420 TUid aResolverUid, |
|
1421 TAny* aInstantiationParams) |
|
1422 { |
|
1423 TUid tempInstanceKey = aInstanceKey = KNullUid; |
|
1424 TBool instParamsFlag = ETrue; |
|
1425 |
|
1426 if( aInterfaceUid.iUid == 0 || |
|
1427 aResolverUid.iUid == 0) |
|
1428 User::Leave(KErrArgument); |
|
1429 |
|
1430 // call FinalClose() in the event of a leave |
|
1431 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
1432 |
|
1433 // Open a local instance for the |
|
1434 // interface creation, because this is a static |
|
1435 // method and we may be not created yet. |
|
1436 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
1437 // using the global instance which is returned. |
|
1438 // Use the custom resolver with specific aResolverUid in the overloaded method |
|
1439 TAny* result = ecomSession.ResolveAndCreateImplL(aInterfaceUid, |
|
1440 aExtendedInterfaces, |
|
1441 aResolutionParameters, |
|
1442 aResolverUid, |
|
1443 tempInstanceKey, |
|
1444 aInstantiationParams, |
|
1445 instParamsFlag); |
|
1446 |
|
1447 CleanupStack::Pop(&ecomSession); |
|
1448 CleanupStack::Pop(); // CleanupFinalClose |
|
1449 |
|
1450 aInstanceKey = tempInstanceKey; |
|
1451 |
|
1452 return result; |
|
1453 } |
|
1454 |
|
1455 //CreateImplementationL - CI16 |
|
1456 /** |
|
1457 Instantiates an interface implementation to satisfy the specified interface. |
|
1458 |
|
1459 @leave KErrNoMemory |
|
1460 @leave KErrNotConnected |
|
1461 @leave KErrArgument |
|
1462 @leave KErrPermissionDenied. This leave error can happen under the following conditions: |
|
1463 1. There is a capability mismatch between the process creating the implementation |
|
1464 and the DLL containing the implementation |
|
1465 2. The plugin DLL installed on the media card was not properly installed, |
|
1466 either the system hash value of this plugin is missing or it is inconsistent |
|
1467 with that calculated for the plugin DLL at load time. |
|
1468 @leave Or any of the System Wide error codes |
|
1469 @param aInterfaceUid A UID specifying the required interface implementation. |
|
1470 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
1471 Must match all extended interfaces for a match to occur. |
|
1472 @param aKeyOffset An offset to the 32 bit identifer returned by the ECom framework to |
|
1473 identify this instance to the framework. |
|
1474 @param aResolutionParameters Specifies any additional implementation |
|
1475 characteristics to be fulfilled, maybe empty. |
|
1476 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
1477 @param aInstantiationParams The parameter structure to pass to the object creation method. |
|
1478 Default value is NULL. |
|
1479 @return TAny* A pointer to the instantiated interface implementation. |
|
1480 @post The requested interface implementation is identified, |
|
1481 and the instantiation method pointer is returned. |
|
1482 @see TEComResolverParams |
|
1483 @publishedPartner |
|
1484 @released |
|
1485 */ |
|
1486 EXPORT_C TAny* REComSession::CreateImplementationL(TUid aInterfaceUid, |
|
1487 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
1488 TInt32 aKeyOffset, |
|
1489 const TEComResolverParams& aResolutionParameters, |
|
1490 TUid aResolverUid, |
|
1491 TAny* aInstantiationParams) |
|
1492 { |
|
1493 TUid key; |
|
1494 |
|
1495 // Get the instance using the overload which gives us the key back |
|
1496 TAny* instance = CreateImplementationL( aInterfaceUid, |
|
1497 aExtendedInterfaces, |
|
1498 key, |
|
1499 aResolutionParameters, |
|
1500 aResolverUid, |
|
1501 aInstantiationParams); |
|
1502 |
|
1503 // Find the key location using the offset and store it |
|
1504 TUint8* offsetPtr = REINTERPRET_CAST(TUint8*, instance) + aKeyOffset; |
|
1505 TUid* instanceKey = REINTERPRET_CAST(TUid*, offsetPtr); |
|
1506 *instanceKey = key; |
|
1507 |
|
1508 return instance; |
|
1509 } |
|
1510 |
|
1511 /** |
|
1512 Returns the requested interface, NULL if it does not exist |
|
1513 @leave KErrNotFound When the supplied 32-bit implementation instance key is not recognised by ECom. |
|
1514 @leave KErrArgument When a null implementation instance key is passed as an argument to ECom. |
|
1515 @leave Any of the other System wide errors |
|
1516 @param aInstanceKey A 32-bit implementation instance key that is returned from a call to one of the CreateImplementationL() |
|
1517 methods. ECOM uses this implementation instance key when it is passed as an argument to the |
|
1518 DestroyedImplementation() method to identify an implementation for destruction. No meaning should be attached to |
|
1519 this implementation instance key by ECOM clients and it should not be used for any other purpose. |
|
1520 @param aExtendedInterfaceUid Identifies an interface to fetch from the plug-in instance. |
|
1521 @return TAny* A pointer to the extended interface implementation if the implementation identified by aInstanceKey |
|
1522 supports it, or NULL if the implementation does not support the extended interface. |
|
1523 @publishedPartner |
|
1524 @released |
|
1525 */ |
|
1526 EXPORT_C TAny* REComSession::GetExtendedInterfaceL(const TUid& aInstanceKey, const TUid& aExtendedInterfaceUid) |
|
1527 { |
|
1528 if(aInstanceKey == KNullUid) |
|
1529 User::Leave(KErrArgument); |
|
1530 |
|
1531 TAny* object = NULL; |
|
1532 |
|
1533 CGlobalData* globalData = CGlobalData::Instance(); |
|
1534 if (globalData == 0) |
|
1535 { |
|
1536 __ECOM_LOG("ECOM: PANIC in REComSession::GetExtendedInterfaceL(), no global data"); |
|
1537 User::Panic(KEComClientDLLPanicCategory, EEComPanic_LibraryNotInitialised); |
|
1538 } |
|
1539 |
|
1540 |
|
1541 // Leaves with KErrNotFound if aInstanceKey not known. |
|
1542 object = globalData->LoadManager().GetExtendedInterfaceL(aInstanceKey, aExtendedInterfaceUid); |
|
1543 |
|
1544 return object; |
|
1545 } |
|
1546 |
|
1547 /** |
|
1548 Releases the extended interface associated with the supplied instance. Does nothing if the interface |
|
1549 does not exist. This interface is optional, normally the interfaces are cleaned up automatically. This |
|
1550 can be used if it is necessary to clean up an extended interface before the automatic cleanup occurs when |
|
1551 the instance is destroyed. |
|
1552 @leave KErrNotFound When the supplied 32-bit implementation instance key is not recognised by ECom. |
|
1553 @leave KErrArgument When a null implementation instance key is passed as an argument to ECom. |
|
1554 @leave Any of the other System wide errors |
|
1555 @param aInstanceKey A 32-bit implementation instance key that is returned from a call to one of the CreateImplementationL() |
|
1556 methods. ECOM uses this implementation instance key when it is passed as an argument to the |
|
1557 DestroyedImplementation() method to identify an implementation for destruction. No meaning should be attached to |
|
1558 this implementation instance key by ECOM clients and it should not be used for any other purpose. |
|
1559 @param aExtendedInterfaceUid Identifies an extended interface to release. |
|
1560 @publishedPartner |
|
1561 @released |
|
1562 */ |
|
1563 EXPORT_C void REComSession::ManuallyReleaseExtendedInterfaceL(const TUid& aInstanceKey, const TUid& aExtendedInterfaceUid) |
|
1564 { |
|
1565 if(aInstanceKey == KNullUid) |
|
1566 User::Leave(KErrArgument); |
|
1567 |
|
1568 CGlobalData* globalData = CGlobalData::Instance(); |
|
1569 if (globalData == 0) |
|
1570 { |
|
1571 __ECOM_LOG("ECOM: PANIC in REComSession::GetExtendedInterfaceL(), no global data"); |
|
1572 User::Panic(KEComClientDLLPanicCategory, EEComPanic_LibraryNotInitialised); |
|
1573 } |
|
1574 |
|
1575 // Leaves with KErrNotFound if aInstanceKey not known. |
|
1576 globalData->LoadManager().ManuallyReleaseExtendedInterfaceL(aInstanceKey, aExtendedInterfaceUid); |
|
1577 } |
|
1578 |
|
1579 /** |
|
1580 Retrieves a list of all the extended interfaces for the provided implementation. |
|
1581 @leave KErrNoMemory |
|
1582 @leave One of the system-wide error codes |
|
1583 @param aImplementationUid Implementation UID to fetch the extended interfaces for. |
|
1584 @param aIfInfo Return value consisting of an array containing the extended interfaces. |
|
1585 @publishedPartner |
|
1586 @released |
|
1587 */ |
|
1588 EXPORT_C void REComSession::ListExtendedInterfacesL(const TUid& aImplementationUid,RExtendedInterfacesArray& aIfInfo) |
|
1589 { |
|
1590 // call FinalClose() in the event of a leave |
|
1591 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
1592 |
|
1593 // Open a local instance for the |
|
1594 // interface creation, because this is a static |
|
1595 // method and we may not be created yet. |
|
1596 REComSession& ecomSession = REComSession::OpenLC(); // NOTE: This will connect to ECom |
|
1597 // using the global instance which is returned. |
|
1598 |
|
1599 ecomSession.ProcessListExtendedInterfacesL(aImplementationUid, aIfInfo); |
|
1600 |
|
1601 CleanupStack::PopAndDestroy(&ecomSession); |
|
1602 CleanupStack::Pop(); // CleanupFinalClose |
|
1603 } |
|
1604 |
|
1605 /** |
|
1606 Process the list extended interface request. |
|
1607 @leave KErrNoMemory |
|
1608 @leave One of the system-wide error codes |
|
1609 @param aImplementationUid Implementation UID to fetch the extended interfaces for. |
|
1610 @param aIfInfo Return value consisting of an array containing the extended interfaces. |
|
1611 */ |
|
1612 void REComSession::ProcessListExtendedInterfacesL(const TUid& aImplementationUid, RExtendedInterfacesArray& aIfInfo) |
|
1613 { |
|
1614 // Ensure the array we have been given is empty |
|
1615 aIfInfo.Reset(); |
|
1616 |
|
1617 __ECOM_TRACE1("ECOM: List Extended Interfaces request for implementation %X", aImplementationUid); |
|
1618 |
|
1619 // Package the parameters |
|
1620 TPckg<TUid> implementationUidDes(aImplementationUid); |
|
1621 TInt bufferSize = KListExtendedInterfaceBufferSize; |
|
1622 TPckg<TInt> bufferSizeDes(bufferSize); |
|
1623 |
|
1624 RBuf8 buf; |
|
1625 buf.CreateMaxL(KListExtendedInterfaceBufferSize); |
|
1626 buf.CleanupClosePushL(); |
|
1627 TIpcArgs arguments(&implementationUidDes, &bufferSizeDes, &buf); |
|
1628 |
|
1629 TInt error = SendReceive(EListExtendedInterfaces,arguments); |
|
1630 |
|
1631 if (error==KErrNone) |
|
1632 { |
|
1633 // When no extended interface is found, KErrNone is returned with bufferSize = 0 |
|
1634 if (bufferSize>0) |
|
1635 { |
|
1636 // Now unpack the streamed data into a reconstructed array |
|
1637 RDesReadStream readStream; |
|
1638 readStream.Open(buf); |
|
1639 CleanupClosePushL(readStream); |
|
1640 CleanupStack::PushL(TCleanupItem(ResetArray, &aIfInfo)); |
|
1641 |
|
1642 TInt entryCount = bufferSize / static_cast<TInt>(sizeof(TUid)); |
|
1643 if(entryCount > 0) |
|
1644 { |
|
1645 TUid interfaceUid; |
|
1646 // Build the store data then calculate the end size; |
|
1647 for(TInt i = 0; i < entryCount; ++i) |
|
1648 { |
|
1649 interfaceUid.iUid = readStream.ReadInt32L(); |
|
1650 aIfInfo.AppendL(interfaceUid); |
|
1651 } |
|
1652 } |
|
1653 CleanupStack::Pop(); // NOT PopAndDestroy - we don't want to destroy the aIfInfo we've just filled |
|
1654 CleanupStack::PopAndDestroy(&readStream); |
|
1655 __ECOM_TRACE1("ECOM: Request completed OK - %d interfaces in list", entryCount); |
|
1656 } |
|
1657 } |
|
1658 else |
|
1659 { |
|
1660 // There was a problem on the server side. |
|
1661 __ECOM_TRACE1("ECOM: Request error %d", error); |
|
1662 User::Leave(error); |
|
1663 } |
|
1664 CleanupStack::PopAndDestroy(&buf); |
|
1665 } |
|
1666 |
|
1667 /** |
|
1668 Gets the corresponding implementation uid for an instance key. |
|
1669 This is typically used after a call to one of the CreateImplementationL() methods |
|
1670 that returns the aInstanceKey value as an output arg or by an offset (aKeyOffset). |
|
1671 @leave KErrNotFound When the supplied 32-bit implementation instance key is not recognised by ECom. |
|
1672 @leave KErrArgument When a null implementation instance key is passed as an argument to ECom. |
|
1673 @leave Any of the other System wide errors |
|
1674 @param aInstanceKey A 32-bit implementation instance key that is returned from a call to one of the CreateImplementationL() |
|
1675 methods. ECOM uses this implementation instance key when it is passed as an argument to the |
|
1676 DestroyedImplementation() method to identify an implementation for destruction. No meaning should be attached to |
|
1677 this implementation instance key by ECOM clients and it should not be used for any other purpose. |
|
1678 @return TUid The uid of the corresponding implementation. |
|
1679 @post REComSession has not changed |
|
1680 */ |
|
1681 EXPORT_C TUid REComSession::GetImplementationUidL(TUid aInstanceKey) |
|
1682 { |
|
1683 if(aInstanceKey == KNullUid) |
|
1684 User::Leave(KErrArgument); |
|
1685 |
|
1686 TUid implId = KNullUid; |
|
1687 CGlobalData* globalData = CGlobalData::Instance(); |
|
1688 if (globalData == 0) |
|
1689 { |
|
1690 __ECOM_LOG("ECOM: PANIC in REComSession::ManuallyReleaseExtendedInterfaceL(), no global data"); |
|
1691 User::Panic(KEComClientDLLPanicCategory, EEComPanic_LibraryNotInitialised); |
|
1692 } |
|
1693 |
|
1694 // Leaves with KErrNotFound if aInstanceKey not known. |
|
1695 implId = globalData->LoadManager().GetImplementationUidL(aInstanceKey); |
|
1696 |
|
1697 return implId; |
|
1698 } |
|
1699 |
|
1700 /** |
|
1701 Signals the destruction of an interface implementation to ECOM. |
|
1702 LoadManager is responsible for destroying the implementation |
|
1703 @param aInstanceKey A 32-bit instance key that is returned from a call to one of the |
|
1704 CreateImplementationL() methods. This instance key identifies the implementation |
|
1705 for destruction. No meaning should be attached to this instance key by ECOM clients |
|
1706 and it should not be used for any other purpose. |
|
1707 @post The destruction of the Interface Implementation referred |
|
1708 to by aInstanceKey |
|
1709 */ |
|
1710 EXPORT_C void REComSession::DestroyedImplementation(TUid aInstanceKey) |
|
1711 { |
|
1712 if(aInstanceKey != KNullUid) |
|
1713 { |
|
1714 CGlobalData* globalData = CGlobalData::Instance(); |
|
1715 if(globalData) |
|
1716 { |
|
1717 if(globalData->LoadManager().DestroyedThis(aInstanceKey)) |
|
1718 { |
|
1719 globalData->EComSession().Close(); |
|
1720 } |
|
1721 } |
|
1722 } |
|
1723 } |
|
1724 /** |
|
1725 Pack the match string of the resolution parameter and extended interfaces into a buffer for sending to server. |
|
1726 @param aResolutionParameters Specifies any additional implementation |
|
1727 characteristics to be fulfilled, maybe empty. |
|
1728 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match, |
|
1729 Must match all extended interfaces for a match to occur. |
|
1730 @param aMatchStrExtInfBuf The return buffer containing the information of match string and extended interfaces. |
|
1731 */ |
|
1732 void REComSession::PackMatchStrAndExtendedInterfacesL(const TEComResolverParams& aResolutionParameters, |
|
1733 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
1734 RBuf8& aMatchStrExtInfBuf) |
|
1735 { |
|
1736 // Note the data type might be an invalid descriptor |
|
1737 // because the client caller may have used a default constructed |
|
1738 // TEComResolverParams. Do not access the descriptor data here. The server |
|
1739 // does not access the data as it checks the size supplied below and |
|
1740 // creates a zero length descriptor in such cases. |
|
1741 TPtrC8 matchString = aResolutionParameters.DataType(); |
|
1742 |
|
1743 TInt lenOfMatchString = matchString.Length(); |
|
1744 TInt numOfExtendedInterfaces = aExtendedInterfaces.Count(); |
|
1745 // sizeOfMatchStrExtInfBuf being the combined size of lenOfmatchType(TInt), matchString, |
|
1746 // numOfExtendedInterfaces(TInt) and extended interfaces |
|
1747 TInt sizeOfMatchStrExtInfBuf = sizeof(TInt) + lenOfMatchString + sizeof(TInt) + numOfExtendedInterfaces * sizeof(TUid); |
|
1748 aMatchStrExtInfBuf.CreateMaxL(sizeOfMatchStrExtInfBuf); |
|
1749 aMatchStrExtInfBuf.CleanupClosePushL(); |
|
1750 RDesWriteStream writeStream; |
|
1751 writeStream.Open(aMatchStrExtInfBuf); |
|
1752 writeStream.WriteInt32L(lenOfMatchString); |
|
1753 //write matchString to the stream only when it's size is not zero |
|
1754 if (lenOfMatchString > 0) |
|
1755 { |
|
1756 writeStream.WriteL(matchString.Ptr(),lenOfMatchString); |
|
1757 } |
|
1758 writeStream.WriteInt32L(numOfExtendedInterfaces); |
|
1759 for(TInt i = 0; i < numOfExtendedInterfaces; ++i) |
|
1760 { |
|
1761 writeStream.WriteInt32L(aExtendedInterfaces[i].iUid); |
|
1762 } |
|
1763 writeStream.CommitL(); |
|
1764 CleanupStack::Pop(&aMatchStrExtInfBuf); |
|
1765 } |
|
1766 |
|
1767 /** |
|
1768 Retrieves a list of all the implementations which satisfy the |
|
1769 specified interface with selection restriction to |
|
1770 the specified parameters. |
|
1771 Overload for internal use to ensure consistency between calls. |
|
1772 This is the method which actually makes the IPC call. |
|
1773 |
|
1774 @leave KErrNoMemory |
|
1775 @leave KErrNotConnected |
|
1776 @leave KErrPermissionDenied |
|
1777 @param aServiceId An integer specifying the ECom service variant to use. |
|
1778 @param aInterfaceUid A UID specifying the required interface. |
|
1779 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match, |
|
1780 Must match all extended interfaces for a match to occur. |
|
1781 @param aResolutionParameters Specifies any additional implementation |
|
1782 characteristics to be fulfilled, maybe empty. |
|
1783 @param aResolverUid The CResolver UID which identifies the resolver |
|
1784 implementation with the required client defined behaviour. |
|
1785 @param aImplInfoArray A reference to a client owned array which will be filled |
|
1786 with interface implementation data. The array will first be cleared and |
|
1787 all items destroyed before adding new data. |
|
1788 @post REComSession has not changed, and aImplInfoArray |
|
1789 contains the list of Implementation information for the interface. |
|
1790 @see TEComResolverParams |
|
1791 */ |
|
1792 void REComSession::ListImplementationsL( |
|
1793 TInt aServiceId, |
|
1794 TUid aInterfaceUid, |
|
1795 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
1796 const TEComResolverParams& aResolutionParameters, |
|
1797 TUid aResolverUid, |
|
1798 RImplInfoPtrArray& aImplInfoArray, |
|
1799 TBool aCapabilityCheck) |
|
1800 { |
|
1801 // Ensure the array we have been given is empty |
|
1802 aImplInfoArray.ResetAndDestroy(); |
|
1803 |
|
1804 __ECOM_TRACE2("ECOM: List implementations request for i/f %X using resolver %08X", aInterfaceUid, aResolverUid); |
|
1805 |
|
1806 // Package the parameters |
|
1807 // Use the UidType because it will hold our 3 possible UIDs |
|
1808 // neatly, and save space in the message parameter passing structure. |
|
1809 TUidType uidtype(aInterfaceUid,KNullUid,aResolverUid); |
|
1810 //1st argument |
|
1811 TPckg<TUidType> uids(uidtype); |
|
1812 |
|
1813 // 2nd argument which includes lenOfmatchString(TInt), matchString, |
|
1814 // numOfExtendedInterfaces(TInt) and extended Interfaces |
|
1815 RBuf8 matchStrExtInfBuf; |
|
1816 PackMatchStrAndExtendedInterfacesL(aResolutionParameters,aExtendedInterfaces,matchStrExtInfBuf); |
|
1817 matchStrExtInfBuf.CleanupClosePushL(); |
|
1818 |
|
1819 //3rd argument |
|
1820 // This KListIMplBufferSize is a patchable constant and this can be modified during buildrom time |
|
1821 TInt bufferSize=GetListImplBufferSize(); |
|
1822 TInt matchType = aResolutionParameters.IsGenericMatch(); |
|
1823 TListImplParam listParam={matchType,bufferSize,aCapabilityCheck}; |
|
1824 TPckg<TListImplParam> listParamPckg(listParam); |
|
1825 |
|
1826 //4th argument |
|
1827 RBuf8 buf; |
|
1828 buf.CreateMaxL(bufferSize); |
|
1829 buf.CleanupClosePushL(); |
|
1830 |
|
1831 TIpcArgs aArgs(&uids,&matchStrExtInfBuf,&listParamPckg,&buf); |
|
1832 |
|
1833 TInt error= SendReceive(aServiceId,aArgs); |
|
1834 if (error == KErrOverflow) |
|
1835 { |
|
1836 //resend the request with the correct buffer size |
|
1837 //Get the new buffer size. |
|
1838 if (listParam.iBufferSize) |
|
1839 { |
|
1840 //re-allocate the buffer |
|
1841 buf.ReAllocL(listParam.iBufferSize); |
|
1842 TIpcArgs args(&buf); |
|
1843 User::LeaveIfError(SendReceive(ECollectImplementationsList,args)); |
|
1844 error=KErrNone; |
|
1845 } |
|
1846 } |
|
1847 if (error==KErrNone) |
|
1848 { |
|
1849 if (listParam.iBufferSize) |
|
1850 { |
|
1851 // Now unpack the streamed data into a reconstructed array |
|
1852 RDesReadStream readStream; |
|
1853 readStream.Open(buf); |
|
1854 |
|
1855 CleanupClosePushL(readStream); |
|
1856 CleanupStack::PushL(TCleanupItem(ResetAndDestroyArray, &aImplInfoArray)); |
|
1857 |
|
1858 TInt entryCount = readStream.ReadInt32L(); |
|
1859 if(entryCount) |
|
1860 { |
|
1861 // Build the store data then calculate the end size; |
|
1862 for(TInt i = 0; i < entryCount; ++i) |
|
1863 { |
|
1864 CImplementationInformation* info = CImplementationInformation::NewLC(ETrue,readStream); |
|
1865 aImplInfoArray.AppendL(info); |
|
1866 CleanupStack::Pop(info); // Now owned by implementations |
|
1867 } |
|
1868 } |
|
1869 |
|
1870 CleanupStack::Pop(); // NOT PopAndDestroy - we don't want to destroy the aImplInfoArray we've just filled |
|
1871 CleanupStack::PopAndDestroy(&readStream); |
|
1872 __ECOM_TRACE1("ECOM: Request completed OK - %d implementations in list", entryCount); |
|
1873 } |
|
1874 } |
|
1875 // if error == KEComErrNoInterfaceIdentified then do nothing so the client gets |
|
1876 // an empty list. Otherwise leave with the error. |
|
1877 else if(error != KEComErrNoInterfaceIdentified) |
|
1878 { |
|
1879 CleanupStack::PopAndDestroy(&buf); |
|
1880 // There was a problem on the server side |
|
1881 __ECOM_TRACE1("ECOM: Request error %d", error); |
|
1882 User::Leave(error); |
|
1883 } |
|
1884 CleanupStack::PopAndDestroy(&buf); |
|
1885 CleanupStack::PopAndDestroy(&matchStrExtInfBuf); |
|
1886 } |
|
1887 |
|
1888 /** |
|
1889 Provides the instantiation method for an interface implementation |
|
1890 that satisfies the specified interface. |
|
1891 |
|
1892 @leave KErrNoMemory |
|
1893 @leave KErrNotConnected |
|
1894 @leave KErrPermissionDenied |
|
1895 @param aImplementationUid A UID specifying the required interface implementation. |
|
1896 @param aInstanceKey A 32 bit instance key returned by the ECom framework that |
|
1897 identifies the returned instance. |
|
1898 @param aCreationParameters A pointer to the creation parameter |
|
1899 structure passed to the creation method when called. |
|
1900 @param aCreationParamsFlag A boolean flag to indicate the existence or non-existence |
|
1901 of aCreationParameters. Will be ETrue even for if the value of |
|
1902 aCreationParameters is NULL. |
|
1903 @return TAny* a pointer to the fully constructed implementation |
|
1904 @post The requested interface implementation is identified, |
|
1905 and the instantiation method pointer is returned. |
|
1906 */ |
|
1907 TAny* REComSession::ResolveAndCreateImplL(TUid aImplementationUid, |
|
1908 TUid& aInstanceKey, |
|
1909 TAny* aCreationParameters, TBool aCreationParamsFlag) |
|
1910 { |
|
1911 TEComResolverParams resolutionParameters; |
|
1912 RExtendedInterfacesArray extendedInterfaces; |
|
1913 CleanupClosePushL(extendedInterfaces); |
|
1914 TAny* object = ResolveAndCreateImplL(EGetImplementationCreationMethod, |
|
1915 aImplementationUid, |
|
1916 extendedInterfaces, |
|
1917 resolutionParameters, |
|
1918 KNullUid, |
|
1919 aInstanceKey, |
|
1920 aCreationParameters, aCreationParamsFlag); |
|
1921 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
1922 return object; |
|
1923 } |
|
1924 |
|
1925 /** |
|
1926 Provides the instantiation method for an interface implementation |
|
1927 that satisfies the specified interface. |
|
1928 |
|
1929 @leave KErrNoMemory |
|
1930 @leave KErrNotConnected |
|
1931 @leave KErrPermissionDenied |
|
1932 @param aInterfaceUid A UID specifying the required interface. |
|
1933 @param aResolutionParameters Specifies any additional implementation |
|
1934 characteristics to be fulfilled, maybe empty. |
|
1935 @param aInstanceKey A 32 bit instance key returned by the ECom framework that |
|
1936 identifies the returned instance. |
|
1937 @param aCreationParameters A pointer to the creation parameter |
|
1938 structure passed to the creation method when called. |
|
1939 @param aCreationParamsFlag A boolean flag to indicate the existence or non-existence |
|
1940 of aCreationParameters. Will be ETrue even for if the value of |
|
1941 aCreationParameters is NULL. |
|
1942 @return TAny* a pointer to the fully constructed implementation |
|
1943 @post The requested interface implementation is identified, |
|
1944 and the instantiation method pointer is returned. |
|
1945 @see TEComResolverParams |
|
1946 */ |
|
1947 TAny* REComSession::ResolveAndCreateImplL(TUid aInterfaceUid, |
|
1948 const TEComResolverParams& aResolutionParameters, |
|
1949 TUid& aInstanceKey, |
|
1950 TAny* aCreationParameters, TBool aCreationParamsFlag) |
|
1951 { |
|
1952 RExtendedInterfacesArray extendedInterfaces; |
|
1953 CleanupClosePushL(extendedInterfaces); |
|
1954 TAny* object = ResolveAndCreateImplL(EGetResolvedCreationMethod, |
|
1955 aInterfaceUid, |
|
1956 extendedInterfaces, |
|
1957 aResolutionParameters, |
|
1958 KNullUid, |
|
1959 aInstanceKey, |
|
1960 aCreationParameters, aCreationParamsFlag); |
|
1961 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
1962 return object; |
|
1963 } |
|
1964 |
|
1965 /** |
|
1966 Provides the instantiation method for an interface implementation |
|
1967 that satisfies the specified interface. |
|
1968 |
|
1969 @leave KErrNoMemory |
|
1970 @leave KErrNotConnected |
|
1971 @leave KErrPermissionDenied |
|
1972 @param aInterfaceUid A UID specifying the required interface. |
|
1973 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
1974 Must match all extended interfaces for a match to occur. |
|
1975 @param aResolutionParameters Specifies any additional implementation |
|
1976 characteristics to be fulfilled, maybe empty. |
|
1977 @param aInstanceKey A 32 bit instance key returned by the ECom framework that |
|
1978 identifies the returned instance. |
|
1979 @param aCreationParameters A pointer to the creation parameter |
|
1980 structure passed to the creation method when called. |
|
1981 @param aCreationParamsFlag A boolean flag to indicate the existence or non-existence |
|
1982 of aCreationParameters. Will be ETrue even for if the value of |
|
1983 aCreationParameters is NULL. |
|
1984 @return TAny* a pointer to the fully constructed implementation |
|
1985 @post The requested interface implementation is identified, |
|
1986 and the instantiation method pointer is returned. |
|
1987 @see TEComResolverParams |
|
1988 */ |
|
1989 TAny* REComSession::ResolveAndCreateImplL(TUid aInterfaceUid, |
|
1990 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
1991 const TEComResolverParams& aResolutionParameters, |
|
1992 TUid& aInstanceKey, |
|
1993 TAny* aCreationParameters, TBool aCreationParamsFlag) |
|
1994 { |
|
1995 return ResolveAndCreateImplL(EGetResolvedCreationMethod, |
|
1996 aInterfaceUid, |
|
1997 aExtendedInterfaces, |
|
1998 aResolutionParameters, |
|
1999 KNullUid, |
|
2000 aInstanceKey, |
|
2001 aCreationParameters, aCreationParamsFlag); |
|
2002 } |
|
2003 /** |
|
2004 Provides the instantiation method for an interface implementation |
|
2005 that satisfies the specified interface. |
|
2006 Overload with a client provided CResolver. |
|
2007 |
|
2008 @leave KErrNoMemory |
|
2009 @leave KErrNotConnected |
|
2010 @leave KErrPermissionDenied |
|
2011 @param aInterfaceUid A UID specifying the required interface. |
|
2012 @param aResolutionParameters Specifies any additional implementation |
|
2013 characteristics to be fulfilled, maybe empty. |
|
2014 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
2015 @param aInstanceKey A 32 bit instance key returned by the ECom framework that |
|
2016 identifies the returned instance. |
|
2017 @param aCreationParameters A pointer to the creation parameter |
|
2018 structure passed to the creation method when called. |
|
2019 @param aCreationParamsFlag A boolean flag to indicate the existence or non-existence |
|
2020 of aCreationParameters. Will be ETrue even for if the value of |
|
2021 aCreationParameters is NULL. |
|
2022 @return TAny* a pointer to the fully constructed implementation |
|
2023 @post The requested interface implementation is identified, |
|
2024 and the instantiation method pointer is returned. |
|
2025 @see TEComResolverParams |
|
2026 */ |
|
2027 TAny* REComSession::ResolveAndCreateImplL(TUid aInterfaceUid, |
|
2028 const TEComResolverParams& aResolutionParameters, |
|
2029 TUid aResolverUid, |
|
2030 TUid& aInstanceKey, |
|
2031 TAny* aCreationParameters, TBool aCreationParamsFlag) |
|
2032 { |
|
2033 RExtendedInterfacesArray extendedInterfaces; |
|
2034 CleanupClosePushL(extendedInterfaces); |
|
2035 TAny* object = ResolveAndCreateImplL(EGetCustomResolvedCreationMethod, |
|
2036 aInterfaceUid, |
|
2037 extendedInterfaces, |
|
2038 aResolutionParameters, |
|
2039 aResolverUid, |
|
2040 aInstanceKey, |
|
2041 aCreationParameters, aCreationParamsFlag); |
|
2042 CleanupStack::PopAndDestroy(&extendedInterfaces); |
|
2043 return object; |
|
2044 } |
|
2045 |
|
2046 /** |
|
2047 Provides the instantiation method for an interface implementation |
|
2048 that satisfies the specified interface. |
|
2049 Overload with a client provided CResolver. |
|
2050 |
|
2051 @leave KErrNoMemory |
|
2052 @leave KErrNotConnected |
|
2053 @leave KErrPermissionDenied |
|
2054 @param aInterfaceUid A UID specifying the required interface. |
|
2055 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
2056 Must match all extended interfaces for a match to occur. |
|
2057 @param aResolutionParameters Specifies any additional implementation |
|
2058 characteristics to be fulfilled, maybe empty. |
|
2059 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
2060 @param aInstanceKey A 32 bit instance key returned by the ECom framework that |
|
2061 identifies the returned instance. |
|
2062 @param aCreationParameters A pointer to the creation parameter |
|
2063 structure passed to the creation method when called. |
|
2064 @param aCreationParamsFlag A boolean flag to indicate the existence or non-existence |
|
2065 of aCreationParameters. Will be ETrue even for if the value of |
|
2066 aCreationParameters is NULL. |
|
2067 @return TAny* a pointer to the fully constructed implementation |
|
2068 @post The requested interface implementation is identified, |
|
2069 and the instantiation method pointer is returned. |
|
2070 @see TEComResolverParams |
|
2071 */ |
|
2072 TAny* REComSession::ResolveAndCreateImplL(TUid aInterfaceUid, |
|
2073 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
2074 const TEComResolverParams& aResolutionParameters, |
|
2075 TUid aResolverUid, |
|
2076 TUid& aInstanceKey, |
|
2077 TAny* aCreationParameters, TBool aCreationParamsFlag) |
|
2078 { |
|
2079 |
|
2080 return ResolveAndCreateImplL(EGetCustomResolvedCreationMethod, |
|
2081 aInterfaceUid, |
|
2082 aExtendedInterfaces, |
|
2083 aResolutionParameters, |
|
2084 aResolverUid, |
|
2085 aInstanceKey, |
|
2086 aCreationParameters, aCreationParamsFlag); |
|
2087 } |
|
2088 |
|
2089 /** |
|
2090 Provides the instantiation method for an interface implementation |
|
2091 that satisfies the specified interface. |
|
2092 Overload for internal use to ensure consistency between calls. |
|
2093 This is the method which actually makes the IPC call. |
|
2094 |
|
2095 @leave KErrNoMemory |
|
2096 @leave KErrNotConnected |
|
2097 @leave KErrPermissionDenied |
|
2098 @param aServiceId An integer specifying the ECom service variant to use. |
|
2099 @param aInterfaceUid A UID specifying the required interface. |
|
2100 @param aExtendedInterfaces Identifies a set of zero or more extended interfaces to match. |
|
2101 Must match all extended interfaces for a match to occur. |
|
2102 @param aResolutionParameters Specifies any additional implementation |
|
2103 characteristics to be fulfilled, maybe empty. |
|
2104 @param aResolverUid The Uid of a CResolver with client defined behaviour. |
|
2105 @param aInstanceKey A 32 bit instance key returned by the ECom framework that |
|
2106 identifies the returned instance. |
|
2107 @param aCreationParameters A pointer to the creation parameter |
|
2108 structure passed to the creation method when called. |
|
2109 @param aCreationParamsFlag A boolean flag to indicate the existence or non-existence |
|
2110 of aCreationParameters. Will be ETrue even for if the value of |
|
2111 aCreationParameters is NULL. |
|
2112 @return TAny* a pointer to the fully constructed implementation |
|
2113 @post The requested interface implementation is identified, |
|
2114 and the instantiation method pointer is returned. |
|
2115 @see TEComResolverParams |
|
2116 */ |
|
2117 TAny* REComSession::ResolveAndCreateImplL(TInt aServiceId, |
|
2118 TUid aInterfaceUid, |
|
2119 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
2120 const TEComResolverParams& aResolutionParameters, |
|
2121 TUid aResolverUid, |
|
2122 TUid& aInstanceKey, |
|
2123 TAny* aCreationParameters, TBool aCreationParamsFlag) |
|
2124 { |
|
2125 // Package the parameters |
|
2126 // 1st argument. Use the UidType because it will hold our 3 possible UIDs |
|
2127 // (aInterfaceUid, aInstanceKey and aResolverUid) |
|
2128 // neatly, and save space in the message parameter passing structure. |
|
2129 TUidType uidStore(aInterfaceUid, aInstanceKey, aResolverUid); |
|
2130 TPckg<TUidType> uids(uidStore); |
|
2131 // Store the arguments, note the data type might ba an invalid descriptor |
|
2132 // beacuse the client caller may have used a default constructed |
|
2133 // TEComResolverParams. Do not access the descriptor data here. The server |
|
2134 // does not access the data as it checks the size supplied below and |
|
2135 // creates a zero length descriptor in such cases. |
|
2136 |
|
2137 // 2nd argument which includes lenOfmatchString(TInt), matchString, |
|
2138 // numOfExtendedInterfaces(TInt) and extended Interfaces |
|
2139 RBuf8 matchStrExtInfBuf; |
|
2140 PackMatchStrAndExtendedInterfacesL(aResolutionParameters,aExtendedInterfaces,matchStrExtInfBuf); |
|
2141 matchStrExtInfBuf.CleanupClosePushL(); |
|
2142 |
|
2143 // 3rd argument |
|
2144 TInt matchType = aResolutionParameters.IsGenericMatch(); |
|
2145 |
|
2146 // 4th argument |
|
2147 TEntry dllInfo; |
|
2148 TPckg<TEntry> dllPkg(dllInfo); |
|
2149 |
|
2150 // And call the server |
|
2151 User::LeaveIfError(SendReceive(aServiceId, TIpcArgs(&uids,&matchStrExtInfBuf,matchType,&dllPkg))); |
|
2152 CleanupStack::PopAndDestroy(&matchStrExtInfBuf); |
|
2153 // delegate to LoadManager to instantiate the object |
|
2154 CGlobalData* globalData = CGlobalData::Instance(); |
|
2155 TAny* object=(TAny*)globalData->LoadManager().ImplementationObjectL(uidStore[KDtorKeyUidIndex], |
|
2156 dllInfo, |
|
2157 aCreationParameters, |
|
2158 aCreationParamsFlag, |
|
2159 aInstanceKey); |
|
2160 return object; |
|
2161 } |
|
2162 |
|
2163 |
|
2164 /** |
|
2165 This method is provided for the internal testing of the ECOM component. |
|
2166 @param aArgs Arguments used for sending and receiving parameters |
|
2167 @leave ... One of the system-wide error codes |
|
2168 @internalComponent |
|
2169 */ |
|
2170 EXPORT_C void REComSession::SetGetParametersL(const TIpcArgs &aArgs) |
|
2171 { |
|
2172 // Open a local instance for the |
|
2173 // interface creation, because this is a static |
|
2174 // method and we may be not created yet. |
|
2175 |
|
2176 // call FinalClose() in the event of a leave |
|
2177 CleanupStack::PushL(TCleanupItem(CleanupFinalClose, NULL)); |
|
2178 |
|
2179 // NOTE: This will connect to ECom |
|
2180 // using the global instance which is returned. |
|
2181 REComSession& ecomSession = REComSession::OpenLC(); |
|
2182 |
|
2183 TInt error = ecomSession.SendReceive(ESetGetParameters, aArgs); |
|
2184 if(error != KErrNone) |
|
2185 { |
|
2186 // There was a problem on the server side |
|
2187 __ECOM_TRACE1("ECOM: Request error %d.", error); |
|
2188 User::Leave(error); |
|
2189 } |
|
2190 |
|
2191 CleanupStack::PopAndDestroy(&ecomSession); |
|
2192 CleanupStack::Pop(); // CleanupFinalClose |
|
2193 } |
|
2194 |
|
2195 |