|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CCCHPluginHandler implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <ecom/ecom.h> |
|
21 |
|
22 #include "cchlogger.h" |
|
23 #include "cchpluginhandler.h" |
|
24 #include "cchplugin.h" |
|
25 #include "cchservice.h" |
|
26 #include "cchservicehandler.h" |
|
27 #include "cchserverbase.h" |
|
28 |
|
29 // EXTERNAL DATA STRUCTURES |
|
30 // None |
|
31 |
|
32 // EXTERNAL FUNCTION PROTOTYPES |
|
33 // None |
|
34 |
|
35 // CONSTANTS |
|
36 // None |
|
37 |
|
38 // MACROS |
|
39 // None |
|
40 |
|
41 // LOCAL CONSTANTS AND MACROS |
|
42 // None |
|
43 |
|
44 // MODULE DATA STRUCTURES |
|
45 // None |
|
46 |
|
47 // LOCAL FUNCTION PROTOTYPES |
|
48 // None |
|
49 |
|
50 // FORWARD DECLARATIONS |
|
51 // None |
|
52 |
|
53 // ============================= LOCAL FUNCTIONS ============================= |
|
54 |
|
55 // ============================ MEMBER FUNCTIONS ============================= |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CCCHPluginHandler::CCCHPluginHandler |
|
59 // C++ default constructor can NOT contain any code, that might leave. |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CCCHPluginHandler::CCCHPluginHandler( CCCHServerBase& aServer ) : |
|
63 iServer( aServer ) |
|
64 { |
|
65 // No implementation required |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CCCHPluginHandler::NewL |
|
70 // Two-phased constructor. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 CCCHPluginHandler* CCCHPluginHandler::NewL( CCCHServerBase& aServer ) |
|
74 { |
|
75 CCCHPluginHandler* self = new (ELeave) CCCHPluginHandler( aServer ); |
|
76 return self; |
|
77 } |
|
78 |
|
79 // Destructor |
|
80 CCCHPluginHandler::~CCCHPluginHandler() |
|
81 { |
|
82 // Delete and close Plug-in array |
|
83 iPlugins.ResetAndDestroy(); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CCCHPluginHandler::LoadPluginsL |
|
88 // |
|
89 // (other items were commented in a header). |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CCCHPluginHandler::LoadPluginsL() |
|
93 { |
|
94 CCHLOGSTRING( "CCCHPluginHandler::LoadPluginsL" ); |
|
95 |
|
96 RImplInfoPtrArray pImplInfoArray; |
|
97 CleanupStack::PushL( TCleanupItem( ResetAndDestroy, &pImplInfoArray ) ); |
|
98 |
|
99 REComSession::ListImplementationsL( |
|
100 KCCHConnectivityPluginIFUid, pImplInfoArray ); |
|
101 |
|
102 CCHLOGSTRING2( "Available Plug-ins count: %d", pImplInfoArray.Count() ); |
|
103 |
|
104 TInt found( KErrNone ); |
|
105 |
|
106 for ( TInt i( 0 ); i < pImplInfoArray.Count(); i++ ) |
|
107 { |
|
108 found = Find( pImplInfoArray[ i ]->ImplementationUid() ); |
|
109 |
|
110 if ( KErrNotFound == found ) |
|
111 { |
|
112 CCCHPlugin* pPlugin = CCCHPlugin::NewL( |
|
113 pImplInfoArray[ i ]->ImplementationUid() ); |
|
114 |
|
115 iPlugins.Append( pPlugin ); |
|
116 |
|
117 CCHLOGSTRING2( " Append Plug-in with Uid: 0x%X", |
|
118 pImplInfoArray[ i ]->ImplementationUid() ); |
|
119 } |
|
120 } |
|
121 |
|
122 CleanupStack::PopAndDestroy( &pImplInfoArray ); |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CCCHPluginHandler::LoadPluginsL |
|
127 // |
|
128 // (other items were commented in a header). |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 void CCCHPluginHandler::LoadPluginsL( const TUid& aUid ) |
|
132 { |
|
133 CCHLOGSTRING( "CCCHPluginHandler::LoadPluginsL" ); |
|
134 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
135 |
|
136 TBool found( Find( aUid ) ); |
|
137 |
|
138 if ( KErrNotFound == found ) |
|
139 { |
|
140 CCCHPlugin* pPlugin = CCCHPlugin::NewL( aUid ); |
|
141 |
|
142 iPlugins.Append( pPlugin ); |
|
143 |
|
144 CCHLOGSTRING2( " Append Plug-in with Uid: 0x%X", aUid ); |
|
145 } |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CCCHPluginHandler::UnloadPlugin |
|
150 // |
|
151 // (other items were commented in a header). |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 void CCCHPluginHandler::UnloadPlugin( const TUid& aUid ) |
|
155 { |
|
156 CCHLOGSTRING( "CCCHPluginHandler::UnloadPlugin" ); |
|
157 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
158 |
|
159 TInt found( Find( aUid ) ); |
|
160 |
|
161 if ( KErrNotFound != found ) |
|
162 { |
|
163 CCCHPlugin* pPlugin = iPlugins[ found ]; |
|
164 iPlugins.Remove( found ); |
|
165 delete pPlugin; |
|
166 |
|
167 CCHLOGSTRING( " Plugin unloaded."); |
|
168 } |
|
169 else |
|
170 { |
|
171 CCHLOGSTRING( " Plugin not found, cannot unload." ); |
|
172 } |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CCCHPluginHandler::EnableServiceL |
|
177 // |
|
178 // (other items were commented in a header). |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 void CCCHPluginHandler::EnableServiceL( |
|
182 const TUint32 aServiceId, |
|
183 const RArray<TUid>& aUids, |
|
184 const TCCHSubserviceType aType, |
|
185 MCCHServiceNotifier* aNotifier, |
|
186 const TUint32 aIapId, |
|
187 const TBool /*aConnectivityCheck*/ ) |
|
188 { |
|
189 CCHLOGSTRING( "CCCHPluginHandler::EnableServiceL" ); |
|
190 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
191 CCHLOGSTRING2( " Iap Id: %d", aIapId ); |
|
192 |
|
193 TInt found( KErrNone ); |
|
194 |
|
195 for ( TInt i( 0 ); i < aUids.Count(); i++ ) |
|
196 { |
|
197 CCHLOGSTRING2( " Uid: 0x%X", aUids[ i ] ); |
|
198 |
|
199 TRAP_IGNORE( LoadPluginsL( aUids[ i ] ) ); |
|
200 found = Find( aUids[ i ] ); |
|
201 if ( KErrNotFound != found ) |
|
202 { |
|
203 if ( aNotifier ) |
|
204 { |
|
205 iPlugins[ found ]->SetServiceNotifier( aNotifier ); |
|
206 } |
|
207 |
|
208 TCCHSubserviceState state = ECCHUninitialized; |
|
209 const CCCHPlugin* plugin = iPlugins[ found ]; |
|
210 plugin->Plugin()->GetServiceState( |
|
211 TServiceSelection( aServiceId, aType ), |
|
212 state ); |
|
213 |
|
214 // check current service state |
|
215 if( state==ECCHDisconnecting ) |
|
216 { |
|
217 // return KErrNotReady back to client |
|
218 User::Leave( KErrNotReady ); |
|
219 } |
|
220 |
|
221 !aIapId ? plugin->Plugin()->EnableServiceL( |
|
222 TServiceSelection( aServiceId, aType ) ) : |
|
223 plugin->Plugin()->EnableServiceL( |
|
224 TServiceSelection( aServiceId, aType ), |
|
225 aIapId ); |
|
226 } |
|
227 } |
|
228 } |
|
229 // --------------------------------------------------------------------------- |
|
230 // CCCHPluginHandler::DisableServiceL |
|
231 // |
|
232 // (other items were commented in a header). |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 void CCCHPluginHandler::DisableServiceL( |
|
236 const TUint32 aServiceId, |
|
237 const RArray<TUid>& aUids, |
|
238 const TCCHSubserviceType aType ) const |
|
239 { |
|
240 CCHLOGSTRING( "CCCHPluginHandler::DisableServiceL" ); |
|
241 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
242 |
|
243 TInt found( KErrNone ); |
|
244 |
|
245 for ( TInt i( 0 ); i < aUids.Count(); i++ ) |
|
246 { |
|
247 CCHLOGSTRING2( " Uid: 0x%X", aUids[ i ] ); |
|
248 |
|
249 found = Find( aUids[ i ] ); |
|
250 |
|
251 if ( KErrNotFound != found ) |
|
252 { |
|
253 TRAP_IGNORE(iPlugins[ found ]->Plugin()->DisableServiceL( |
|
254 TServiceSelection( aServiceId, aType ) ) ); |
|
255 } |
|
256 } |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // CCCHPluginHandler::GetServiceState |
|
261 // |
|
262 // (other items were commented in a header). |
|
263 // --------------------------------------------------------------------------- |
|
264 // |
|
265 void CCCHPluginHandler::GetServiceState( |
|
266 const TUint32 aServiceId, |
|
267 const TUid aUid, |
|
268 const TCCHSubserviceType aType, |
|
269 TCCHSubserviceState& aState, |
|
270 TInt& aError ) |
|
271 { |
|
272 CCHLOGSTRING( "CCCHPluginHandler::GetServiceState" ); |
|
273 CCHLOGSTRING2( "CCCHPluginHandler::GetServiceState: Service Id: %d", aServiceId ); |
|
274 CCHLOGSTRING2( "CCCHPluginHandler::GetServiceState: Uid: 0x%X", aUid ); |
|
275 |
|
276 TInt found( Find( aUid ) ); |
|
277 |
|
278 if ( KErrNotFound != found ) |
|
279 { |
|
280 aError = iPlugins[ found ]->Plugin()->GetServiceState( |
|
281 TServiceSelection( aServiceId, aType ), aState ); |
|
282 } |
|
283 |
|
284 CCHLOGSTRING3( "CCCHPluginHandler::GetServiceState: State, error: %d, %d", aState, aError ); |
|
285 } |
|
286 |
|
287 // --------------------------------------------------------------------------- |
|
288 // CCCHPluginHandler::ReserveService |
|
289 // |
|
290 // (other items were commented in a header). |
|
291 // --------------------------------------------------------------------------- |
|
292 // |
|
293 TInt CCCHPluginHandler::ReserveService( |
|
294 const TUint32 aServiceId,const TUid aUid, const TCCHSubserviceType aType ) |
|
295 { |
|
296 CCHLOGSTRING( "CCCHPluginHandler::ReserveService" ); |
|
297 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
298 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
299 |
|
300 TInt found( Find( aUid ) ); |
|
301 |
|
302 if ( KErrNotFound != found ) |
|
303 { |
|
304 found = iPlugins[ found ]->Plugin()->ReserveService( |
|
305 TServiceSelection( aServiceId, aType ) ); |
|
306 } |
|
307 |
|
308 return found; |
|
309 } |
|
310 |
|
311 // --------------------------------------------------------------------------- |
|
312 // CCCHPluginHandler::FreeService |
|
313 // |
|
314 // (other items were commented in a header). |
|
315 // --------------------------------------------------------------------------- |
|
316 // |
|
317 TInt CCCHPluginHandler::FreeService( |
|
318 const TUint32 aServiceId,const TUid aUid, const TCCHSubserviceType aType ) |
|
319 { |
|
320 CCHLOGSTRING( "CCCHPluginHandler::FreeService" ); |
|
321 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
322 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
323 |
|
324 TInt found( Find( aUid ) ); |
|
325 |
|
326 if ( KErrNotFound != found ) |
|
327 { |
|
328 found = iPlugins[ found ]->Plugin()->FreeService( |
|
329 TServiceSelection( aServiceId, aType ) ); |
|
330 } |
|
331 |
|
332 return found; |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // CCCHPluginHandler::IsReserved |
|
337 // |
|
338 // (other items were commented in a header). |
|
339 // --------------------------------------------------------------------------- |
|
340 // |
|
341 TBool CCCHPluginHandler::IsReserved( |
|
342 const TUint32 aServiceId,const TUid aUid, |
|
343 const TCCHSubserviceType aType ) const |
|
344 { |
|
345 CCHLOGSTRING( "CCCHPluginHandler::ReferenceCount" ); |
|
346 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
347 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
348 |
|
349 TInt found( Find( aUid ) ); |
|
350 TBool ret(EFalse); |
|
351 if ( KErrNotFound != found ) |
|
352 { |
|
353 ret = iPlugins[ found ]->Plugin()->IsReserved( |
|
354 TServiceSelection( aServiceId, aType ) ); |
|
355 } |
|
356 |
|
357 return ret; |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------------------------- |
|
361 // CCCHPluginHandler::GetServiceNetworkInfo |
|
362 // |
|
363 // (other items were commented in a header). |
|
364 // --------------------------------------------------------------------------- |
|
365 // |
|
366 TInt CCCHPluginHandler::GetServiceNetworkInfo( |
|
367 const TUint32 aServiceId, |
|
368 const TUid aUid, |
|
369 const TCCHSubserviceType aType, |
|
370 TUint32& aSnapId, |
|
371 TUint32& aIapId, |
|
372 TBool& aSNAPLocked, |
|
373 TBool& aPasswordSet ) |
|
374 { |
|
375 CCHLOGSTRING( "CCCHPluginHandler::GetServiceNetworkInfo" ); |
|
376 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
377 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
378 |
|
379 TUint snapId( 0 ); |
|
380 TUint iapId( 0 ); |
|
381 |
|
382 TRAP_IGNORE( LoadPluginsL( aUid ) ); |
|
383 TInt found( Find( aUid ) ); |
|
384 TServiceConnectionInfo info(aServiceId, aType, snapId, iapId ); |
|
385 if ( KErrNotFound != found ) |
|
386 { |
|
387 found = iPlugins[ found ]->Plugin()->GetServiceNetworkInfo( |
|
388 info ); |
|
389 } |
|
390 |
|
391 aSnapId = info.iSNAPId; |
|
392 aIapId = info.iIapId; |
|
393 aSNAPLocked = info.iSNAPLocked; |
|
394 aPasswordSet = info.iPasswordSet; |
|
395 |
|
396 CCHLOGSTRING2( " SNAP Id: %d", aSnapId ); |
|
397 CCHLOGSTRING2( " IAP Id: %d", aIapId ); |
|
398 |
|
399 return found; |
|
400 } |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // CCCHPluginHandler::SetSnapIdL |
|
404 // |
|
405 // (other items were commented in a header). |
|
406 // --------------------------------------------------------------------------- |
|
407 // |
|
408 void CCCHPluginHandler::SetSnapIdL( |
|
409 const TUint32 aServiceId, |
|
410 const RArray<TUid>& aUids, |
|
411 const TCCHSubserviceType aType, |
|
412 const TUint32 aSnapId ) |
|
413 { |
|
414 CCHLOGSTRING( "CCCHPluginHandler::SetSnapId" ); |
|
415 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
416 CCHLOGSTRING2( " SNAP Id: %d", aSnapId ); |
|
417 |
|
418 TInt found( KErrNone ); |
|
419 |
|
420 for ( TInt i( 0 ); i < aUids.Count(); i++ ) |
|
421 { |
|
422 CCHLOGSTRING2( " Uid: 0x%X", aUids[ i ] ); |
|
423 |
|
424 TRAP_IGNORE( LoadPluginsL( aUids[ i ] ) ); |
|
425 found = Find( aUids[ i ] ); |
|
426 |
|
427 if ( KErrNotFound != found ) |
|
428 { |
|
429 iPlugins[ found ]->Plugin()->SetSnapId( |
|
430 TServiceSelection( aServiceId, aType ), aSnapId ); |
|
431 } |
|
432 } |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // CCCHPluginHandler::SetIapIdL |
|
437 // |
|
438 // (other items were commented in a header). |
|
439 // --------------------------------------------------------------------------- |
|
440 // |
|
441 void CCCHPluginHandler::SetIapIdL( |
|
442 const TUint32 aServiceId, |
|
443 const RArray<TUid>& aUids, |
|
444 const TCCHSubserviceType aType, |
|
445 const TUint32 aIapId ) |
|
446 { |
|
447 CCHLOGSTRING( "CCCHPluginHandler::SetIapId" ); |
|
448 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
449 CCHLOGSTRING2( " IAP Id: %d", aIapId ); |
|
450 |
|
451 TInt found( KErrNone ); |
|
452 |
|
453 for ( TInt i( 0 ); i < aUids.Count(); i++ ) |
|
454 { |
|
455 CCHLOGSTRING2( " Uid: 0x%X", aUids[ i ] ); |
|
456 |
|
457 TRAP_IGNORE( LoadPluginsL( aUids[ i ] ) ); |
|
458 found = Find( aUids[ i ] ); |
|
459 |
|
460 if ( KErrNotFound != found ) |
|
461 { |
|
462 iPlugins[ found ]->Plugin()->SetIapId( |
|
463 TServiceSelection( aServiceId, aType ), aIapId ); |
|
464 } |
|
465 } |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------------------------- |
|
469 // CCCHPluginHandler::SetUsernameL |
|
470 // |
|
471 // (other items were commented in a header). |
|
472 // --------------------------------------------------------------------------- |
|
473 // |
|
474 void CCCHPluginHandler::SetUsernameL( const TUint32 aServiceId, |
|
475 const RArray<TUid>& aUids, |
|
476 const TCCHSubserviceType aType, |
|
477 const TDesC& aUsername ) |
|
478 { |
|
479 CCHLOGSTRING( "CCCHPluginHandler::SetUsernameL" ); |
|
480 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
481 CCHLOGSTRING2( " Username: %S", &aUsername ); |
|
482 |
|
483 TInt found( KErrNone ); |
|
484 |
|
485 for ( TInt i( 0 ); i < aUids.Count(); i++ ) |
|
486 { |
|
487 CCHLOGSTRING2( " Uid: 0x%X", aUids[ i ] ); |
|
488 |
|
489 LoadPluginsL( aUids[ i ] ); |
|
490 found = Find( aUids[ i ] ); |
|
491 |
|
492 if ( KErrNotFound != found ) |
|
493 { |
|
494 User::LeaveIfError( iPlugins[ found ]->Plugin()->SetConnectionParameter( |
|
495 TServiceSelection( aServiceId, aType ), |
|
496 ECchUsername, aUsername ) ); |
|
497 } |
|
498 else |
|
499 { |
|
500 User::Leave( KErrNotFound ); |
|
501 } |
|
502 } |
|
503 } |
|
504 |
|
505 // --------------------------------------------------------------------------- |
|
506 // CCCHPluginHandler::SetPasswordL |
|
507 // |
|
508 // (other items were commented in a header). |
|
509 // --------------------------------------------------------------------------- |
|
510 // |
|
511 void CCCHPluginHandler::SetPasswordL( const TUint32 aServiceId, |
|
512 const RArray<TUid>& aUids, |
|
513 const TCCHSubserviceType aType, |
|
514 const TDesC& aPassword ) |
|
515 { |
|
516 CCHLOGSTRING( "CCCHPluginHandler::SetPasswordL" ); |
|
517 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
518 CCHLOGSTRING2( " Password: %S", &aPassword ); |
|
519 |
|
520 TInt found( KErrNone ); |
|
521 |
|
522 for ( TInt i( 0 ); i < aUids.Count(); i++ ) |
|
523 { |
|
524 CCHLOGSTRING2( " Uid: 0x%X", aUids[ i ] ); |
|
525 |
|
526 LoadPluginsL( aUids[ i ] ); |
|
527 found = Find( aUids[ i ] ); |
|
528 |
|
529 if ( KErrNotFound != found ) |
|
530 { |
|
531 User::LeaveIfError( iPlugins[ found ]->Plugin()->SetConnectionParameter( |
|
532 TServiceSelection( aServiceId, aType ), |
|
533 ECchPassword, aPassword ) ); |
|
534 } |
|
535 else |
|
536 { |
|
537 User::Leave( KErrNotFound ); |
|
538 } |
|
539 } |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------------------------- |
|
543 // CCCHPluginHandler::GetConnectionParameter |
|
544 // |
|
545 // (other items were commented in a header). |
|
546 // --------------------------------------------------------------------------- |
|
547 // |
|
548 TInt CCCHPluginHandler::GetConnectionParameter( |
|
549 const TUid aUid, |
|
550 const TServiceSelection& aServiceSelection, |
|
551 RBuf& aValue ) |
|
552 { |
|
553 CCHLOGSTRING( "CCCHPluginHandler::GetConnectionParameter" ); |
|
554 CCHLOGSTRING2( " UID: %d", aUid ); |
|
555 CCHLOGSTRING2( " Service Id: %d", aServiceSelection.iServiceId ); |
|
556 |
|
557 TRAP_IGNORE( LoadPluginsL( aUid ) ); |
|
558 TInt retval( Find( aUid ) ); |
|
559 |
|
560 if ( KErrNotFound != retval ) |
|
561 { |
|
562 retval = iPlugins[ retval ]->Plugin()->GetConnectionParameter( |
|
563 aServiceSelection, aServiceSelection.iParameter, |
|
564 aValue ); |
|
565 } |
|
566 |
|
567 CCHLOGSTRING2( "CCCHPluginHandler::GetConnectionParameter: returning %d", retval ); |
|
568 return retval; |
|
569 } |
|
570 |
|
571 // --------------------------------------------------------------------------- |
|
572 // CCCHPluginHandler::GetServiceInfo |
|
573 // |
|
574 // (other items were commented in a header). |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 TInt CCCHPluginHandler::GetServiceInfo( |
|
578 const TUint32 aServiceId, |
|
579 const TUid aUid, |
|
580 const TCCHSubserviceType aType, |
|
581 TDes& aBuffer ) |
|
582 { |
|
583 CCHLOGSTRING( "CCCHPluginHandler::GetServiceInfo" ); |
|
584 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
585 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
586 |
|
587 TRAP_IGNORE( LoadPluginsL( aUid ) ); |
|
588 TInt found( Find( aUid ) ); |
|
589 |
|
590 if ( KErrNotFound != found ) |
|
591 { |
|
592 RBuf buf; |
|
593 TRAPD( error, iPlugins[ found ]->Plugin()-> |
|
594 GetServiceInfoL( TServiceSelection( aServiceId, aType ), |
|
595 buf ) ); |
|
596 aBuffer.Copy( buf ); |
|
597 buf.Close(); |
|
598 found = error; |
|
599 } |
|
600 |
|
601 CCHLOGSTRING2( " Info: %S", &aBuffer ); |
|
602 return found; |
|
603 } |
|
604 |
|
605 // --------------------------------------------------------------------------- |
|
606 // CCCHPluginHandler::IsAvailableL |
|
607 // |
|
608 // (other items were commented in a header). |
|
609 // --------------------------------------------------------------------------- |
|
610 // |
|
611 TBool CCCHPluginHandler::IsAvailableL( |
|
612 const TUint aServiceId, |
|
613 const TUid aUid, |
|
614 const TCCHSubserviceType aType, |
|
615 RArray<TUint32>& aIapIds ) const |
|
616 { |
|
617 CCHLOGSTRING( "CCCHPluginHandler::IsAvailableL" ); |
|
618 CCHLOGSTRING2( " Service Id: %d", aServiceId ); |
|
619 CCHLOGSTRING2( " Uid: 0x%X", aUid ); |
|
620 |
|
621 TInt index( Find( aUid ) ); |
|
622 |
|
623 User::LeaveIfError( index ); |
|
624 |
|
625 return iPlugins[ index ]->Plugin()->IsAvailableL( |
|
626 TServiceSelection( aServiceId, aType ), aIapIds ); |
|
627 } |
|
628 |
|
629 // --------------------------------------------------------------------------- |
|
630 // CCCHPluginHandler::SetServiceNotifier |
|
631 // |
|
632 // (other items were commented in a header). |
|
633 // --------------------------------------------------------------------------- |
|
634 // |
|
635 void CCCHPluginHandler::SetServiceNotifier( |
|
636 MCCHServiceNotifier* aObserver ) |
|
637 { |
|
638 CCHLOGSTRING( "CCCHPluginHandler::SetServiceNotifier" ); |
|
639 |
|
640 for ( TInt i( 0 ); i < iPlugins.Count(); i++ ) |
|
641 { |
|
642 iPlugins[ i ]->SetServiceNotifier( aObserver ); |
|
643 } |
|
644 } |
|
645 |
|
646 // --------------------------------------------------------------------------- |
|
647 // CCCHPluginHandler::RemoveServiceNotifier |
|
648 // |
|
649 // (other items were commented in a header). |
|
650 // --------------------------------------------------------------------------- |
|
651 // |
|
652 void CCCHPluginHandler::RemoveServiceNotifier( |
|
653 MCCHServiceNotifier* aObserver ) |
|
654 { |
|
655 CCHLOGSTRING( "CCCHPluginHandler::RemoveServiceNotifier" ); |
|
656 |
|
657 for ( TInt i( 0 ); i < iPlugins.Count(); i++ ) |
|
658 { |
|
659 iPlugins[ i ]->RemoveServiceNotifier( aObserver ); |
|
660 } |
|
661 } |
|
662 |
|
663 // --------------------------------------------------------------------------- |
|
664 // CCCHPluginHandler::Find |
|
665 // |
|
666 // (other items were commented in a header). |
|
667 // --------------------------------------------------------------------------- |
|
668 // |
|
669 TInt CCCHPluginHandler::Find( const TUid& aUid ) const |
|
670 { |
|
671 CCHLOGSTRING( "CCCHPluginHandler::Find" ); |
|
672 |
|
673 TInt index( KErrNotFound ); |
|
674 |
|
675 for ( TInt i( 0 ); i < iPlugins.Count() && KErrNotFound == index; i++ ) |
|
676 { |
|
677 if ( iPlugins[ i ]->CheckUid( aUid ) ) |
|
678 { |
|
679 index = i; |
|
680 } |
|
681 } |
|
682 |
|
683 CCHLOGSTRING2( "CCCHPluginHandler::Find: index: %d", index ); |
|
684 |
|
685 return index; |
|
686 } |
|
687 |
|
688 // --------------------------------------------------------------------------- |
|
689 // CCCHPluginHandler::ResetAndDestroy |
|
690 // |
|
691 // (other items were commented in a header). |
|
692 // --------------------------------------------------------------------------- |
|
693 // |
|
694 void CCCHPluginHandler::ResetAndDestroy( TAny* aArray ) |
|
695 { |
|
696 RImplInfoPtrArray* array = reinterpret_cast<RImplInfoPtrArray*>( aArray ); |
|
697 array->ResetAndDestroy(); |
|
698 } |
|
699 |
|
700 // ========================== OTHER EXPORTED FUNCTIONS ======================= |
|
701 |
|
702 // End of File |