The Mime Recognizers provide the implementation for data type (MIME Type) recognition using the MIME recognition framework.
Each MIME recognizer specifies the MIME type it supports along with the priority and confidence of recognition. A MIME recognizer reads a small piece of data and identifies the data type. Once the data type is identified, it is passed to the Application Architecture (AppArc). AppArc launches the application that best handles the identified data type.
Symbian OS v9.1 and onwards, MIME recognizers are ECOM plug-ins. They are located in \sys\bin\.
Each MIME recognizer is loaded by the Application Architecture (AppArc) during the startup sequence.
.mmp
) for the MIME recognizer
and ensure the following parameters are set.
Example:
Variable Name |
Value |
Description |
|
|
Specifies the type of binary. |
|
Use the block |
The variable |
|
|
The variable |
|
|
The AppArc server has |
.mmp
file with the
above parameters set.
Example:
target exampleRecognizer.dll capability Protserv targettype plugin uid 0x10009d8d 0x1d1f75ed vendorid 0x70000001 sourcepath . source exampleRecognizer.cpp systeminclude \EPOC32\INCLUDE systeminclude \EPOC32\INCLUDE\ECOM library EUSER.LIB APMIME.LIB start resource 1d1f75ed.rss target exampleRecognizer.rsc end
CExampleRecognizer
is derived from CApaDataRecognizerType.
Example:
const TInt KImplementationUID = 0x101F7DA1; CApaDataRecognizerType* CExampleRecognizer::CreateRecognizerL() { return new (ELeave) CExampleRecognizer; } const TImplementationProxy ImplementationTable[] = { IMPLEMENTATION_PROXY_ENTRY(KImplementationUID,CExampleRecognizer::CreateRecognizerL); } EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) { aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); return ImplementationTable; }
CApaDataRecognizerType
polymorphic interface.
Example:
const TUid KExampleUid = {0x1d1f75ed}; const TInt KNumDataTypes = 1; CExampleRecognizer::CExampleRecognizer() : CApaDataRecognizerType(KExampleUid,CApaDataRecognizerType::EHigh) { iCountDataTypes = KNumDataTypes; }
DLL UID
as specified in the plug-in
project definition file) and a priority in
the constructor.
The iCountDataTypes
variable, represents the number
of data types supported by the recognizer can also be set in the constructor.
The value set for this variable should match the implementation of CApaDataRecognizerType::SupportedDataTypeL().
SupportedDataTypeL()
for
supporting MIME type/ subtype "text/example".
Example:
_LIT8(KExampleTextMimeType, "text/example"); TDataType CExampleRecognizer::SupportedDataTypeL(TInt aIndex) const { return TDataType(KExampleTextMimeType); }
DoRecognizeL()
for
recognizing the MIME type "/text/example"
contained in files
with .example
extension with maximum confidence.
Example:
void CExampleRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer) { _LIT8(KExampleData, "example"); _LIT(KDotExample, ".Example"); TParse parse; parse.Set(aName,NULL,NULL); TPtrC ext=parse.Ext(); // extract the extension from the filename if (ext.CompareF(KDotExample)==0 && aBuffer.FindF(KExampleData)!=KErrNotFound) { iConfidence=ECertain; iDataType=TDataType(KExampleTextMimeType); } }