Using the MIME Framework

The MIME recognizers are used by the client applications for data type recognition. When there is a client request to the AppArc for data type recognition, AppArc internally uses the MIME recognition framework for processing the request.

Context

The client connects to AppArc and creates a session using the class RApaLsSession. Apparc provides access to the MIME framework via RApaLsSession APIs. The class provides the APIs for data type recognition.

All MIME (data) recognizers are derived from the abstract base class, CApaDataRecognizerType. The RApaLsSession data recognition APIs access the properties of CApaDataRecognizerType for data type recognition.

Steps

  1. Connect and create a session with AppArc server using RApaLsSession::Connect().

    Example:

    RApaLsSession aLs;
    TInt ret;
    // Client session with the server created.
    ret=aLs.Connect();
    
  2. Invoke RApaLsSession::RecognizeData() or RApaLsSession::RecognizeSpecificData(). These APIs internally invoke the implementation for CApaDataRecognizerType::DoRecognizeL(). DoRecognizeL() of the class derived from CApaDataRecognizerType implements the data recognition behaviour.

    Example:

    // Implementation of RecognizeData() 
    
    RecognizeData(const TDesC &aName, const TDesC8 &aBuffer, TDataRecognitionResult &aDataType) 
        {
         
        CExampleRecognizer *myrecognizer= CExampleRecognizer::CreateRecognizerL();
        myrecognize->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);
    
    
     
    
    For more details about refer Writing MIME Recognizers .

Results

A TDataRecognitionResult object is returned to AppArc. The object contains the data (MIME) type and the confidence of recognition.

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.

Notes:

In addition to the overloads of RApaLsSession::RecognizeData() or RApaLsSession::RecognizeSpecificData() the following functions of the RApaLsSession also support the processing of data type recognition request.