ocrsrv_stub/inc/ocradaptor.h
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ocradapter definitions
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef OCRADAPTOR_H
       
    20 #define OCRADAPTOR_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <ocrsrv.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CShareData;
       
    27 enum TEngineCmd;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32  *  Adaptor for engines
       
    33  *
       
    34  *  Implement concrete operation with child thread either send request 
       
    35  *  to child thread or receive operation result from child thread
       
    36  *
       
    37  *  @lib ocrsrv.lib
       
    38  *  @since S60 v3.1
       
    39  */
       
    40 class CEngineAdaptor : public CActive
       
    41     {
       
    42     public:
       
    43         
       
    44         /**
       
    45         * Symbian Two-phased constructor
       
    46         */
       
    47         static CEngineAdaptor* NewL(MOCREngineObserver& aObserver, 
       
    48                                     const TFileName& aTargetDll, 
       
    49                                     const TOcrEngineEnv aEngineEnv);
       
    50         
       
    51         /**
       
    52         * C++ Default Destructor
       
    53         */
       
    54         virtual ~CEngineAdaptor();
       
    55         
       
    56     public:
       
    57     
       
    58         /** 
       
    59         * Issue request to child thread
       
    60         * @since S60 v3.1
       
    61         * @param aCmd A command that is issued
       
    62         * @return KErrNone if no error
       
    63         */
       
    64         TInt IssueRequest(const TEngineCmd aCmd);
       
    65 
       
    66         /** 
       
    67         * Set image handle to be processed
       
    68         * @since S60 v3.1
       
    69         * @param aHandle Handle to the image
       
    70         * @return None
       
    71         */
       
    72         void SetImage(const TInt aHandle);
       
    73 
       
    74         /**
       
    75         * Set the setting for layout
       
    76         * @since S60 v3.1
       
    77         * @param aSettings Layout settings
       
    78         * @return None
       
    79         */
       
    80         void SetLayoutSetting(const TOCRLayoutSetting& aSettings);
       
    81 
       
    82         /**
       
    83         * Set Layout block information
       
    84         * @since S60 v3.1
       
    85         * @param aSettings Layout block information
       
    86         * @return None
       
    87         */
       
    88         void SetLayoutBlockInfo(const TOCRLayoutBlockInfo& aLayoutInfo);
       
    89 
       
    90         /**
       
    91         * Set special region information
       
    92         * @since S60 v3.1
       
    93         * @param aSettings Special region information
       
    94         * @return None
       
    95         */
       
    96         void SetSpecialRegionInfo(const TRegionInfo& aRegionInfo);
       
    97 
       
    98         /**
       
    99         * Set recognition setting 
       
   100         * @since S60 v3.1
       
   101         * @param aSettings Recognize settings
       
   102         * @return None
       
   103         */
       
   104         void SetRecognizeSetting(const TOCRRecognizeSetting& aSettings);
       
   105 
       
   106         /**
       
   107         * Set blocks to be recognized
       
   108         * @since S60 v3.1
       
   109         * @param aRecognizedBlock Blocks to be recognized
       
   110         * @return None
       
   111         */
       
   112         void SetRecognizeBlocksL(const RArray<TInt>& aRecognizedBlock);
       
   113         
       
   114         /**
       
   115         * Set active languages
       
   116         * @since S60 v3.1
       
   117         * @param aActiveLanguage Languages to be recognized
       
   118         * @return None
       
   119         */
       
   120         void SetActiveLangL(const RArray<TLanguage>& aActiveLanguage);
       
   121 
       
   122         /**
       
   123         * Cancel the operation
       
   124         * @since S60 v3.1
       
   125         * @return None
       
   126         */
       
   127         void CancelOperation();
       
   128         
       
   129         /**
       
   130         * Test if the engine is active or not
       
   131         * @since S60 v3.1
       
   132         * @return None
       
   133         */
       
   134         TBool IsEngineActive() const;
       
   135 
       
   136     protected: // From CActive
       
   137 
       
   138         /**
       
   139         * AO callback function
       
   140         * @since S60 v3.1
       
   141         * @return None
       
   142         */
       
   143         void RunL();
       
   144 
       
   145         /**
       
   146         * AO callback function
       
   147         * @since S60 v3.1
       
   148         * @return None
       
   149         */
       
   150         TInt RunError(TInt aError);
       
   151 
       
   152         /**
       
   153         * AO callback function
       
   154         * @since S60 v3.1
       
   155         * @return None
       
   156         */
       
   157         void DoCancel();
       
   158     
       
   159     protected:
       
   160 
       
   161         /**
       
   162         * Send the command to exit and kill the thread
       
   163         * @since S60 v3.1
       
   164         * @return None
       
   165         */
       
   166         void SendExitCmd();
       
   167         
       
   168         /**
       
   169         * Get the current CPU tick of the thread
       
   170         * @since S60 v3.1
       
   171         * @param aThreadName Name of the thread
       
   172         * @return None
       
   173         */        
       
   174         static void GetThreadName(TDes& aThreadName);
       
   175         
       
   176         /**
       
   177         * Test if the current thread is alive
       
   178         * @since S60 v3.1
       
   179         * @return ETrue if the thread is alive
       
   180         */                
       
   181         TBool IsThreadAlive() const;
       
   182 
       
   183     private:
       
   184     
       
   185         /**
       
   186         * C++ default constructor
       
   187         */
       
   188         CEngineAdaptor(MOCREngineObserver& aObserver);
       
   189 
       
   190         /**
       
   191         * Default Symbian 2nd phase constructor
       
   192         */
       
   193         void ConstructL(const TFileName& aTargetDll, const TOcrEngineEnv aEngineEnv);
       
   194 
       
   195     private:    // Data
       
   196     
       
   197         /**
       
   198         * Handle of the child thread
       
   199         */
       
   200         RThread iThread;
       
   201         
       
   202         /**
       
   203         * Engine observer
       
   204         */
       
   205         MOCREngineObserver& iObserver;
       
   206         
       
   207         /**
       
   208         * Pointer to the shared data (Own)
       
   209         */
       
   210         CShareData* iShareData;
       
   211         
       
   212         /**
       
   213         * Request Status
       
   214         */
       
   215         TRequestStatus iRequestStatus;
       
   216     };
       
   217 
       
   218 #endif      // OCRADAPTOR_H   
       
   219             
       
   220 // End of File