1 /* |
|
2 * Copyright (c) 2008 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: Entry function definition and ECOM plugin definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System Includes |
|
20 #include <ecom/implementationproxy.h> |
|
21 #include <AknNotifierWrapper.h> |
|
22 |
|
23 //User Includes |
|
24 #include "evtnotifierpluginuid.hrh" |
|
25 #include "evtinfonoteinterface.h" |
|
26 #include "evtdebug.h" |
|
27 |
|
28 const MEikSrvNotifierBase2::TNotifierPriority KNotifierPriority = |
|
29 MEikSrvNotifierBase2::ENotifierPriorityHigh; |
|
30 |
|
31 // Constant Definitions |
|
32 const TInt KMaxSynchReplyBufLength = 256; |
|
33 |
|
34 // ======== LOCAL FUNCTIONS ======== |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // Helper method to perform cleanup of the CArrayPtrFlat array object. |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 void CleanupArray( TAny* aArray ) |
|
41 { |
|
42 EVTUIDEBUG( "+ CEvtInfoNotePlugin::CleanupArray" ); |
|
43 CArrayPtrFlat< MEikSrvNotifierBase2 >* subjects = |
|
44 static_cast< CArrayPtrFlat< MEikSrvNotifierBase2 >* >( aArray ); |
|
45 TInt lastInd = subjects->Count() - 1; |
|
46 for ( TInt i = lastInd; i >= 0; i-- ) |
|
47 { |
|
48 subjects->At( i )->Release(); |
|
49 } |
|
50 delete subjects; |
|
51 EVTUIDEBUG( "- CEvtInfoNotePlugin::CleanupArray" ); |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // Creates an array of Notifer objects |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CArrayPtr< MEikSrvNotifierBase2 >* DoCreateNotifierArrayL() |
|
59 { |
|
60 EVTUIDEBUG( "+ CEvtInfoNotePlugin::DoCreateNotifierArrayL" ); |
|
61 // Create an array of Notifier objects |
|
62 CArrayPtrFlat< MEikSrvNotifierBase2 >* subjects = |
|
63 new ( ELeave )CArrayPtrFlat< MEikSrvNotifierBase2 >( 3 ); |
|
64 CleanupStack::PushL( TCleanupItem( CleanupArray, subjects )); |
|
65 |
|
66 CAknCommonNotifierWrapper* master = |
|
67 CAknCommonNotifierWrapper::NewL( |
|
68 KEvtInfoNote, |
|
69 KEvtInfoNoteChannel, |
|
70 KNotifierPriority, |
|
71 _L("evtinfonote.dll"), |
|
72 KMaxSynchReplyBufLength); |
|
73 |
|
74 subjects->AppendL( master ); |
|
75 |
|
76 CleanupStack::Pop( subjects ); |
|
77 EVTUIDEBUG( "- CEvtInfoNotePlugin::DoCreateNotifierArrayL" ); |
|
78 return( subjects ); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // ECOM plugin instantiation function |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 CArrayPtr< MEikSrvNotifierBase2 >* NotifierArray() |
|
86 { |
|
87 EVTUIDEBUG( "+ CEvtInfoNotePlugin::NotifierArray" ); |
|
88 CArrayPtr< MEikSrvNotifierBase2 >* array = NULL; |
|
89 TRAPD( error, array = DoCreateNotifierArrayL()); |
|
90 if ( error ) |
|
91 { |
|
92 return NULL; |
|
93 } |
|
94 EVTUIDEBUG( "- CEvtInfoNotePlugin::NotifierArray" ); |
|
95 return array; |
|
96 } |
|
97 |
|
98 /** |
|
99 * Events UI Notifier ECom implementation table. |
|
100 */ |
|
101 const TImplementationProxy KEvtNotifiersImplTable[] = |
|
102 { |
|
103 IMPLEMENTATION_PROXY_ENTRY( KEvtNotiferPluginImplUid, NotifierArray ) |
|
104 }; |
|
105 |
|
106 // ======== GLOBAL FUNCTIONS ======== |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // ImplementationGroupProxy |
|
110 // Gate/factory function |
|
111 // |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
115 { |
|
116 EVTUIDEBUG( "+ CEvtInfoNotePlugin::ImplementationGroupProxy" ); |
|
117 aTableCount = sizeof( KEvtNotifiersImplTable ) / sizeof( TImplementationProxy ); |
|
118 EVTUIDEBUG( "- CEvtInfoNotePlugin::ImplementationGroupProxy" ); |
|
119 return KEvtNotifiersImplTable; |
|
120 } |
|