CSpeechRecognitionUtility Class Reference

class CSpeechRecognitionUtility : public CBase

This is the main class of Speech Recognition Utility.

8.0

Inherits from

  • CSpeechRecognitionUtility

Nested Classes and Structures

Public Member Functions
~CSpeechRecognitionUtility()
IMPORT_C TIntAddPronunciation(TLexiconID, TModelBankID, TModelID, TPronunciationID &)
IMPORT_C TIntAddRule(TGrammarID, TLexiconID, TPronunciationID, TRuleID &)
IMPORT_C voidCancel()
IMPORT_C TIntCommitChanges()
IMPORT_C TIntCreateGrammar(TGrammarID &)
IMPORT_C TIntCreateLexicon(TLexiconID &)
IMPORT_C TIntCreateModelBank(TModelBankID &)
IMPORT_C TIntEndRecSession()
IMPORT_C TIntGetAllClientGrammarIDs(RArray< TGrammarID > &)
IMPORT_C TIntGetAllClientLexiconIDs(RArray< TLexiconID > &)
IMPORT_C TIntGetAllClientModelBankIDs(RArray< TModelBankID > &)
IMPORT_C TIntGetAllGrammarIDs(RArray< TGrammarID > &)
IMPORT_C TIntGetAllLexiconIDs(RArray< TLexiconID > &)
IMPORT_C TIntGetAllModelBankIDs(RArray< TModelBankID > &)
IMPORT_C TIntGetAllModelIDs(TModelBankID, RArray< TModelID > &)
IMPORT_C TIntGetAllPronunciationIDs(TLexiconID, RArray< TPronunciationID > &)
IMPORT_C TIntGetAllRuleIDs(TGrammarID, RArray< TRuleID > &)
IMPORT_C TIntGetAvailableStorage(TInt &)
IMPORT_C TIntGetEngineProperties(const RArray< TInt > &, RArray< TInt > &)
IMPORT_C TIntGetModelCount(TModelBankID, TInt &)
IMPORT_C TIntGetRuleValidity(TGrammarID, TRuleID, TBool &)
IMPORT_C TIntGetUtteranceDuration(TModelBankID, TModelID, TTimeIntervalMicroSeconds32 &)
IMPORT_C TIntLoadEngineParameters(const RArray< TInt > &, const RArray< TInt > &)
IMPORT_C TIntLoadGrammar(TGrammarID)
IMPORT_C TIntLoadLexicon(TLexiconID)
IMPORT_C TIntLoadModels(TModelBankID)
IMPORT_C CSpeechRecognitionUtility *NewL(MSpeechRecognitionUtilityObserver &, TUid)
IMPORT_C CSpeechRecognitionUtility *NewLC(MSpeechRecognitionUtilityObserver &, TUid)
IMPORT_C TIntPlayUtterance(TModelBankID, TModelID)
IMPORT_C TIntRecognize(CSDClientResultSet &)
IMPORT_C TIntRecord(TTimeIntervalMicroSeconds32)
IMPORT_C TIntRemoveGrammar(TGrammarID)
IMPORT_C TIntRemoveLexicon(TLexiconID)
IMPORT_C TIntRemoveModel(TModelBankID, TModelID)
IMPORT_C TIntRemoveModelBank(TModelBankID)
IMPORT_C TIntRemovePronunciation(TLexiconID, TPronunciationID)
IMPORT_C TIntRemoveRule(TGrammarID, TRuleID)
IMPORT_C TIntSetAudioPriority(TInt, TInt, TInt, TInt)
IMPORT_C voidSetEventHandler(MSpeechRecognitionUtilityObserver *)
IMPORT_C TIntStartRecSession(TRecognitionMode)
IMPORT_C TIntTrain(TModelBankID, TModelID &)
IMPORT_C TIntUnloadRule(TGrammarID, TRuleID)
Private Member Functions
CSpeechRecognitionUtility()
voidConstructL(MSpeechRecognitionUtilityObserver &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
CBody *iBody

Constructor & Destructor Documentation

CSpeechRecognitionUtility()

CSpeechRecognitionUtility()[private]

Private C++ constructor for this class.

8.0

~CSpeechRecognitionUtility()

IMPORT_C~CSpeechRecognitionUtility()

Destructor.

8.0

Member Functions Documentation

AddPronunciation(TLexiconID, TModelBankID, TModelID, TPronunciationID &)

IMPORT_C TIntAddPronunciation(TLexiconIDaLexiconID,
TModelBankIDaModelBankID,
TModelIDaModelID,
TPronunciationID &aPronunciationID
)

Adds a new pronunciation for the given model into the specified lexicon.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TLexiconID aLexiconIDThe lexicon ID, where the new pronunciation is added to.
TModelBankID aModelBankIDThe model bank ID.
TModelID aModelIDThe model ID.
TPronunciationID & aPronunciationIDA reference where the new pronunciation ID is assigned to.

AddRule(TGrammarID, TLexiconID, TPronunciationID, TRuleID &)

IMPORT_C TIntAddRule(TGrammarIDaGrammarID,
TLexiconIDaLexiconID,
TPronunciationIDaPronunciationID,
TRuleID &aRuleID
)

Adds a new rule for the given pronunciation into the specified grammar.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID aGrammarIDThe grammar ID, where the new rule is added to.
TLexiconID aLexiconIDThe lexicon ID.
TPronunciationID aPronunciationIDThe pronunciation ID.
TRuleID & aRuleIDA reference where the new rule ID is assigned to.

Cancel()

IMPORT_C voidCancel()

Cancels the current operation.

8.0

CommitChanges()

IMPORT_C TIntCommitChanges()

Commit the current train operation to the database.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

ConstructL(MSpeechRecognitionUtilityObserver &)

voidConstructL(MSpeechRecognitionUtilityObserver &aSpeechRecognitionUtilityObserver)[private]

Second phase constructor for this class.

8.0

Parameters

MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserverA reference to the event observer class.

CreateGrammar(TGrammarID &)

IMPORT_C TIntCreateGrammar(TGrammarID &aGrammarID)

Creates a new grammar.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID & aGrammarIDA reference where grammar ID is stored.

CreateLexicon(TLexiconID &)

IMPORT_C TIntCreateLexicon(TLexiconID &aLexiconID)

Creates a new lexicon.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TLexiconID & aLexiconIDA reference where lexicon ID is stored.

CreateModelBank(TModelBankID &)

IMPORT_C TIntCreateModelBank(TModelBankID &aModelBankID)

Creates a new model bank.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID & aModelBankIDA reference where a new model bank IF is assigned to.

EndRecSession()

IMPORT_C TIntEndRecSession()

Ends the current recognition session. Resources allocated for recognition are freed.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

GetAllClientGrammarIDs(RArray< TGrammarID > &)

IMPORT_C TIntGetAllClientGrammarIDs(RArray< TGrammarID > &aGrammarIDs)

Returns all grammar IDs owned by the client.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

RArray< TGrammarID > & aGrammarIDsA reference where rule IDs are stored.

GetAllClientLexiconIDs(RArray< TLexiconID > &)

IMPORT_C TIntGetAllClientLexiconIDs(RArray< TLexiconID > &aLexiconIDs)

Returns all lexicons owned by the client.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

RArray< TLexiconID > & aLexiconIDsA reference where lexicon IDs are stored.

GetAllClientModelBankIDs(RArray< TModelBankID > &)

IMPORT_C TIntGetAllClientModelBankIDs(RArray< TModelBankID > &aModelBankIDs)

Returns all modelbank IDs owned by the client.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

RArray< TModelBankID > & aModelBankIDsA reference where modelbank IDs are stored.

GetAllGrammarIDs(RArray< TGrammarID > &)

IMPORT_C TIntGetAllGrammarIDs(RArray< TGrammarID > &aGrammarIDs)

Returns all grammar IDs.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

RArray< TGrammarID > & aGrammarIDsA reference where rule IDs are stored.

GetAllLexiconIDs(RArray< TLexiconID > &)

IMPORT_C TIntGetAllLexiconIDs(RArray< TLexiconID > &aLexiconIDs)

Returns all lexicons IDs.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

RArray< TLexiconID > & aLexiconIDsA reference where lexicon IDs are stored.

GetAllModelBankIDs(RArray< TModelBankID > &)

IMPORT_C TIntGetAllModelBankIDs(RArray< TModelBankID > &aModelBankIDs)

Returns all modelbank IDs.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

RArray< TModelBankID > & aModelBankIDsA reference where modelbank IDs are stored.

GetAllModelIDs(TModelBankID, RArray< TModelID > &)

IMPORT_C TIntGetAllModelIDs(TModelBankIDaModelBankID,
RArray< TModelID > &aModelIDs
)

Returns all model IDs that exist in the specified model bank.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe model bank ID.
RArray< TModelID > & aModelIDsA reference where model IDs are stored.

GetAllPronunciationIDs(TLexiconID, RArray< TPronunciationID > &)

IMPORT_C TIntGetAllPronunciationIDs(TLexiconIDaLexiconID,
RArray< TPronunciationID > &aPronunciationIDs
)

Returns all pronunciation IDs that exist in the specified lexicon.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TLexiconID aLexiconIDThe lexicon ID.
RArray< TPronunciationID > & aPronunciationIDsA reference where pronunciation IDs are stored.

GetAllRuleIDs(TGrammarID, RArray< TRuleID > &)

IMPORT_C TIntGetAllRuleIDs(TGrammarIDaGrammarID,
RArray< TRuleID > &aRuleIDs
)

Returns all rule IDs that exist in the specified grammar.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID aGrammarIDThe grammar ID.
RArray< TRuleID > & aRuleIDsA reference where rule IDs are stored.

GetAvailableStorage(TInt &)

IMPORT_C TIntGetAvailableStorage(TInt &aAvailableStorage)

Returns the number of models available for training system model storage, based on available disk space.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TInt & aAvailableStorageThe number of models that can be contained in available storage.

GetEngineProperties(const RArray< TInt > &, RArray< TInt > &)

IMPORT_C TIntGetEngineProperties(const RArray< TInt > &aPropertyId,
RArray< TInt > &aPropertyValue
)

Returns the engine properties specified by the engine property ID array. On return aPropertyValue contains an array of engine properties.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

const RArray< TInt > & aPropertyIdA constant reference to an array of engine property ID's.
RArray< TInt > & aPropertyValueA reference to an array of engine property values.

GetModelCount(TModelBankID, TInt &)

IMPORT_C TIntGetModelCount(TModelBankIDaModelBankID,
TInt &aModelCount
)

Returns the number of models in the specified model bank.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe model bank ID.
TInt & aModelCountThe reference where the number of models is set.

GetRuleValidity(TGrammarID, TRuleID, TBool &)

IMPORT_C TIntGetRuleValidity(TGrammarIDaGrammarID,
TRuleIDaRuleID,
TBool &aValid
)

Checks if the rule is valid or not.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID aGrammarIDThe grammar ID.
TRuleID aRuleIDThe rule ID.
TBool & aValidA reference where the validity of the rule is set.

GetUtteranceDuration(TModelBankID, TModelID, TTimeIntervalMicroSeconds32 &)

IMPORT_C TIntGetUtteranceDuration(TModelBankIDaModelBankID,
TModelIDaModelID,
TTimeIntervalMicroSeconds32 &aDuration
)

Returns the duration of the utterance for the specified model.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe model bank ID.
TModelID aModelIDThe model ID.
TTimeIntervalMicroSeconds32 & aDurationThe reference where the duration of utterance is set.

LoadEngineParameters(const RArray< TInt > &, const RArray< TInt > &)

IMPORT_C TIntLoadEngineParameters(const RArray< TInt > &aParameterId,
const RArray< TInt > &aParameterValue
)

Loads the specified parameters into the recognition engine.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

const RArray< TInt > & aParameterIdThe array of parameter IDs.
const RArray< TInt > & aParameterValueThe array of parameter values.

LoadGrammar(TGrammarID)

IMPORT_C TIntLoadGrammar(TGrammarIDaGrammarID)

Loads the specified grammar into the recognizer; done prior to recognition.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID aGrammarIDThe grammar ID.

LoadLexicon(TLexiconID)

IMPORT_C TIntLoadLexicon(TLexiconIDaLexiconID)

Loads the specified lexicon into the recognizer; done prior to recognition.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TLexiconID aLexiconIDThe lexicon ID.

LoadModels(TModelBankID)

IMPORT_C TIntLoadModels(TModelBankIDaModelBankID)

Loads the specified model bank into the recognizer; done prior to recognition.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe Model bank ID

NewL(MSpeechRecognitionUtilityObserver &, TUid)

IMPORT_C CSpeechRecognitionUtility *NewL(MSpeechRecognitionUtilityObserver &aSpeechRecognitionUtilityObserver,
TUidaClientUid
)[static]

Factory function for creating this class.

A pointer to CSpeechRecognitionUtility object

8.0

Parameters

MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserverA reference to the event observer class.
TUid aClientUidThe UID of the client.

NewLC(MSpeechRecognitionUtilityObserver &, TUid)

IMPORT_C CSpeechRecognitionUtility *NewLC(MSpeechRecognitionUtilityObserver &aSpeechRecognitionUtilityObserver,
TUidaClientUid
)[static]

Factory function for creating this class. Leaves a pointer on the cleanup stack.

A pointer to a CSpeechRecognitionUtility object.

8.0

Parameters

MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserverA reference to the event observer class.
TUid aClientUidA client UID for data ownership.

PlayUtterance(TModelBankID, TModelID)

IMPORT_C TIntPlayUtterance(TModelBankIDaModelBankID,
TModelIDaModelID
)

Plays the previously trained utterance.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe model bank ID.
TModelID aModelIDThe model ID, whose utterance is played.

Recognize(CSDClientResultSet &)

IMPORT_C TIntRecognize(CSDClientResultSet &aResultSet)

Initiates recognition; performed following loading of model bank, lexicon, and grammar.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

CSDClientResultSet & aResultSetA reference where the recognition result is set.

Record(TTimeIntervalMicroSeconds32)

IMPORT_C TIntRecord(TTimeIntervalMicroSeconds32aRecordTime)

Records user utterance for training and recognition.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TTimeIntervalMicroSeconds32 aRecordTimeThe recording time in microseconds.

RemoveGrammar(TGrammarID)

IMPORT_C TIntRemoveGrammar(TGrammarIDaGrammarID)

Removes the specified grammar from the permanent storage.

Removing a grammar will remove all rules within the grammar.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID aGrammarIDThe grammar ID.

RemoveLexicon(TLexiconID)

IMPORT_C TIntRemoveLexicon(TLexiconIDaLexiconID)

Removes the specified lexicon from the permanent storage.

Removing a lexicon will remove all pronunciations within the lexicon.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TLexiconID aLexiconIDThe lexicon ID.

RemoveModel(TModelBankID, TModelID)

IMPORT_C TIntRemoveModel(TModelBankIDaModelBankID,
TModelIDaModelID
)

Removes the specified model from the specified model bank permanently.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe model bank ID.
TModelID aModelIDThe model ID.

RemoveModelBank(TModelBankID)

IMPORT_C TIntRemoveModelBank(TModelBankIDaModelBankID)

Removes the specified model bank from the permanent storage.

Removing a model bank will remove all models within the model bank.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe model bank ID.

RemovePronunciation(TLexiconID, TPronunciationID)

IMPORT_C TIntRemovePronunciation(TLexiconIDaLexiconID,
TPronunciationIDaPronunciationID
)

Removes the specified pronunciation from the specified lexicon permanently.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TLexiconID aLexiconIDThe lexicon ID.
TPronunciationID aPronunciationIDThe pronunciation ID.

RemoveRule(TGrammarID, TRuleID)

IMPORT_C TIntRemoveRule(TGrammarIDaGrammarID,
TRuleIDaRuleID
)

Removes the specified rule from the specified grammar permanently.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID aGrammarIDThe grammar ID.
TRuleID aRuleIDThe rule ID.

SetAudioPriority(TInt, TInt, TInt, TInt)

IMPORT_C TIntSetAudioPriority(TIntaPriority,
TIntaTrainPreference,
TIntaPlaybackPreference,
TIntaRecognitionPreference
)

Sets the audio priority and preference for train, playback and recognition.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TInt aPriorityThe priority for voice recognition.
TInt aTrainPreferenceThe preference for training.
TInt aPlaybackPreferenceThe preference for playback.
TInt aRecognitionPreferenceThe preference for recognition.

SetEventHandler(MSpeechRecognitionUtilityObserver *)

IMPORT_C voidSetEventHandler(MSpeechRecognitionUtilityObserver *aSpeechRecognitionUtilityObserver)

Sets the event handler for asynchronous events.

8.0

Parameters

MSpeechRecognitionUtilityObserver * aSpeechRecognitionUtilityObserverA pointer to an observer.

StartRecSession(TRecognitionMode)

IMPORT_C TIntStartRecSession(TRecognitionModeaMode)

Starts a new recognition session.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TRecognitionMode aModeThe recognition mode.

Train(TModelBankID, TModelID &)

IMPORT_C TIntTrain(TModelBankIDaModelBankID,
TModelID &aModelID
)

Trains a new model into the specified model bank.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TModelBankID aModelBankIDThe model bank ID.
TModelID & aModelIDA reference where a new model ID is assigned to.

UnloadRule(TGrammarID, TRuleID)

IMPORT_C TIntUnloadRule(TGrammarIDaGrammarID,
TRuleIDaRuleID
)

Unloads the specified rule from the specified grammar in temporary memory, previously loaded with LoadGrammarL.

The rule in the permanent storage remains intact.

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

8.0

Parameters

TGrammarID aGrammarIDThe grammar ID.
TRuleID aRuleIDThe rule ID.

Member Data Documentation

CBody * iBody

CBody *iBody[private]