CNssSpeechItem Class Reference

class CNssSpeechItem : public CBase

The CNssSpeechItem class provides a realization of the MNssSpeechItem client interface. The CNssSpeechItem methods use the CSpeechRecognitionUtility Api to implement client speech requests.

nssvasapi.lib
Since
2.8

Inherits from

Nested Classes and Structures

Public Member Functions
~CNssSpeechItem()
TNssSpeechItemResultCancelL()
MNssCoreSrsDBEventHandler::TNssSrsDBResult CommitSrsChanges()
CNssSpeechItem *CopyL(CNssContext *)
voidDelayedTrainingComplete(TUint32)
TUint32 GrammarId()
TBool IsPlayingSupported()
voidMapcCustomCommandEvent(TInt, TInt)
voidMapcInitComplete(TInt, const TTimeIntervalMicroSeconds &)
voidMapcPlayComplete(TInt)
voidMsruoEvent(TUid, TInt)
MNssCoreSrsDBEventHandler::TNssSrsDBResult NSSBeginDeleteFromSrs(MNssDeleteTagClient *, CNssTag *)
MNssCoreSrsDBEventHandler::TNssSrsDBResult NSSBeginSaveToSrs(MNssSaveTagClient *, CNssTag *)
CNssSpeechItem *NewL(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &)
CNssSpeechItem *NewL(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &, TUint32, const TDesC &)
CNssSpeechItem *NewLC(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &, TUint32, const TDesC &)
HBufC *PartialTextL(const TDesC &)
TNssSpeechItemResultPlayL(MNssPlayEventHandler *)
TNssSpeechItemResultPlayL(MNssPlayEventHandler *, TLanguage)
TDesC &RawText()
TNssSpeechItemResultRecordL(MNssTrainVoiceEventHandler *)
MNssCoreSrsDBEventHandler::TNssSrsDBResult RollbackSrsChanges()
TUint32 RuleID()
voidSetRuleID(TUint32)
voidSetTagId(TInt)
voidSetTextL(const TDesC &)
voidSetTrained(TBool)
voidSetTrainedType(TNssVasCoreConstant::TNssTrainedType)
TInt TagId()
TDesC &Text()
TNssSpeechItemResultTrainTextL(MNssTrainTextEventHandler *, CNssTrainingParameters *)
TNssSpeechItemResultTrainVoiceL(MNssTrainVoiceEventHandler *)
TBool Trained()
TNssVasCoreConstant::TNssTrainedType TrainedType()
CArrayFixFlat< TNssVasCoreConstant::TNssTrainingCapability > *TrainingCapabilities()
Private Member Functions
CNssSpeechItem(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &)
voidCleanPlayback()
voidCleanUp()
voidConstructL(TUint32, const TDesC &)
voidCopyUtteranceData()
voidDoAddPronounciationFailEvent(TInt)
voidDoAddPronunciationCompleteEvent()
voidDoGetAvailableStorageCompleteEvent()
voidDoGetUtteranceDurationCompleteEvent()
voidDoPlayCompleteEvent()
voidDoPlayFailEvent(TInt)
voidDoPlayL()
MNssPlayEventHandler::TNssPlayResult DoPlayResult(TInt)
voidDoRemoveModelCompleteEvent()
voidDoRemoveModelFailEvent(TInt)
TBool DoRetry()
MNssCoreSrsDBEventHandler::TNssSrsDBResult DoSrsDBResult(TInt)
voidDoTrainCompleteEvent()
voidDoTrainFailEvent(TInt)
MNssTrainVoiceEventHandler::TNssTrainResult DoTrainResult(TInt)
voidMakePlayCallback(TInt)
voidNotifyHandlerForUnexpectedEvent()
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
CNssContext &iContext
TNssSpeechItemConstant::TNssState iOldState
TTimeIntervalMicroSeconds32 iPlayDuration
MNssPlayEventHandler *iPlayEventHandler
CNssSpeechItemSrsPortal &iPortal
TBool iRecover
TInt iRetry
TUint32 iRuleID
TNssSpeechItemConstant::TNssState iState
TInt iTagId
HBufC *iText
MNssTrainVoiceEventHandler *iTrainVoiceEventHandler
TBool iTrained
TNssVasCoreConstant::TNssTrainedType iTrainedType
CNssSpeechItemTrainer &iTrainer
TUint32 iTransientRuleID
HBufC *iTrimmedText
TTtsData *iTtsData

Constructor & Destructor Documentation

CNssSpeechItem(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &)

CNssSpeechItem(CNssContext &aContext,
CNssSpeechItemSrsPortal &aPortal,
CNssSpeechItemTrainer &aTrainer
)[private]

C++ constructor

Parameters

CNssContext & aContextreference to Context object
CNssSpeechItemSrsPortal & aPortalreference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainerreference to speech item trainer

~CNssSpeechItem()

~CNssSpeechItem()

Destructor.

Member Functions Documentation

CancelL()

TNssSpeechItemResultCancelL()

Method called by the client to cancel the previous operation.

Since
2.0

CleanPlayback()

voidCleanPlayback()[private]

This method releases resources, which were reserved for playing, and updated the state from PlayingStrated to Idle.

CleanUp()

voidCleanUp()[private]

Method to do clean up

CommitSrsChanges()

MNssCoreSrsDBEventHandler::TNssSrsDBResult CommitSrsChanges()
Method to commit the transaction to the SRS. This is a SYNCHRONOUS method.
Since
2.0

ConstructL(TUint32, const TDesC &)

voidConstructL(TUint32aRuleID,
const TDesC &aText
)[private]

Symbian 2nd phase constructor

Parameters

TUint32 aRuleIDRule ID value
const TDesC & aTextReference to the TDesc text

CopyL(CNssContext *)

CNssSpeechItem *CopyL(CNssContext *aContext)

Create a copy of the SpeechItem object. This cunction creates a new SpeechItem by allocating memory for a new SpeechItem, and deep copying the members of the SpeechItem on which this fucntion is called. Old SpeechItem and new SpeechItem exist. Client need to deallocate memory for both.

Parameters

CNssContext * aContexta pointer to a Context

CopyUtteranceData()

voidCopyUtteranceData()[private]

Method to copy utterance data from current to transient values

DelayedTrainingComplete(TUint32)

voidDelayedTrainingComplete(TUint32aRuleID)

Updates the speech item after training.

Since
2.8

Parameters

TUint32 aRuleIDRule ID.

DoAddPronounciationFailEvent(TInt)

voidDoAddPronounciationFailEvent(TIntaResult)[private]

Method to handle the "AddPronunciation" fail from SRS

Parameters

TInt aResulta Result value from the event

DoAddPronunciationCompleteEvent()

voidDoAddPronunciationCompleteEvent()[private]

Method to handle the "AddPronunciation" complete from SRS

DoGetAvailableStorageCompleteEvent()

voidDoGetAvailableStorageCompleteEvent()[private]

Method to handle the "GetAvailableStorageEvent" complete from SRS

DoGetUtteranceDurationCompleteEvent()

voidDoGetUtteranceDurationCompleteEvent()[private]

Method to handle the "GetUtteranceDurationEvent" complete from SRS

DoPlayCompleteEvent()

voidDoPlayCompleteEvent()[private]

Method to handle the "PlayEvent" complete from SRS

DoPlayFailEvent(TInt)

voidDoPlayFailEvent(TIntaResult)[private]

Method to handle the "PlayEvent" fail from SRS

Parameters

TInt aResult- a Result value from the Play operation

DoPlayL()

voidDoPlayL()[private]

This method starts playback with CTtsUtility.

DoPlayResult(TInt)

MNssPlayEventHandler::TNssPlayResult DoPlayResult(TIntaResult)[private]

Method to process the SRS play error

Parameters

TInt aResultthe result value from SRS which indicates an error

DoRemoveModelCompleteEvent()

voidDoRemoveModelCompleteEvent()[private]

Method to handle the "RemoveModel" complete from SRS

DoRemoveModelFailEvent(TInt)

voidDoRemoveModelFailEvent(TIntaResult)[private]

Method to handle the "RemoveModel" fail from SRS

Parameters

TInt aResulta Result value from the event

DoRetry()

TBool DoRetry()[private]

Method to verify whether it is ok to retry

DoSrsDBResult(TInt)

MNssCoreSrsDBEventHandler::TNssSrsDBResult DoSrsDBResult(TIntaResult)[private]

Method to process the SRS DB error

Parameters

TInt aResultthe result value from SRS to indicate an error

DoTrainCompleteEvent()

voidDoTrainCompleteEvent()[private]

Method to handle the "TrainEvent" complete from SRS

DoTrainFailEvent(TInt)

voidDoTrainFailEvent(TIntaResult)[private]

Method to process the various train failed events from SRS'

Parameters

TInt aResultthe result value to indicate an error

DoTrainResult(TInt)

MNssTrainVoiceEventHandler::TNssTrainResult DoTrainResult(TIntaResult)[private]

Method to process the SRS train error

Parameters

TInt aResultthe result value from SRS which indicates an error

GrammarId()

TUint32 GrammarId()

Method to return the Grammar ID from the context of the speech item.

Since
2.8

IsPlayingSupported()

TBool IsPlayingSupported()

Method to query playing support.

Since
2.8

MakePlayCallback(TInt)

voidMakePlayCallback(TIntaResult)[private]

Makes the callback after playing has completed or failed.

Parameters

TInt aResult

MapcCustomCommandEvent(TInt, TInt)

voidMapcCustomCommandEvent(TIntaEvent,
TIntaError
)

Unused method for future extensions of MTtsClientUtilityObserver.

Parameters

TInt aEventevent ID
TInt aErrorresult

MapcInitComplete(TInt, const TTimeIntervalMicroSeconds &)

voidMapcInitComplete(TIntaError,
const TTimeIntervalMicroSeconds &aDuration
)

Method to signal that playing has been initialized.

Parameters

TInt aErrorSuccessful or not
const TTimeIntervalMicroSeconds & aDurationLength of the TTS waveform

MapcPlayComplete(TInt)

voidMapcPlayComplete(TIntaError)

Method to signal that playing has been completed.

Parameters

TInt aErrorSuccessful or not

MsruoEvent(TUid, TInt)

voidMsruoEvent(TUidaEvent,
TIntaResult
)

Function inherited from MSISpeechRecognitionUtilityObserver to handle the events from SRS Utility object

Since
2.0

Parameters

TUid aEventan event from the SRS utility object
TInt aResultthe result from aEvent operation

NSSBeginDeleteFromSrs(MNssDeleteTagClient *, CNssTag *)

MNssCoreSrsDBEventHandler::TNssSrsDBResult NSSBeginDeleteFromSrs(MNssDeleteTagClient *aDeleteTagClient,
CNssTag *aTag
)

Method to start transaction for deleting tags from SRS and VAS DB.

Since
2.0

Parameters

MNssDeleteTagClient * aDeleteTagClientCallback after we made it or died trying
CNssTag * aTagTag to be deleted

NSSBeginSaveToSrs(MNssSaveTagClient *, CNssTag *)

MNssCoreSrsDBEventHandler::TNssSrsDBResult NSSBeginSaveToSrs(MNssSaveTagClient *aSaveTagClient,
CNssTag *aTag
)

Method to start transaction for saving the data into the SRS.

Since
2.0

Parameters

MNssSaveTagClient * aSaveTagClientCallback after we made it or died trying
CNssTag * aTagTag to be deleted

NewL(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &)

CNssSpeechItem *NewL(CNssContext &aContext,
CNssSpeechItemSrsPortal &aPortal,
CNssSpeechItemTrainer &aTrainer
)[static]

Two-phased CNssSpeechItem constructor

Since
2.0

Parameters

CNssContext & aContextA reference to Context object
CNssSpeechItemSrsPortal & aPortalA reference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainer

NewL(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &, TUint32, const TDesC &)

CNssSpeechItem *NewL(CNssContext &aContext,
CNssSpeechItemSrsPortal &aPortal,
CNssSpeechItemTrainer &aTrainer,
TUint32aRuleID,
const TDesC &aText
)[static]

Two-phased CNssSpeechItem constructor

Since
2.0

Parameters

CNssContext & aContextA reference to Context object
CNssSpeechItemSrsPortal & aPortalA reference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainer
TUint32 aRuleIDA rule ID value
const TDesC & aTextA reference to the TDesc text

NewLC(CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &, TUint32, const TDesC &)

CNssSpeechItem *NewLC(CNssContext &aContext,
CNssSpeechItemSrsPortal &aPortal,
CNssSpeechItemTrainer &aTrainer,
TUint32aRuleID,
const TDesC &aText
)[static]

Two-phased CNssSpeechItem constructor

Since
2.0

Parameters

CNssContext & aContextA reference to Context object
CNssSpeechItemSrsPortal & aPortalA reference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainer
TUint32 aRuleIDA rule ID value
const TDesC & aTextA reference to the TDesc text

NotifyHandlerForUnexpectedEvent()

voidNotifyHandlerForUnexpectedEvent()[private]

Method to notify the event handler for receiving the Unexpected Event

PartialTextL(const TDesC &)

HBufC *PartialTextL(const TDesC &aIdentifier)

Returns the part of text which identified with the given id. If RawText() is for example "_1Amy_1Harris_2mobile" then PartialTextL( _L( "1" ) ) call will return "Amy Harris".

Since
3.2

Parameters

const TDesC & aIdentifierID of the text part to return Text or KNullDesC if identifier is not found

PlayL(MNssPlayEventHandler *)

TNssSpeechItemResultPlayL(MNssPlayEventHandler *aPlayEventHandler)

Method called by the client to indicate to SRS that a playback is needed.

Since
2.0

Parameters

MNssPlayEventHandler * aPlayEventHandlera reference to PlayEventHandler

PlayL(MNssPlayEventHandler *, TLanguage)

TNssSpeechItemResultPlayL(MNssPlayEventHandler *aPlayEventHandler,
TLanguageaLanguage
)

Method called by the client to indicate to SRS that a playback is needed with a certain language.

Since
2.8

Parameters

MNssPlayEventHandler * aPlayEventHandlera call back object to handle the play events
TLanguage aLanguagelanguage which will be used in playback

RawText()

TDesC &RawText()

Returns the raw training text from where escape characters are not removed. Should not be used by clients who want to display the string.

Since
3.2

RecordL(MNssTrainVoiceEventHandler *)

TNssSpeechItemResultRecordL(MNssTrainVoiceEventHandler *aTrainVoiceEventHandler)

The Record method is used by the client in the train voice sequence for SRS to record input speech.

Since
2.0

Parameters

MNssTrainVoiceEventHandler * aTrainVoiceEventHandlera reference to TrainVoiceEventHandler

RollbackSrsChanges()

MNssCoreSrsDBEventHandler::TNssSrsDBResult RollbackSrsChanges()
Method to end the transaction without committing.. This is a SYNCHRONOUS method.
Since
2.8

RuleID()

TUint32 RuleID()

Method to return the rule ID

Since
2.0

SetRuleID(TUint32)

voidSetRuleID(TUint32aRuleID)

Method to set the rule ID

Since
2.0

Parameters

TUint32 aRuleIDRule ID

SetTagId(TInt)

voidSetTagId(TIntaTagId)
Method to set the Tag ID
Since
2.0

Parameters

TInt aTagIda Tag ID

SetTextL(const TDesC &)

voidSetTextL(const TDesC &aText)

Method to set the training text

Since
2.0

Parameters

const TDesC & aTextText which will be trained

SetTrained(TBool)

voidSetTrained(TBoolaTrained)

Method to set the Trained flag for True or False

Since
2.0

Parameters

TBool aTrainedTrained flag

SetTrainedType(TNssVasCoreConstant::TNssTrainedType)

voidSetTrainedType(TNssVasCoreConstant::TNssTrainedTypeaTrainType)

Method to set the Training Type

Since
2.0

Parameters

TNssVasCoreConstant::TNssTrainedType aTrainTypeTraining Type

TagId()

TInt TagId()

Method to return the Tag ID

Since
2.0

Text()

TDesC &Text()

Method to return the Text

Since
2.0

TrainTextL(MNssTrainTextEventHandler *, CNssTrainingParameters *)

TNssSpeechItemResultTrainTextL(MNssTrainTextEventHandler *aEventHandler,
CNssTrainingParameters *aTrainingParams
)

Method to train a speech model from text.

Since
2.8

Parameters

MNssTrainTextEventHandler * aEventHandlerEvent handler
CNssTrainingParameters * aTrainingParamsTraining options, NULL uses default ones.

TrainVoiceL(MNssTrainVoiceEventHandler *)

TNssSpeechItemResultTrainVoiceL(MNssTrainVoiceEventHandler *aTrainVoiceEventHandler)

Method called by the client to indicate to SRS that training is needed.

Since
2.0

Parameters

MNssTrainVoiceEventHandler * aTrainVoiceEventHandlera reference to TrainVoiceEventHandler

Trained()

TBool Trained()

Method to return the Trained flag

Since
2.0

TrainedType()

TNssVasCoreConstant::TNssTrainedType TrainedType()

Method to return the Training Type

Since
2.0

TrainingCapabilities()

CArrayFixFlat< TNssVasCoreConstant::TNssTrainingCapability > *TrainingCapabilities()

The TrainingCapabilities member fucntion is used by the client to get training capabilities to beused in Speaker Independent voice recognition.

Since
2.0

Member Data Documentation

CNssContext & iContext

CNssContext &iContext[private]

TNssSpeechItemConstant::TNssState iOldState

TNssSpeechItemConstant::TNssState iOldState[private]

TTimeIntervalMicroSeconds32 iPlayDuration

TTimeIntervalMicroSeconds32 iPlayDuration[private]

MNssPlayEventHandler * iPlayEventHandler

MNssPlayEventHandler *iPlayEventHandler[private]

CNssSpeechItemSrsPortal & iPortal

CNssSpeechItemSrsPortal &iPortal[private]

TBool iRecover

TBool iRecover[private]

TInt iRetry

TInt iRetry[private]

TUint32 iRuleID

TUint32 iRuleID[private]

TNssSpeechItemConstant::TNssState iState

TNssSpeechItemConstant::TNssState iState[private]

TInt iTagId

TInt iTagId[private]

HBufC * iText

HBufC *iText[private]

MNssTrainVoiceEventHandler * iTrainVoiceEventHandler

MNssTrainVoiceEventHandler *iTrainVoiceEventHandler[private]

TBool iTrained

TBool iTrained[private]

TNssVasCoreConstant::TNssTrainedType iTrainedType

TNssVasCoreConstant::TNssTrainedType iTrainedType[private]

CNssSpeechItemTrainer & iTrainer

CNssSpeechItemTrainer &iTrainer[private]

TUint32 iTransientRuleID

TUint32 iTransientRuleID[private]

HBufC * iTrimmedText

HBufC *iTrimmedText[private]

TTtsData * iTtsData

TTtsData *iTtsData[private]