Symbian3/PDK/Source/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.dita
week 10 bug fix submission (SF PDK version): Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<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
a Notifier ECOM Plug-in</title><shortdesc>To use the Privacy Query and Notification API to create a notifier
a licensee must secondly create a notifier ECOM plug-in.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section> <title>Exporting a factory method </title> <p>The notifier
is implemented as an ECOM plug-in and has typical ECOM entry point methods.
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>)
method is used to return the <codeph>MEikSrvNotifierBase2</codeph> pointer
required by the Extended Notifier Framework. </p><p>The UID specified
in <codeph>IMPLEMENTATION_PROXY_ENTRY</codeph> is the constant <codeph>KPosPrivacyNotifierImplUid</codeph> as
defined in <filepath>EPos_PrivacyNotifier.hrh</filepath>. </p> <codeblock xml:space="preserve">#include <e32base.h>
#include <eiknotapi.h>
#include <ImplementationProxy.h>
#include <EPos_PrivacyNotifier.hrh>
#include "CMyPrivacyNotifier.h"
// Creates the notifier. Used by the NotifierArray() factory method.
LOCAL_C void CreateNotifiersL(CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers)
{
CMyPrivacyNotifier* notifier = CMyPrivacyNotifier::NewLC();
aNotifiers->AppendL(notifier->NotifierBase());
CleanupStack::Pop(notifier); // Do not destroy
}
// Notifier entry point. Note that the factory method must not leave
LOCAL_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
{
CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers =
new CArrayPtrFlat<MEikSrvNotifierBase2>(1);
if (notifiers)
{
TRAPD(err, CreateNotifiersL(notifiers));
if (err)
{ // release any notifiers we have created
TInt count = notifiers->Count();
while (--count >= 0)
{
(*notifiers)[count]->Release();
}
delete notifiers;
notifiers = NULL;
}
}
return notifiers;
}
const TImplementationProxy KPosImplTable[] =
{
IMPLEMENTATION_PROXY_ENTRY(KPosPrivacyNotifierImplUid, NotifierArray)
};
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
{
aTableCount = sizeof(KPosImplTable) / sizeof(TImplementationProxy);
return KPosImplTable;
}</codeblock></section>
<section><title>Defining the ECOM resource file</title><p>The following is
an example ECOM resource file for a Privacy Q&N Notifier: </p><codeblock xml:space="preserve">#include <RegistryInfo.rh>
#include <Uikon.hrh>
#include <EPos_PrivacyNotifier.hrh>
// RESOURCE DEFINITIONS
// -----------------------------------------------------------------------------
//
// r_registry
// ECOM registry information for Privacy UI
//
// -----------------------------------------------------------------------------
//
RESOURCE REGISTRY_INFO r_registry
{
dll_uid = 0x01234123;
interfaces =
{
INTERFACE_INFO
{
interface_uid = KUikonUidPluginInterfaceNotifiers;
implementations =
{
IMPLEMENTATION_INFO
{
implementation_uid = KPosPrivacyNotifierImplUid;
version_no = 1;
display_name = "Privacy UI";
}
};
}
};
}</codeblock><p>The most important points about this file are: </p><ul>
<li><p>dll_uid is the UID of the notifier DLL. This should be the same as
specified in the MMP file (see below). </p></li>
<li><p>interface_uid is the UID of the <codeph>MEikSrvNotifierBase2</codeph> interface.
This should be set to the constant <codeph>KUikonUidPluginInterfaceNotifiers</codeph> defined
in <filepath>Uikon.hrh</filepath>. </p></li>
<li><p>implementation_uid is the notifier implementation UID. This UID is
defined as the constant <codeph>KPosPrivacyNotifierImplUid</codeph> in <filepath>EPos_PrivacyNotifier.hrh</filepath>.</p></li>
</ul></section>
<section><title>Defining the MMP file </title><p>The following is an example
MMP file for a Privacy Q&N Notifier:</p><codeblock xml:space="preserve">TARGET myprivnot.dll
TARGETTYPE PLUGIN
UID 0x10009D8D 0x01234123 // Notifier type uid = 0x10009D8D
VENDORID VID_DEFAULTCAPABILITY ProtServ TrustedUI
SOURCEPATH ..\src
SOURCE MyPrivacyNotifierMain.cpp
SOURCE CMyPrivacyNotifier.cpp
START RESOURCE PrivacyNotifier.rss
TARGET myprivnot.rsc
END
SYSTEMINCLUDE \Epoc32\Include
SYSTEMINCLUDE \Epoc32\Include\ECom
SYSTEMINCLUDE \Epoc32\Include\lbs
LIBRARY euser.lib
LIBRARY eposprvqnif.lib
LIBRARY eposprvtyp.lib
LIBRARY bafl.lib
</codeblock><p>The most important points about this file are:</p><ul>
<li><p>The target type is <codeph>PLUGIN</codeph> because the notifier is
implemented as an ECOM plug-in.</p></li>
<li><p>The second UID is <codeph>0x10009D8D</codeph> to identify the DLL as
an ECOM plug-in.</p></li>
<li><p>The third UID is the DLL UID and is allocated by Symbian. Note that
this is not the same as the implementation UID specified in the ECOM resource
file. </p></li>
<li><p><filepath>\epoc32\include\lbs</filepath> is included in order to find
the Privacy Query and Notification API header files. </p></li>
<li><p><filepath>eposprvqnif.lib</filepath> is included to link against the
Privacy Query and Notification API library. </p></li>
<li><p>The notifier must have the <codeph>ProtServ</codeph> and <codeph>TrustedUI</codeph> capabilities
as required by the Extended Notifier Framework. </p></li>
</ul></section>
</conbody></concept>