diff -r 000000000000 -r 40261b775718 mmdevicefw/speechrecogsupport/ASR/src/SpeechRecognitionUtilityBody.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/speechrecogsupport/ASR/src/SpeechRecognitionUtilityBody.h Tue Feb 02 01:56:55 2010 +0200 @@ -0,0 +1,144 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "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: +// +// Description: +// + +#ifndef __SPEECHRECOGNITIONUTILITYBODY_H__ +#define __SPEECHRECOGNITIONUTILITYBODY_H__ + +// INCLUDES + +#include +#include +#include +#include +#include + + +class CSpeechRecognitionUtility::CBody : public CBase, public MMMFControllerEventMonitorObserver +{ +public: + static CSpeechRecognitionUtility::CBody* NewL(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver); + static CSpeechRecognitionUtility::CBody* NewLC(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver); + + ~CBody(); + TInt GetEngineProperties( const RArray& aPropertyId, RArray& aPropertyValue ); + TInt AddPronunciation(TLexiconID aLexiconID, TModelBankID aModelBankID, TModelID aModelID, TPronunciationID& aPronunciationID); + TInt AddRule(TGrammarID aGrammarID, TLexiconID aLexiconID, TPronunciationID aPronunciationID, TRuleID& aRuleID); + void Cancel(); + TInt CommitChanges(); + TInt CreateGrammar(TGrammarID& aGrammarID); + TInt CreateLexicon(TLexiconID& aLexiconID); + TInt LoadModels(TModelBankID aModelBankID); + TInt LoadGrammar(TGrammarID aGrammarID); + + TInt LoadLexicon(TLexiconID aLexiconID); + + TInt GetUtteranceDuration(TModelBankID aModelBankID, TModelID aModelID, TTimeIntervalMicroSeconds32& aDuration); + TInt PlayUtterance(TModelBankID aModelBankID, TModelID aModelID); + TInt GetModelCount(TModelBankID aModelBankID, TInt& aModelCount); + TInt EndRecSession(); + + TInt StartRecSession(TRecognitionMode aMode); + TInt Recognize(CSDClientResultSet& aResultSet); + + TInt Record(TTimeIntervalMicroSeconds32 aRecordTime); + + TInt RemoveGrammar(TGrammarID aGrammarID); + + TInt RemovePronunciation(TLexiconID aLexiconID, TPronunciationID aPronunciationID); + + TInt RemoveLexicon(TLexiconID aLexiconID); + + TInt RemoveModel(TModelBankID aModelBankID, TModelID aModelID); + + TInt RemoveRule(TGrammarID aGrammarID, TRuleID aRuleID); + TInt Train(TModelBankID aModelBankID, TModelID& aModelID); + TInt UnloadRule(TGrammarID aGrammarID, TRuleID aRuleID); + void SetEventHandler(MSpeechRecognitionUtilityObserver* aSpeechRecognitionUtilityObserver); + TInt GetAllPronunciationIDs(TLexiconID aLexiconID, RArray & aPronunciationIDs); + TInt GetAllModelIDs(TModelBankID aModelBankID, RArray & aModelIDs); + TInt GetAllRuleIDs(TGrammarID aGrammarID, RArray & aRuleIDs); + + TInt GetAllLexiconIDs(RArray & aPronunciationIDs); + TInt GetAllModelBankIDs(RArray & aModelIDs); + TInt GetAllGrammarIDs(RArray & aRuleIDs); + + TInt GetAllClientLexiconIDs(RArray & aPronunciationIDs); + TInt GetAllClientModelBankIDs(RArray & aModelIDs); + TInt GetAllClientGrammarIDs(RArray & aRuleIDs); + + TInt GetRuleValidity(TGrammarID aGrammarID, TRuleID aRuleID, TBool& aValid); + + TInt CreateModelBank(TModelBankID& aModelBankID); + TInt RemoveModelBank(TModelBankID aModelBankID); + TInt GetAvailableStorage(TInt& aAvailableStorage); + TInt LoadEngineParameters( const RArray& aParameterId, + const RArray& aParameterValue ); + + TInt SetAudioPriority( TInt aPriority, TInt aTrainPreference, + TInt aPlaybackPreference, TInt aRecognitionPreference ); + + void HandleEvent(const TMMFEvent& aEvent); + +private: + CBody(TUid aClientUid, MSpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver); + + void ConstructL(); + + // member variable MMF controller + RMMFController iMMFController; + // member variable for custom commands + RSpeechRecognitionCustomCommands iSrCustomCommands; + // member variable pointer for observer class + MSpeechRecognitionUtilityObserver* iSpeechRecognitionUtilityObserver; + + // member variable pointer for controller event monitor class + CMMFControllerEventMonitor* iControllerEventMonitor; + // used to indicate if an event is the result of an internal command + TBool iAsyncCallBusy; + + // member variable pointer for array of rule IDs - not owned + RArray * iRuleIDs; + // member variable pointer for array of pronunciation IDs - not owned + RArray * iPronunciationIDs; + // member variable pointer for array of model IDs - not owned + RArray * iModelIDs; + + // member variable pointer for array of Grammar IDs - not owned + RArray * iGrammarIDs; + // member variable pointer for array of Lexicon IDs - not owned + RArray * iLexiconIDs; + // member variable pointer for array of Model Bank IDs - not owned + RArray * iModelBankIDs; + + + // member variable for audio priority + TInt iAudioPriority; + // member variable for train preference + TMdaPriorityPreference iTrainPreference; + // member variable for playback preference + TMdaPriorityPreference iPlaybackPreference; + // member variable for recognition preference + TMdaPriorityPreference iRecognitionPreference; + + CSDClientResultSet* iResultSet; + + // settings used in the construction of the asr controlller + TMMFPrioritySettings iPrioritySettings; + + TUid iClientUid; + +}; + +#endif // __SPEECHRECOGNITIONUTILITY_H__