mmdevicefw/speechrecogsupport/ASR/src/SpeechRecognitionUtilityBody.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __SPEECHRECOGNITIONUTILITYBODY_H__
       
    17 #define __SPEECHRECOGNITIONUTILITYBODY_H__
       
    18 
       
    19 // INCLUDES
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <mmf/common/mmfcontroller.h>
       
    23 #include <mmf/common/speechrecognitioncustomcommands.h>
       
    24 #include <mmf/common/speechrecognitiondataclient.h>
       
    25 #include <speechrecognitionutility.h>
       
    26 
       
    27 
       
    28 class CSpeechRecognitionUtility::CBody : public CBase, public MMMFControllerEventMonitorObserver
       
    29 {
       
    30 public:
       
    31 	static CSpeechRecognitionUtility::CBody* NewL(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver);
       
    32 	static CSpeechRecognitionUtility::CBody* NewLC(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver);
       
    33 	
       
    34 	 ~CBody();
       
    35 	 TInt GetEngineProperties( const RArray<TInt>& aPropertyId, RArray<TInt>& aPropertyValue );
       
    36 	 TInt AddPronunciation(TLexiconID aLexiconID, TModelBankID aModelBankID, TModelID aModelID, TPronunciationID& aPronunciationID);
       
    37 	 TInt AddRule(TGrammarID aGrammarID, TLexiconID aLexiconID, TPronunciationID aPronunciationID, TRuleID& aRuleID);
       
    38 	 void Cancel();
       
    39 	 TInt CommitChanges();
       
    40 	 TInt CreateGrammar(TGrammarID& aGrammarID);
       
    41 	 TInt CreateLexicon(TLexiconID& aLexiconID);
       
    42 	 TInt LoadModels(TModelBankID aModelBankID);
       
    43 	 TInt LoadGrammar(TGrammarID aGrammarID);
       
    44 
       
    45 	 TInt LoadLexicon(TLexiconID aLexiconID);
       
    46 
       
    47 	 TInt GetUtteranceDuration(TModelBankID aModelBankID, TModelID aModelID, TTimeIntervalMicroSeconds32& aDuration);
       
    48 	 TInt PlayUtterance(TModelBankID aModelBankID, TModelID aModelID);
       
    49 	 TInt GetModelCount(TModelBankID aModelBankID, TInt& aModelCount);
       
    50 	 TInt EndRecSession();
       
    51 
       
    52 	 TInt StartRecSession(TRecognitionMode aMode);
       
    53 	 TInt Recognize(CSDClientResultSet& aResultSet);
       
    54 
       
    55 	 TInt Record(TTimeIntervalMicroSeconds32 aRecordTime);
       
    56 
       
    57 	 TInt RemoveGrammar(TGrammarID aGrammarID);
       
    58 
       
    59 	 TInt RemovePronunciation(TLexiconID aLexiconID, TPronunciationID aPronunciationID);
       
    60 
       
    61 	 TInt RemoveLexicon(TLexiconID aLexiconID);
       
    62 
       
    63 	 TInt RemoveModel(TModelBankID aModelBankID, TModelID aModelID);
       
    64 
       
    65 	 TInt RemoveRule(TGrammarID aGrammarID, TRuleID aRuleID);
       
    66 	 TInt Train(TModelBankID aModelBankID, TModelID& aModelID);
       
    67 	 TInt UnloadRule(TGrammarID aGrammarID, TRuleID aRuleID);
       
    68 	 void SetEventHandler(MSpeechRecognitionUtilityObserver* aSpeechRecognitionUtilityObserver);
       
    69 	 TInt GetAllPronunciationIDs(TLexiconID aLexiconID, RArray <TPronunciationID>& aPronunciationIDs);
       
    70 	 TInt GetAllModelIDs(TModelBankID aModelBankID, RArray <TModelID>& aModelIDs);
       
    71 	 TInt GetAllRuleIDs(TGrammarID aGrammarID, RArray <TRuleID>& aRuleIDs);
       
    72 	 
       
    73   	 TInt GetAllLexiconIDs(RArray <TLexiconID>& aPronunciationIDs);
       
    74 	 TInt GetAllModelBankIDs(RArray <TModelBankID>& aModelIDs);
       
    75 	 TInt GetAllGrammarIDs(RArray <TGrammarID>& aRuleIDs);
       
    76 
       
    77  	 TInt GetAllClientLexiconIDs(RArray <TLexiconID>& aPronunciationIDs);
       
    78 	 TInt GetAllClientModelBankIDs(RArray <TModelBankID>& aModelIDs);
       
    79 	 TInt GetAllClientGrammarIDs(RArray <TGrammarID>& aRuleIDs);
       
    80 
       
    81  	 TInt GetRuleValidity(TGrammarID aGrammarID, TRuleID aRuleID, TBool& aValid); 
       
    82 
       
    83 	 TInt CreateModelBank(TModelBankID& aModelBankID);
       
    84 	 TInt RemoveModelBank(TModelBankID aModelBankID);
       
    85 	 TInt GetAvailableStorage(TInt& aAvailableStorage); 
       
    86 	 TInt LoadEngineParameters( const RArray<TInt>& aParameterId, 
       
    87 								const RArray<TInt>& aParameterValue );
       
    88 
       
    89 	 TInt SetAudioPriority( TInt aPriority, TInt aTrainPreference, 
       
    90 					TInt aPlaybackPreference, TInt aRecognitionPreference );
       
    91 
       
    92 	void HandleEvent(const TMMFEvent& aEvent);
       
    93 
       
    94 private:
       
    95 	CBody(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver);
       
    96 	
       
    97 	void ConstructL();
       
    98 
       
    99 	// member variable MMF controller
       
   100 	RMMFController iMMFController;
       
   101 	// member variable for custom commands
       
   102 	RSpeechRecognitionCustomCommands iSrCustomCommands;
       
   103 	// member variable pointer for observer class
       
   104 	MSpeechRecognitionUtilityObserver* iSpeechRecognitionUtilityObserver;
       
   105 
       
   106 	// member variable pointer for controller event monitor class
       
   107 	CMMFControllerEventMonitor* iControllerEventMonitor;
       
   108 	// used to indicate if an event is the result of an internal command
       
   109 	TBool iAsyncCallBusy;
       
   110 
       
   111 	// member variable pointer for array of rule IDs - not owned
       
   112 	RArray <TRuleID>* iRuleIDs;
       
   113 	// member variable pointer for array of pronunciation IDs  - not owned
       
   114 	RArray <TPronunciationID>* iPronunciationIDs;
       
   115 	// member variable pointer for array of model IDs  - not owned
       
   116 	RArray <TModelID>* iModelIDs;
       
   117 	
       
   118 	// member variable pointer for array of Grammar IDs  - not owned
       
   119 	RArray <TGrammarID>* iGrammarIDs;
       
   120 	// member variable pointer for array of Lexicon IDs  - not owned
       
   121 	RArray <TLexiconID>* iLexiconIDs;
       
   122 	// member variable pointer for array of Model Bank IDs  - not owned
       
   123 	RArray <TModelBankID>* iModelBankIDs;
       
   124 
       
   125 
       
   126 	// member variable for audio priority
       
   127 	TInt iAudioPriority;
       
   128 	// member variable for train preference
       
   129 	TMdaPriorityPreference iTrainPreference; 
       
   130 	// member variable for playback preference
       
   131 	TMdaPriorityPreference iPlaybackPreference;
       
   132 	// member variable for recognition preference
       
   133 	TMdaPriorityPreference iRecognitionPreference;
       
   134 	
       
   135 	CSDClientResultSet* iResultSet;
       
   136 
       
   137 	// settings used in the construction of the asr controlller 
       
   138 	TMMFPrioritySettings   iPrioritySettings;
       
   139 	
       
   140 	TUid iClientUid;
       
   141 
       
   142 };
       
   143 
       
   144 #endif	// __SPEECHRECOGNITIONUTILITY_H__