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