1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmdevicefw/speechrecogsupport/ASR/src/SpeechRecognitionUtilityBody.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,144 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __SPEECHRECOGNITIONUTILITYBODY_H__
1.20 +#define __SPEECHRECOGNITIONUTILITYBODY_H__
1.21 +
1.22 +// INCLUDES
1.23 +
1.24 +#include <e32base.h>
1.25 +#include <mmf/common/mmfcontroller.h>
1.26 +#include <mmf/common/speechrecognitioncustomcommands.h>
1.27 +#include <mmf/common/speechrecognitiondataclient.h>
1.28 +#include <speechrecognitionutility.h>
1.29 +
1.30 +
1.31 +class CSpeechRecognitionUtility::CBody : public CBase, public MMMFControllerEventMonitorObserver
1.32 +{
1.33 +public:
1.34 + static CSpeechRecognitionUtility::CBody* NewL(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver);
1.35 + static CSpeechRecognitionUtility::CBody* NewLC(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver);
1.36 +
1.37 + ~CBody();
1.38 + TInt GetEngineProperties( const RArray<TInt>& aPropertyId, RArray<TInt>& aPropertyValue );
1.39 + TInt AddPronunciation(TLexiconID aLexiconID, TModelBankID aModelBankID, TModelID aModelID, TPronunciationID& aPronunciationID);
1.40 + TInt AddRule(TGrammarID aGrammarID, TLexiconID aLexiconID, TPronunciationID aPronunciationID, TRuleID& aRuleID);
1.41 + void Cancel();
1.42 + TInt CommitChanges();
1.43 + TInt CreateGrammar(TGrammarID& aGrammarID);
1.44 + TInt CreateLexicon(TLexiconID& aLexiconID);
1.45 + TInt LoadModels(TModelBankID aModelBankID);
1.46 + TInt LoadGrammar(TGrammarID aGrammarID);
1.47 +
1.48 + TInt LoadLexicon(TLexiconID aLexiconID);
1.49 +
1.50 + TInt GetUtteranceDuration(TModelBankID aModelBankID, TModelID aModelID, TTimeIntervalMicroSeconds32& aDuration);
1.51 + TInt PlayUtterance(TModelBankID aModelBankID, TModelID aModelID);
1.52 + TInt GetModelCount(TModelBankID aModelBankID, TInt& aModelCount);
1.53 + TInt EndRecSession();
1.54 +
1.55 + TInt StartRecSession(TRecognitionMode aMode);
1.56 + TInt Recognize(CSDClientResultSet& aResultSet);
1.57 +
1.58 + TInt Record(TTimeIntervalMicroSeconds32 aRecordTime);
1.59 +
1.60 + TInt RemoveGrammar(TGrammarID aGrammarID);
1.61 +
1.62 + TInt RemovePronunciation(TLexiconID aLexiconID, TPronunciationID aPronunciationID);
1.63 +
1.64 + TInt RemoveLexicon(TLexiconID aLexiconID);
1.65 +
1.66 + TInt RemoveModel(TModelBankID aModelBankID, TModelID aModelID);
1.67 +
1.68 + TInt RemoveRule(TGrammarID aGrammarID, TRuleID aRuleID);
1.69 + TInt Train(TModelBankID aModelBankID, TModelID& aModelID);
1.70 + TInt UnloadRule(TGrammarID aGrammarID, TRuleID aRuleID);
1.71 + void SetEventHandler(MSpeechRecognitionUtilityObserver* aSpeechRecognitionUtilityObserver);
1.72 + TInt GetAllPronunciationIDs(TLexiconID aLexiconID, RArray <TPronunciationID>& aPronunciationIDs);
1.73 + TInt GetAllModelIDs(TModelBankID aModelBankID, RArray <TModelID>& aModelIDs);
1.74 + TInt GetAllRuleIDs(TGrammarID aGrammarID, RArray <TRuleID>& aRuleIDs);
1.75 +
1.76 + TInt GetAllLexiconIDs(RArray <TLexiconID>& aPronunciationIDs);
1.77 + TInt GetAllModelBankIDs(RArray <TModelBankID>& aModelIDs);
1.78 + TInt GetAllGrammarIDs(RArray <TGrammarID>& aRuleIDs);
1.79 +
1.80 + TInt GetAllClientLexiconIDs(RArray <TLexiconID>& aPronunciationIDs);
1.81 + TInt GetAllClientModelBankIDs(RArray <TModelBankID>& aModelIDs);
1.82 + TInt GetAllClientGrammarIDs(RArray <TGrammarID>& aRuleIDs);
1.83 +
1.84 + TInt GetRuleValidity(TGrammarID aGrammarID, TRuleID aRuleID, TBool& aValid);
1.85 +
1.86 + TInt CreateModelBank(TModelBankID& aModelBankID);
1.87 + TInt RemoveModelBank(TModelBankID aModelBankID);
1.88 + TInt GetAvailableStorage(TInt& aAvailableStorage);
1.89 + TInt LoadEngineParameters( const RArray<TInt>& aParameterId,
1.90 + const RArray<TInt>& aParameterValue );
1.91 +
1.92 + TInt SetAudioPriority( TInt aPriority, TInt aTrainPreference,
1.93 + TInt aPlaybackPreference, TInt aRecognitionPreference );
1.94 +
1.95 + void HandleEvent(const TMMFEvent& aEvent);
1.96 +
1.97 +private:
1.98 + CBody(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver);
1.99 +
1.100 + void ConstructL();
1.101 +
1.102 + // member variable MMF controller
1.103 + RMMFController iMMFController;
1.104 + // member variable for custom commands
1.105 + RSpeechRecognitionCustomCommands iSrCustomCommands;
1.106 + // member variable pointer for observer class
1.107 + MSpeechRecognitionUtilityObserver* iSpeechRecognitionUtilityObserver;
1.108 +
1.109 + // member variable pointer for controller event monitor class
1.110 + CMMFControllerEventMonitor* iControllerEventMonitor;
1.111 + // used to indicate if an event is the result of an internal command
1.112 + TBool iAsyncCallBusy;
1.113 +
1.114 + // member variable pointer for array of rule IDs - not owned
1.115 + RArray <TRuleID>* iRuleIDs;
1.116 + // member variable pointer for array of pronunciation IDs - not owned
1.117 + RArray <TPronunciationID>* iPronunciationIDs;
1.118 + // member variable pointer for array of model IDs - not owned
1.119 + RArray <TModelID>* iModelIDs;
1.120 +
1.121 + // member variable pointer for array of Grammar IDs - not owned
1.122 + RArray <TGrammarID>* iGrammarIDs;
1.123 + // member variable pointer for array of Lexicon IDs - not owned
1.124 + RArray <TLexiconID>* iLexiconIDs;
1.125 + // member variable pointer for array of Model Bank IDs - not owned
1.126 + RArray <TModelBankID>* iModelBankIDs;
1.127 +
1.128 +
1.129 + // member variable for audio priority
1.130 + TInt iAudioPriority;
1.131 + // member variable for train preference
1.132 + TMdaPriorityPreference iTrainPreference;
1.133 + // member variable for playback preference
1.134 + TMdaPriorityPreference iPlaybackPreference;
1.135 + // member variable for recognition preference
1.136 + TMdaPriorityPreference iRecognitionPreference;
1.137 +
1.138 + CSDClientResultSet* iResultSet;
1.139 +
1.140 + // settings used in the construction of the asr controlller
1.141 + TMMFPrioritySettings iPrioritySettings;
1.142 +
1.143 + TUid iClientUid;
1.144 +
1.145 +};
1.146 +
1.147 +#endif // __SPEECHRECOGNITIONUTILITY_H__