RSpeechRecognitionCustomCommands Class Reference

#include <mmf/common/speechrecognitioncustomcommands.h>

Link against: speechrecognitioncustomcommands.lib

class RSpeechRecognitionCustomCommands : public RMMFCustomCommandsBase

Inherits from

Public Member Functions
RSpeechRecognitionCustomCommands(RMMFController &)
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()
IMPORT_C TIntGetAllClientLexiconIDs()
IMPORT_C TIntGetAllClientModelBankIDs()
IMPORT_C TIntGetAllGrammarIDs()
IMPORT_C TIntGetAllLexiconIDs()
IMPORT_C TIntGetAllModelBankIDs()
IMPORT_C TIntGetAllModelIDs(TModelBankID)
IMPORT_C TIntGetAllPronunciationIDs(TLexiconID)
IMPORT_C TIntGetAllRuleIDs(TGrammarID)
IMPORT_C TIntGetAvailableStorage(TInt &)
IMPORT_C TIntGetEngineProperties(const RArray< TInt > &, RArray< TInt > &)
IMPORT_C voidGetGrammarIDArrayL(RArray< TGrammarID > &)
IMPORT_C voidGetLexiconIDArrayL(RArray< TLexiconID > &)
IMPORT_C voidGetModelBankIDArrayL(RArray< TModelBankID > &)
IMPORT_C TIntGetModelCount(TModelBankID, TInt &)
IMPORT_C voidGetModelIDArrayL(RArray< TModelID > &)
IMPORT_C voidGetPronunciationIDArrayL(RArray< TPronunciationID > &)
IMPORT_C voidGetResultSetL(CSDClientResultSet &)
IMPORT_C voidGetRuleIDArrayL(RArray< TRuleID > &)
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 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 TIntSetClientUid(TUid)
IMPORT_C TIntStartRecSession(TRecognitionMode)
IMPORT_C TIntTrain(TModelBankID, TModelID &)
IMPORT_C TIntUnloadRule(TGrammarID, TRuleID)
Inherited Attributes
RMMFCustomCommandsBase::iController
RMMFCustomCommandsBase::iDestinationPckg
Inherited Functions
RMMFCustomCommandsBase::RMMFCustomCommandsBase(RMMFController &,TUid)

Detailed Description

This is the main class of Speech Recognition Custom Commands.

Since
8.0

Constructor & Destructor Documentation

RSpeechRecognitionCustomCommands ( RMMFController & )

IMPORT_CRSpeechRecognitionCustomCommands(RMMFController &aController)

Public C++ constructor for RSpeechRecognitionCustomCommands class.

Since
8.0
Parameters
aControllerA reference to a RMMFController object.

Member Function 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.

Since
8.0
Parameters
aLexiconIDThe lexicon ID to where the new pronunciation is added.
aModelBankIDThe model bank ID.
aModelIDThe model ID.
aPronunciationIDA reference to where a new pronunciation ID is assigned.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

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.

Since
8.0
Parameters
aGrammarIDThe grammar ID to where the new rule is added.
aLexiconIDThe lexicon ID.
aPronunciationIDThe pronunciation ID.
aRuleIDA reference to where a new rule ID is assigned.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Cancel ( )

IMPORT_C voidCancel()

Cancels the current operation.

Since
8.0

CommitChanges ( )

IMPORT_C TIntCommitChanges()

Commits the current train operation to the database.

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

CreateGrammar ( TGrammarID & )

IMPORT_C TIntCreateGrammar(TGrammarID &aGrammarID)

Creates a new grammar.

Since
8.0
Parameters
aGrammarIDA reference to where the grammar ID is stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

CreateLexicon ( TLexiconID & )

IMPORT_C TIntCreateLexicon(TLexiconID &aLexiconID)

Creates a new lexicon.

Since
8.0
Parameters
aLexiconIDA reference where lexicon ID is stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

CreateModelBank ( TModelBankID & )

IMPORT_C TIntCreateModelBank(TModelBankID &aModelBankID)

Creates a new model bank.

Since
8.0
Parameters
aModelBankIDA reference to where a new model bank ID is assigned.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

EndRecSession ( )

IMPORT_C TIntEndRecSession()

Ends the current recognition session.

The resources allocated for recognition are freed.

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

GetAllClientGrammarIDs ( )

IMPORT_C TIntGetAllClientGrammarIDs()

Returns all grammar IDs owned by the client.

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

GetAllClientLexiconIDs ( )

IMPORT_C TIntGetAllClientLexiconIDs()

Returns all lexicon IDs owned by the client.

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

GetAllClientModelBankIDs ( )

IMPORT_C TIntGetAllClientModelBankIDs()

Returns all modelBank IDs owned by the client.

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

GetAllGrammarIDs ( )

IMPORT_C TIntGetAllGrammarIDs()

Returns all grammar IDs owned by the client.

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

GetAllLexiconIDs ( )

IMPORT_C TIntGetAllLexiconIDs()

Returns all lexicon IDs owned by the client.

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

GetAllModelBankIDs ( )

IMPORT_C TIntGetAllModelBankIDs()

Returns all modelBank IDs owned by the client.

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

GetAllModelIDs ( TModelBankID )

IMPORT_C TIntGetAllModelIDs(TModelBankIDaModelBankID)

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

Since
8.0
Parameters
aModelBankIDThe model bank ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllPronunciationIDs ( TLexiconID )

IMPORT_C TIntGetAllPronunciationIDs(TLexiconIDaLexiconID)

Returns all pronunciation IDs that exist in the specified lexicon.

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllRuleIDs ( TGrammarID )

IMPORT_C TIntGetAllRuleIDs(TGrammarIDaGrammarID)

Returns all rule IDs that exist in the specified grammar.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAvailableStorage ( TInt & )

IMPORT_C TIntGetAvailableStorage(TInt &aAvailableStorage)

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

Since
8.0
Parameters
aAvailableStorageThe number of models that can be held in available storage space.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

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.

Since
8.0
Parameters
aPropertyIdA constant reference to an array of engine property IDs.
aPropertyValueA reference to an array of engine property values.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetGrammarIDArrayL ( RArray< TGrammarID > & )

IMPORT_C voidGetGrammarIDArrayL(RArray< TGrammarID > &aGrammarIDs)

Gets an array of grammar IDs previously requested by GetAllGrammarIDs.

Since
8.0
Parameters
aGrammarIDsAn array to store grammar IDs.

GetLexiconIDArrayL ( RArray< TLexiconID > & )

IMPORT_C voidGetLexiconIDArrayL(RArray< TLexiconID > &aLexiconIDs)

Gets an array of lexicon IDs previously requested by GetAllLexiconIDs.

Since
8.0
Parameters
aLexiconIDsAn array to store lexicon IDs.

GetModelBankIDArrayL ( RArray< TModelBankID > & )

IMPORT_C voidGetModelBankIDArrayL(RArray< TModelBankID > &aModelBankIDs)

Gets an array of modelBank IDs previously requested by GetAllModelBankIDs.

Since
8.0
Parameters
aModelBankIDsAn array to store modelBank IDs.

GetModelCount ( TModelBankID, TInt & )

IMPORT_C TIntGetModelCount(TModelBankIDaModelBankID,
TInt &aModelCount
)

Returns the number of models in the specified model bank.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelCountThe reference where the number of models is set.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetModelIDArrayL ( RArray< TModelID > & )

IMPORT_C voidGetModelIDArrayL(RArray< TModelID > &aModelIDs)

Gets an array of model IDs previously requested by GetAllModelIDs.

Since
8.0
Parameters
aModelIDsAn array to store model IDs.

GetPronunciationIDArrayL ( RArray< TPronunciationID > & )

IMPORT_C voidGetPronunciationIDArrayL(RArray< TPronunciationID > &aPronunciationIDs)

Gets an array of pronunciation IDs previously requested by GetAllPronunciationIDs.

Since
8.0
Parameters
aPronunciationIDsAn array to store pronunciation IDs.

GetResultSetL ( CSDClientResultSet & )

IMPORT_C voidGetResultSetL(CSDClientResultSet &aResultSet)

Gets a client result set previously created by a call to Recognise().

Since
8.0
Parameters
aResultSetThe ResultSet used to contain the recognition results

GetRuleIDArrayL ( RArray< TRuleID > & )

IMPORT_C voidGetRuleIDArrayL(RArray< TRuleID > &aRuleIDs)

Gets an array of rule IDs previously requested by GetAllRuleIDs.

Since
8.0
Parameters
aRuleIDsAn array to store rule IDs.

GetRuleValidity ( TGrammarID, TRuleID, TBool & )

IMPORT_C TIntGetRuleValidity(TGrammarIDaGrammarID,
TRuleIDaRuleID,
TBool &aValid
)

Checks if the rule is valid or not.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
aRuleIDThe rule ID.
aValidA reference where the validity of the rule is set.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetUtteranceDuration ( TModelBankID, TModelID, TTimeIntervalMicroSeconds32 & )

IMPORT_C TIntGetUtteranceDuration(TModelBankIDaModelBankID,
TModelIDaModelID,
TTimeIntervalMicroSeconds32 &aDuration
)
Returns the duration of the utterance for the specified model.
Since
8.0
Parameters
aModelBankIDmodel bank Id
aModelIDmodel Id
aDurationreference where the duration of utterance is set
Return Value
System-wide errors

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

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

Uploads the specified parameters into the engine.

Since
8.0
Parameters
aParameterIdAn array of parameter IDs.
aParameterValueAn array of parameter values.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

LoadGrammar ( TGrammarID )

IMPORT_C TIntLoadGrammar(TGrammarIDaGrammarID)

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

Since
8.0
Parameters
aGrammarIDThe grammar ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

LoadLexicon ( TLexiconID )

IMPORT_C TIntLoadLexicon(TLexiconIDaLexiconID)

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

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

LoadModels ( TModelBankID )

IMPORT_C TIntLoadModels(TModelBankIDaModelBankID)

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

Since
8.0
Parameters
aModelBankIDThe model bank ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

PlayUtterance ( TModelBankID, TModelID )

IMPORT_C TIntPlayUtterance(TModelBankIDaModelBankID,
TModelIDaModelID
)

Plays the previously trained utterance.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDThe model ID, whose utterance is played.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Recognize ( CSDClientResultSet & )

IMPORT_C TIntRecognize(CSDClientResultSet &aResultSet)

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

Since
8.0
Parameters
aResultSetA reference where the recognition result is set.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Record ( TTimeIntervalMicroSeconds32 )

IMPORT_C TIntRecord(TTimeIntervalMicroSeconds32aRecordTime)

Records the user utterance for training and recognition.

Since
8.0
Parameters
aRecordTimeThe recording time in microseconds.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveGrammar ( TGrammarID )

IMPORT_C TIntRemoveGrammar(TGrammarIDaGrammarID)

Removes the specified grammar from the permanent storage.

Removing a grammar will remove all rules within the grammar.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveLexicon ( TLexiconID )

IMPORT_C TIntRemoveLexicon(TLexiconIDaLexiconID)

Removes the specified lexicon from the permanent storage.

Removing a lexicon will remove all pronunciations within the lexicon.

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveModel ( TModelBankID, TModelID )

IMPORT_C TIntRemoveModel(TModelBankIDaModelBankID,
TModelIDaModelID
)

Removes the specified model from the specified model bank permanently.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDThe model ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

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.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemovePronunciation ( TLexiconID, TPronunciationID )

IMPORT_C TIntRemovePronunciation(TLexiconIDaLexiconID,
TPronunciationIDaPronunciationID
)

Removes the specified pronunciation from the specified lexicon permanently.

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
aPronunciationIDThe pronunciation ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveRule ( TGrammarID, TRuleID )

IMPORT_C TIntRemoveRule(TGrammarIDaGrammarID,
TRuleIDaRuleID
)

Removes the specified rule from the specified grammar permanently.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
aRuleIDThe rule ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

SetClientUid ( TUid )

IMPORT_C TIntSetClientUid(TUidaClientUid)

Sets the client UID for client.

Since
8.0
Parameters
aClientUidThe client UID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

StartRecSession ( TRecognitionMode )

IMPORT_C TIntStartRecSession(TRecognitionModeaMode)

Starts a new recognition session.

Since
8.0
Parameters
aModeThe recognition mode.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Train ( TModelBankID, TModelID & )

IMPORT_C TIntTrain(TModelBankIDaModelBankID,
TModelID &aModelID
)

Trains a new model into the specified model bank.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDThe reference to where a new model ID is assigned.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

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.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
aRuleIDThe rule ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.