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 ()
TNssSpeechItemResult CancelL ()
MNssCoreSrsDBEventHandler::TNssSrsDBResult CommitSrsChanges ()
CNssSpeechItem * CopyL ( CNssContext *)
void DelayedTrainingComplete ( TUint32 )
TUint32 GrammarId ()
TBool IsPlayingSupported ()
void MapcCustomCommandEvent ( TInt , TInt )
void MapcInitComplete ( TInt , const TTimeIntervalMicroSeconds &)
void MapcPlayComplete ( TInt )
void MsruoEvent ( 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 &)
TNssSpeechItemResult PlayL ( MNssPlayEventHandler *)
TNssSpeechItemResult PlayL ( MNssPlayEventHandler *, TLanguage )
TDesC & RawText ()
TNssSpeechItemResult RecordL ( MNssTrainVoiceEventHandler *)
MNssCoreSrsDBEventHandler::TNssSrsDBResult RollbackSrsChanges ()
TUint32 RuleID ()
void SetRuleID ( TUint32 )
void SetTagId ( TInt )
void SetTextL (const TDesC &)
void SetTrained ( TBool )
void SetTrainedType ( TNssVasCoreConstant::TNssTrainedType )
TInt TagId ()
TDesC & Text ()
TNssSpeechItemResult TrainTextL ( MNssTrainTextEventHandler *, CNssTrainingParameters *)
TNssSpeechItemResult TrainVoiceL ( MNssTrainVoiceEventHandler *)
TBool Trained ()
TNssVasCoreConstant::TNssTrainedType TrainedType ()
CArrayFixFlat < TNssVasCoreConstant::TNssTrainingCapability > * TrainingCapabilities ()
Private Member Functions
CNssSpeechItem ( CNssContext &, CNssSpeechItemSrsPortal &, CNssSpeechItemTrainer &)
void CleanPlayback ()
void CleanUp ()
void ConstructL ( TUint32 , const TDesC &)
void CopyUtteranceData ()
void DoAddPronounciationFailEvent ( TInt )
void DoAddPronunciationCompleteEvent ()
void DoGetAvailableStorageCompleteEvent ()
void DoGetUtteranceDurationCompleteEvent ()
void DoPlayCompleteEvent ()
void DoPlayFailEvent ( TInt )
void DoPlayL ()
MNssPlayEventHandler::TNssPlayResult DoPlayResult ( TInt )
void DoRemoveModelCompleteEvent ()
void DoRemoveModelFailEvent ( TInt )
TBool DoRetry ()
MNssCoreSrsDBEventHandler::TNssSrsDBResult DoSrsDBResult ( TInt )
void DoTrainCompleteEvent ()
void DoTrainFailEvent ( TInt )
MNssTrainVoiceEventHandler::TNssTrainResult DoTrainResult ( TInt )
void MakePlayCallback ( TInt )
void NotifyHandlerForUnexpectedEvent ()
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 & aContext reference to Context object
CNssSpeechItemSrsPortal & aPortal reference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainer reference to speech item trainer

~CNssSpeechItem()

~CNssSpeechItem ( )

Destructor.

Member Functions Documentation

CancelL()

TNssSpeechItemResult CancelL ( )

Method called by the client to cancel the previous operation.

Since
2.0

CleanPlayback()

void CleanPlayback ( ) [private]

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

CleanUp()

void CleanUp ( ) [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 &)

void ConstructL ( TUint32 aRuleID,
const TDesC & aText
) [private]

Symbian 2nd phase constructor

Parameters

TUint32 aRuleID Rule ID value
const TDesC & aText Reference 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 * aContext a pointer to a Context

CopyUtteranceData()

void CopyUtteranceData ( ) [private]

Method to copy utterance data from current to transient values

DelayedTrainingComplete(TUint32)

void DelayedTrainingComplete ( TUint32 aRuleID )

Updates the speech item after training.

Since
2.8

Parameters

TUint32 aRuleID Rule ID.

DoAddPronounciationFailEvent(TInt)

void DoAddPronounciationFailEvent ( TInt aResult ) [private]

Method to handle the "AddPronunciation" fail from SRS

Parameters

TInt aResult a Result value from the event

DoAddPronunciationCompleteEvent()

void DoAddPronunciationCompleteEvent ( ) [private]

Method to handle the "AddPronunciation" complete from SRS

DoGetAvailableStorageCompleteEvent()

void DoGetAvailableStorageCompleteEvent ( ) [private]

Method to handle the "GetAvailableStorageEvent" complete from SRS

DoGetUtteranceDurationCompleteEvent()

void DoGetUtteranceDurationCompleteEvent ( ) [private]

Method to handle the "GetUtteranceDurationEvent" complete from SRS

DoPlayCompleteEvent()

void DoPlayCompleteEvent ( ) [private]

Method to handle the "PlayEvent" complete from SRS

DoPlayFailEvent(TInt)

void DoPlayFailEvent ( TInt aResult ) [private]

Method to handle the "PlayEvent" fail from SRS

Parameters

TInt aResult - a Result value from the Play operation

DoPlayL()

void DoPlayL ( ) [private]

This method starts playback with CTtsUtility.

DoPlayResult(TInt)

MNssPlayEventHandler::TNssPlayResult DoPlayResult ( TInt aResult ) [private]

Method to process the SRS play error

Parameters

TInt aResult the result value from SRS which indicates an error

DoRemoveModelCompleteEvent()

void DoRemoveModelCompleteEvent ( ) [private]

Method to handle the "RemoveModel" complete from SRS

DoRemoveModelFailEvent(TInt)

void DoRemoveModelFailEvent ( TInt aResult ) [private]

Method to handle the "RemoveModel" fail from SRS

Parameters

TInt aResult a Result value from the event

DoRetry()

TBool DoRetry ( ) [private]

Method to verify whether it is ok to retry

DoSrsDBResult(TInt)

MNssCoreSrsDBEventHandler::TNssSrsDBResult DoSrsDBResult ( TInt aResult ) [private]

Method to process the SRS DB error

Parameters

TInt aResult the result value from SRS to indicate an error

DoTrainCompleteEvent()

void DoTrainCompleteEvent ( ) [private]

Method to handle the "TrainEvent" complete from SRS

DoTrainFailEvent(TInt)

void DoTrainFailEvent ( TInt aResult ) [private]

Method to process the various train failed events from SRS'

Parameters

TInt aResult the result value to indicate an error

DoTrainResult(TInt)

MNssTrainVoiceEventHandler::TNssTrainResult DoTrainResult ( TInt aResult ) [private]

Method to process the SRS train error

Parameters

TInt aResult the 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)

void MakePlayCallback ( TInt aResult ) [private]

Makes the callback after playing has completed or failed.

Parameters

TInt aResult

MapcCustomCommandEvent(TInt, TInt)

void MapcCustomCommandEvent ( TInt aEvent,
TInt aError
)

Unused method for future extensions of MTtsClientUtilityObserver .

Parameters

TInt aEvent event ID
TInt aError result

MapcInitComplete(TInt, const TTimeIntervalMicroSeconds &)

void MapcInitComplete ( TInt aError,
const TTimeIntervalMicroSeconds & aDuration
)

Method to signal that playing has been initialized.

Parameters

TInt aError Successful or not
const TTimeIntervalMicroSeconds & aDuration Length of the TTS waveform

MapcPlayComplete(TInt)

void MapcPlayComplete ( TInt aError )

Method to signal that playing has been completed.

Parameters

TInt aError Successful or not

MsruoEvent(TUid, TInt)

void MsruoEvent ( TUid aEvent,
TInt aResult
)

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

Since
2.0

Parameters

TUid aEvent an event from the SRS utility object
TInt aResult the 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 * aDeleteTagClient Callback after we made it or died trying
CNssTag * aTag Tag 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 * aSaveTagClient Callback after we made it or died trying
CNssTag * aTag Tag 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 & aContext A reference to Context object
CNssSpeechItemSrsPortal & aPortal A reference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainer

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

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

Two-phased CNssSpeechItem constructor

Since
2.0

Parameters

CNssContext & aContext A reference to Context object
CNssSpeechItemSrsPortal & aPortal A reference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainer
TUint32 aRuleID A rule ID value
const TDesC & aText A reference to the TDesc text

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

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

Two-phased CNssSpeechItem constructor

Since
2.0

Parameters

CNssContext & aContext A reference to Context object
CNssSpeechItemSrsPortal & aPortal A reference to SpeechItem Portal object
CNssSpeechItemTrainer & aTrainer
TUint32 aRuleID A rule ID value
const TDesC & aText A reference to the TDesc text

NotifyHandlerForUnexpectedEvent()

void NotifyHandlerForUnexpectedEvent ( ) [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 & aIdentifier ID of the text part to return Text or KNullDesC if identifier is not found

PlayL(MNssPlayEventHandler *)

TNssSpeechItemResult PlayL ( MNssPlayEventHandler * aPlayEventHandler )

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

Since
2.0

Parameters

MNssPlayEventHandler * aPlayEventHandler a reference to PlayEventHandler

PlayL(MNssPlayEventHandler *, TLanguage)

TNssSpeechItemResult PlayL ( MNssPlayEventHandler * aPlayEventHandler,
TLanguage aLanguage
)

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

Since
2.8

Parameters

MNssPlayEventHandler * aPlayEventHandler a call back object to handle the play events
TLanguage aLanguage language 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 *)

TNssSpeechItemResult RecordL ( 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 * aTrainVoiceEventHandler a 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)

void SetRuleID ( TUint32 aRuleID )

Method to set the rule ID

Since
2.0

Parameters

TUint32 aRuleID Rule ID

SetTagId(TInt)

void SetTagId ( TInt aTagId )
Method to set the Tag ID
Since
2.0

Parameters

TInt aTagId a Tag ID

SetTextL(const TDesC &)

void SetTextL ( const TDesC & aText )

Method to set the training text

Since
2.0

Parameters

const TDesC & aText Text which will be trained

SetTrained(TBool)

void SetTrained ( TBool aTrained )

Method to set the Trained flag for True or False

Since
2.0

Parameters

TBool aTrained Trained flag

SetTrainedType(TNssVasCoreConstant::TNssTrainedType)

void SetTrainedType ( TNssVasCoreConstant::TNssTrainedType aTrainType )

Method to set the Training Type

Since
2.0

Parameters

TNssVasCoreConstant::TNssTrainedType aTrainType Training 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 *)

TNssSpeechItemResult TrainTextL ( MNssTrainTextEventHandler * aEventHandler,
CNssTrainingParameters * aTrainingParams
)

Method to train a speech model from text.

Since
2.8

Parameters

MNssTrainTextEventHandler * aEventHandler Event handler
CNssTrainingParameters * aTrainingParams Training options, NULL uses default ones.

TrainVoiceL(MNssTrainVoiceEventHandler *)

TNssSpeechItemResult TrainVoiceL ( MNssTrainVoiceEventHandler * aTrainVoiceEventHandler )

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

Since
2.0

Parameters

MNssTrainVoiceEventHandler * aTrainVoiceEventHandler a 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]