Symbian3/SDK/Source/GUID-7B5A854B-A9A0-557E-9970-9B13D7EE251E.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 12:39:03 +0100
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
permissions -rw-r--r--
Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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 task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-7B5A854B-A9A0-557E-9970-9B13D7EE251E" xml:lang="en"><title>Using
the MIME Framework</title><abstract><p>The <xref href="GUID-1AAA88BB-19AD-5B8E-993C-11F4B7CD90EB.dita">MIME
recognizers</xref> are used by the client applications for data type recognition.
When there is a client request to the <xref href="GUID-58CA15F8-D984-5D07-8C00-161FA16A8FD3.dita">AppArc</xref> for
data type recognition, AppArc internally uses the MIME recognition framework
for processing the request. </p></abstract><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context id="GUID-6799E3F3-353E-5C00-A38C-D32F888392AA-GENID-1-10-1-11-1-1-6-1-6-1-4-1-4-1-3-1"><p>The client connects
to AppArc and creates a session using the class <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita"><apiname>RApaLsSession</apiname></xref>.
Apparc provides access to the MIME framework via <codeph>RApaLsSession</codeph> APIs.
The class provides the APIs for data type recognition. </p> <p>All MIME (data)
recognizers are derived from the abstract base class, <xref href="GUID-EBE480D9-E377-32F4-9AE5-9C58684BEFF0.dita"><apiname>CApaDataRecognizerType</apiname></xref>.
The <codeph>RApaLsSession</codeph> data recognition APIs access the properties
of <codeph>CApaDataRecognizerType</codeph> for data type recognition. </p> </context>
<steps id="GUID-554A6B8B-5E46-5977-A588-23EEF7610077">
<step id="GUID-3922D131-9E8C-5865-BF22-D1EB75DADAAF"><cmd/>
<info>Connect and create a session with AppArc server using <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-A92887D0-694C-3792-B3C9-46B155FE83B9"><apiname>RApaLsSession::Connect()</apiname></xref>. </info>
<stepxmp><codeblock id="GUID-A947EEFC-C528-5487-8C69-B02E46473AAC" xml:space="preserve">RApaLsSession aLs;
TInt ret;
// Client session with the server created.
ret=aLs.Connect();
</codeblock> </stepxmp>
</step>
<step id="GUID-715F513B-D88F-5968-B47B-87BB57F015CE"><cmd/>
<info>Invoke <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-24DCDDC2-1BF8-34BE-A893-7D85DF505D59"><apiname>RApaLsSession::RecognizeData()</apiname></xref> or <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-13C1150F-AEC3-377F-A15E-1722AB750C9C"><apiname>RApaLsSession::RecognizeSpecificData()</apiname></xref>. </info>
<info>These APIs internally invoke the implementation for <xref href="GUID-EBE480D9-E377-32F4-9AE5-9C58684BEFF0.dita#GUID-EBE480D9-E377-32F4-9AE5-9C58684BEFF0/GUID-74ED8BEA-52AA-3AC4-92D9-5E4FB4F25DDD"><apiname>CApaDataRecognizerType::DoRecognizeL()</apiname></xref>. </info>
<info> <codeph>DoRecognizeL()</codeph> of the class derived from <codeph>CApaDataRecognizerType</codeph> implements
the data recognition behaviour. </info>
<stepxmp><codeblock id="GUID-E56AB4D9-6D75-58FC-B045-C1B444097973" xml:space="preserve">// Implementation of RecognizeData() 

RecognizeData(const TDesC &amp;aName, const TDesC8 &amp;aBuffer, TDataRecognitionResult &amp;aDataType) 
    {
     
    CExampleRecognizer *myrecognizer= CExampleRecognizer::CreateRecognizerL();
    myrecognize-&gt;DoRecognizeL(aName,aBuffer);
     
    }


// The RApaLsSession object invokes RecognizeData() for data type recognition.

_LIT(KMyFile, "Myfile.example");

_LIT(KMyBufer, "serach for example string in the file buffer");

TInt ret=aLs.RecognizeData(KMyFile,KMyBufer,result);


 
</codeblock> </stepxmp>
<info>For more details about refer <xref href="GUID-1AAA88BB-19AD-5B8E-993C-11F4B7CD90EB.dita">Writing
MIME Recognizers </xref>. </info>
</step>
</steps>
<result><p>A <codeph>TDataRecognitionResult</codeph> object is returned to
AppArc. The object contains the data (MIME) type and the confidence of recognition. </p> <p>AppArc
attempts to find the application that can best handle the identified data
type. It is not guaranteed that an application will be available
to handle a data type, even after successful recognition. </p><p><b>Notes</b>:</p><p>In
addition to the overloads of <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-24DCDDC2-1BF8-34BE-A893-7D85DF505D59"><apiname>RApaLsSession::RecognizeData()</apiname></xref> or <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-13C1150F-AEC3-377F-A15E-1722AB750C9C"><apiname>RApaLsSession::RecognizeSpecificData()</apiname></xref> the
following functions of the <codeph>RApaLsSession</codeph> also support the
processing of data type recognition request.  <ul>
<li id="GUID-DD30FE7C-7A2E-5D1A-BF2B-9062EA0534F6"><p>The overloads of <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-75213781-58CC-3133-A29E-A98640B5DCB7"><apiname>RApaLsSession::RecognizeFilesL()</apiname></xref> are
used to recognize all files contained in a specified directory. </p> </li>
<li id="GUID-EEFC08FC-BC71-5FBC-84D4-4F90FBE879E4"><p> <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-73CBA5BA-F834-3C3E-B823-D22D47E80B0D"><apiname>RApaLsSession::GetAcceptedConfidence()</apiname></xref> and <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-52093701-CB5C-3F89-980B-146FB59DA841"><apiname>RApaLsSession::SetAcceptedConfidence()</apiname></xref> retrieve and set the accepted confidence level of the MIME framework. The
default value is <codeph>ECertain</codeph>. </p> </li>
<li id="GUID-611CC0DC-566E-5CAF-ABB2-445AC1E4B21B"><p> <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-02D7272B-576C-34B7-8C70-4B5DD3CA0F7C"><apiname> RApaLsSession::GetSupportedDataTypesL()</apiname></xref> retrieves
the list of data types supported by all recognizers in the recognizer list
of the MIME framework. </p> </li>
<li id="GUID-C3BB3027-FF85-54CE-ADE9-0104CC749AE5"><p>The preferred buffer
size determines the amount of data passed to <codeph>DoRecognizeL()</codeph> function.
The preferred buffer size can be retrieved using <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-2BF0B124-F898-3F60-BDA9-D56AAAB92EB2"><apiname>RApaLsSession::GetPreferredBufSize()</apiname></xref>.
This value cannot be greater than the maximum buffer value. </p> <p>The maximum
value for the buffer is set by using <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-08755985-24A9-3D58-9DCD-2C9E45FC8A24"><apiname>RApaLsSession::SetMaxDataBufSize()</apiname></xref>.
If the maximum buffer size is not set by the client, the default value is
256 bytes. The maximum buffer size can be retrieved using <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-CCE99830-F0A2-3E39-9D16-32A1A3EA570B"><apiname>RApaLsSession::GetMaxDataBufSize()</apiname></xref>. </p> </li>
</ul></p> </result>
</taskbody></task>