Symbian
Symbian OS Library

SYMBIAN OS V9.2

[Index] [Spacer] [Previous] [Next]



How To Port Guide: Data Recognizers

This page describes how to migrate data recognizers to the secure version of Symbian OS. It describes:

You can find more information in How to write a data recognizer.


Converting data recognizers into ECOM plugins

Convert data recognizers into ECOM plugins by:

[Top]


Changing the project specification file

Change the project specification (.mmp) file to specify an ECOM plugin. For example:

target          EXAMPLEREC.DLL
targettype      PLUGIN
UID             0x10009D8D <DLLUID>
capability      ProtServ
sourcepath      ..\path
systeminclude   ..\inc
systeminclude   ..\inc\ecom
source          EXAMPLEREC.CPP
start resource  <DLLUID>.RSC
TARGET          examplerec.rsc
library         EUSER.LIB APMIME.LIB

[Top]


Changing the ECOM resource file

Change the ECOM resource file to specify the:

For example:

#include <RegistryInfo.rh>
RESOURCE REGISTRY_INFO r_registry
{
dll_uid = <DLLUID>; // Should match the name of this file
                    // The name of the resource file is <DLLUID>.rss
interfaces =
         {
         INTERFACE_INFO
               {
               interface_uid = 0x101F7D87; // Const for all data recognizers
               implementations =
                    {
                    IMPLEMENTATION_INFO
                        {
                        implementation_uid = <Unique Implementation Uid>;
                        version_no = 1;
                        display_name = "DataRecName";
                        default_data = "";
                        opaque_data = "";
                        }
                    };
               }
         };
}

[Top]


Changing the source code

Both the data recognizer's .h and .cpp files need code adding to create the data recognizer. For example:


example.h

class CExampleDataRecognizer : public CApaDataRecognizerType
     {
public:
     static CApaDataRecognizerType* CreateRecognizerL();
     };


example.cpp

CApaDataRecognizerType* CExampleDataRecognizer::CreateRecognizerL()
        {
        return new (ELeave) CExampleDataRecognizer ();
        }

const TImplementationProxy ImplementationTable[] =
        {
        IMPLEMENTATION_PROXY_ENTRY(UNIQUE IMPLEMENTATION UID, CExampleDataRecognizer::CreateRecognizerL)
        };

EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
        {
        aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
        return ImplementationTable;
        }

// Remove the previously EXPORTED function
EXPORT_C CApaDataRecognizerType* CreateRecognizer ()
        {
        }

[Top]


Converting data recognizers into pre-platform security style plugins

You can convert data recognizers into plugins of the sort used before Platform Security was introduced by:

[Top]


Changing the project specification file

Change the project specification (.mmp) file to specify a plugin of the style used before Platform Security was introduced. For example:

target          EXAMPLEREC.MDL
targettype      DLL
UID             0x10003A37 <DLLUID>
capability      TrustedUI ProtServ
sourcepath      ..\path
systeminclude   ..\inc
source          EXAMPLEREC.CPP
library         EUSER.LIB APMIME.LIB

[Top]


Changing the source code

The data recognizer's .cpp file needs code adding to create the data recognizer. For example:


example.cpp

EXPORT_C CApaDataRecognizerType* CreateRecognizer()
         {
         CExampleDataRecognizer * thing=NULL;
         thing = new CExampleDataRecognizer();
         return thing; // null if new failed
         }