|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-D72A47FE-23D2-4AD1-92B9-53DD9B64733F-GENID-1-7-1-15-1-1-7-1-6-1-5-1-5-1-4-1-5-1" xml:lang="en"><title>Creating |
|
13 a Notifier ECOM Plug-in</title><shortdesc>To use the Privacy Query and Notification API to create a notifier |
|
14 a licensee must secondly create a notifier ECOM plug-in.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section> <title>Exporting a factory method </title> <p>The notifier |
|
16 is implemented as an ECOM plug-in and has typical ECOM entry point methods. |
|
17 The following code example shows how the <xref href="GUID-56C8D5AB-7D9A-3B20-B699-07F17A87A61C.dita#GUID-56C8D5AB-7D9A-3B20-B699-07F17A87A61C/GUID-38E7BBCF-8F4C-3398-B322-2D3427E4CAC1"><apiname>CPosPrivacyNotifier::NotifierBase(</apiname></xref>) |
|
18 method is used to return the <codeph>MEikSrvNotifierBase2</codeph> pointer |
|
19 required by the Extended Notifier Framework. </p><p>The UID specified |
|
20 in <codeph>IMPLEMENTATION_PROXY_ENTRY</codeph> is the constant <codeph>KPosPrivacyNotifierImplUid</codeph> as |
|
21 defined in <filepath>EPos_PrivacyNotifier.hrh</filepath>. </p> <codeblock xml:space="preserve">#include <e32base.h> |
|
22 #include <eiknotapi.h> |
|
23 #include <ImplementationProxy.h> |
|
24 #include <EPos_PrivacyNotifier.hrh> |
|
25 #include "CMyPrivacyNotifier.h" |
|
26 |
|
27 // Creates the notifier. Used by the NotifierArray() factory method. |
|
28 LOCAL_C void CreateNotifiersL(CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers) |
|
29 { |
|
30 CMyPrivacyNotifier* notifier = CMyPrivacyNotifier::NewLC(); |
|
31 aNotifiers->AppendL(notifier->NotifierBase()); |
|
32 CleanupStack::Pop(notifier); // Do not destroy |
|
33 } |
|
34 // Notifier entry point. Note that the factory method must not leave |
|
35 LOCAL_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray() |
|
36 { |
|
37 CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = |
|
38 new CArrayPtrFlat<MEikSrvNotifierBase2>(1); |
|
39 if (notifiers) |
|
40 { |
|
41 TRAPD(err, CreateNotifiersL(notifiers)); |
|
42 if (err) |
|
43 { // release any notifiers we have created |
|
44 TInt count = notifiers->Count(); |
|
45 while (--count >= 0) |
|
46 { |
|
47 (*notifiers)[count]->Release(); |
|
48 } |
|
49 delete notifiers; |
|
50 notifiers = NULL; |
|
51 } |
|
52 } |
|
53 return notifiers; |
|
54 } |
|
55 |
|
56 const TImplementationProxy KPosImplTable[] = |
|
57 { |
|
58 IMPLEMENTATION_PROXY_ENTRY(KPosPrivacyNotifierImplUid, NotifierArray) |
|
59 }; |
|
60 |
|
61 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
62 { |
|
63 aTableCount = sizeof(KPosImplTable) / sizeof(TImplementationProxy); |
|
64 |
|
65 return KPosImplTable; |
|
66 }</codeblock></section> |
|
67 <section><title>Defining the ECOM resource file</title><p>The following is |
|
68 an example ECOM resource file for a Privacy Q&N Notifier: </p><codeblock xml:space="preserve">#include <RegistryInfo.rh> |
|
69 #include <Uikon.hrh> |
|
70 #include <EPos_PrivacyNotifier.hrh> |
|
71 |
|
72 |
|
73 // RESOURCE DEFINITIONS |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 // r_registry |
|
77 // ECOM registry information for Privacy UI |
|
78 // |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 RESOURCE REGISTRY_INFO r_registry |
|
82 { |
|
83 dll_uid = 0x01234123; |
|
84 interfaces = |
|
85 { |
|
86 INTERFACE_INFO |
|
87 { |
|
88 interface_uid = KUikonUidPluginInterfaceNotifiers; |
|
89 implementations = |
|
90 { |
|
91 IMPLEMENTATION_INFO |
|
92 { |
|
93 implementation_uid = KPosPrivacyNotifierImplUid; |
|
94 version_no = 1; |
|
95 display_name = "Privacy UI"; |
|
96 } |
|
97 }; |
|
98 } |
|
99 }; |
|
100 }</codeblock><p>The most important points about this file are: </p><ul> |
|
101 <li><p>dll_uid is the UID of the notifier DLL. This should be the same as |
|
102 specified in the MMP file (see below). </p></li> |
|
103 <li><p>interface_uid is the UID of the <codeph>MEikSrvNotifierBase2</codeph> interface. |
|
104 This should be set to the constant <codeph>KUikonUidPluginInterfaceNotifiers</codeph> defined |
|
105 in <filepath>Uikon.hrh</filepath>. </p></li> |
|
106 <li><p>implementation_uid is the notifier implementation UID. This UID is |
|
107 defined as the constant <codeph>KPosPrivacyNotifierImplUid</codeph> in <filepath>EPos_PrivacyNotifier.hrh</filepath>.</p></li> |
|
108 </ul></section> |
|
109 <section><title>Defining the MMP file </title><p>The following is an example |
|
110 MMP file for a Privacy Q&N Notifier:</p><codeblock xml:space="preserve">TARGET myprivnot.dll |
|
111 TARGETTYPE PLUGIN |
|
112 UID 0x10009D8D 0x01234123 // Notifier type uid = 0x10009D8D |
|
113 VENDORID VID_DEFAULTCAPABILITY ProtServ TrustedUI |
|
114 SOURCEPATH ..\src |
|
115 SOURCE MyPrivacyNotifierMain.cpp |
|
116 SOURCE CMyPrivacyNotifier.cpp |
|
117 START RESOURCE PrivacyNotifier.rss |
|
118 TARGET myprivnot.rsc |
|
119 END |
|
120 SYSTEMINCLUDE \Epoc32\Include |
|
121 SYSTEMINCLUDE \Epoc32\Include\ECom |
|
122 SYSTEMINCLUDE \Epoc32\Include\lbs |
|
123 LIBRARY euser.lib |
|
124 LIBRARY eposprvqnif.lib |
|
125 LIBRARY eposprvtyp.lib |
|
126 LIBRARY bafl.lib |
|
127 </codeblock><p>The most important points about this file are:</p><ul> |
|
128 <li><p>The target type is <codeph>PLUGIN</codeph> because the notifier is |
|
129 implemented as an ECOM plug-in.</p></li> |
|
130 <li><p>The second UID is <codeph>0x10009D8D</codeph> to identify the DLL as |
|
131 an ECOM plug-in.</p></li> |
|
132 <li><p>The third UID is the DLL UID and is allocated by Symbian. Note that |
|
133 this is not the same as the implementation UID specified in the ECOM resource |
|
134 file. </p></li> |
|
135 <li><p><filepath>\epoc32\include\lbs</filepath> is included in order to find |
|
136 the Privacy Query and Notification API header files. </p></li> |
|
137 <li><p><filepath>eposprvqnif.lib</filepath> is included to link against the |
|
138 Privacy Query and Notification API library. </p></li> |
|
139 <li><p>The notifier must have the <codeph>ProtServ</codeph> and <codeph>TrustedUI</codeph> capabilities |
|
140 as required by the Extended Notifier Framework. </p></li> |
|
141 </ul></section> |
|
142 </conbody></concept> |