Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Recognizers Overview


Purpose

Plug-in code that can examine data in a file, or sample data supplied in a buffer, and return, if recognized, the data type of that data. A data type is also commonly known as a MIME type.

[Top]


Architectural relationships

A Recognizer is a plug-in DLL that is loaded by the Application Architecture server. The exported ordinal 1 function constructs and returns an instance of a CApaDataRecognizerType derived class.

All Recognizer DLLs have 0x10003A19 as the 2nd UID of their UID type. Individual Recognizers are uniquely identified by the 3rd UID. All Recognizer DLLs have a .mdl file extension and are loaded from \system\recogs.

When building a Recognizer DLL, the target type encoded in the .mmp project file is always MDL.

See also UID protection for the polymorphic interface DLL.

[Top]


Description

The API has 4 key concepts: data type, abstract Recognizer type base class, Recognizer priority, confidence of recognition.


Data type

The data type, which is also referred to as a MIME type, gives identity to a piece of data and can be used to find a suitable application that can handle that data. The general form of a data type is an ASCII string containing two fields separated by a "/" character, for example, "text/html".

Native Symbian data is identified by the string "x-epoc/x-app" appended by the decimal character representation of the associated application UID.

A Recognizer can recognize more than one data type.

The data type is represented by TDataType.


Abstract recognizer type base class

All Recognizer DLLs export an ordinal 1 function that constructs and returns an instance of a CApaDataRecognizerType derived class. The class has three virtual functions that implementors must provide: DoRecognizeL(), SupportedDataTypeL() and PreferredBufSize().

The main functionality of data recognition is implemented in DoRecognizeL().


Recognizer priority

All Recognizers define a Recognizer priority, as defined by CApaDataRecognizerType::TRecognizerPriority. This is a value that expresses the likelihood that a Recognizer will successfully identify data as having a specific data type. In effect, it is a confidence rating in the Recognizer's ability to perform recognition.

The Application Architecture server uses this priority value to order its list of Recognizers. When making an attempt to recognize data, it selects those Recognizers with the highest Recognizer priority before those with a lower priority.


Confidence of recognition

Recognizers can express confidence in the outcome of their attempt to recognize data by reporting one of 5 possible confidence levels, as defined by CApaDataRecognizerType::TRecognitionConfidence. These range from certainty to unrecognized.

The Application Architecture server passes sample data to each recognizer in its list. For data to be accepted as having a specific data type, the Application Architecture server defines a minimum acceptable confidence level. The data type assigned to the sample data is that which is assigned by the first Recognizer to exceed that minimum.

It is always possible that no Recognizer on a device can recognize a data sample.

[Top]


See also

Application information files (AIF)

Dynamically loading DLLs