CNssRecognitionHandler Class Reference

class CNssRecognitionHandler : public CBase

The CNssRecognitionHandler class performs the recognition function.

NssVASApi.lib
Since
2.8

Inherits from

Nested Classes and Structures

Public Member Functions
~CNssRecognitionHandler ()
void AdaptL ( MNssAdaptationEventHandler *, CSIClientResultSet *, TInt )
TNssRecognitionResult Cancel ()
MNssAdaptationItem * GetAdaptationItemL ()
void MsruoEvent ( TUid , TInt )
CNssRecognitionHandler * NewL ()
CNssRecognitionHandler * NewLC ()
TNssRecognitionResult PreStartSampling ( MNssRecognizeInitCompleteHandler *)
TNssRecognitionResult Recognize ( MNssRecognizeEventHandler *)
TNssRecognitionResult RecognizeInitL ( MNssRecognizeInitCompleteHandler *, const CArrayPtrFlat < MNssContext > &, TInt )
TNssRecognitionResult RecognizeInitL ( MNssRecognizeInitCompleteHandler *, TInt )
TNssRecognitionResult RejectTagL ( MNssRejectTagCompleteHandler *, CArrayPtrFlat < MNssTag > *)
void RemoveAdaptationItem ( CNssAdaptationItem *)
TNssRecognitionResult SelectTagL ( MNssTag *)
TNssRecognitionResult SelectTagL ( MNssTag *, TBool )
Private Member Functions
CNssRecognitionHandler ()
void Cleanup ()
void CleanupRecognizeFailed ()
void CleanupRecognizeInitFailed ()
void CleanupRejectTagFailed ()
void ClearContextList ()
void ClearContextStatus ()
void ClearRuleList ()
void ClearTagList ()
MNssRecognitionHandler::TNssRecognitionResult CommonRecognizeInitL ( MNssRecognizeInitCompleteHandler *, TInt )
void ConstructL ()
void CreateSrfL ()
void DeleteSrf ()
void DoEouDetected ()
void DoLoadGrammarComplete ()
void DoLoadGrammarFailed ()
void DoLoadLexiconComplete ()
void DoLoadLexiconFailed ()
void DoLoadModelsComplete ()
void DoLoadModelsFailed ()
void DoPreStartSamplingComplete ( TInt )
void DoRecognitionComplete ()
void DoRecognitionFailed ()
void DoRecognitionFailedNoMatch ()
void DoRecognitionFailedNoSpeech ( TInt )
void DoRecognitionReady ()
void DoRecordFailed ( TInt )
void DoRecordStarted ()
void DoUnloadRuleComplete ()
void DoUnloadRuleFailed ()
void HandleTagCheckL ()
void UnexpectedEvent ()
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()
Public Member Enumerations
enum TNssRState {
EVasIdle , EVasWaitingForLoadModelsComplete , EVasWaitingForLoadLexiconComplete , EVasWaitingForLoadGrammarComplete , EVasWaitingForRecognitionReadyRecognitionInit , EVasWaitingForRecognize , EVasWaitingForRecordStarted , EVasWaitingForEouDetected , EVasWaitingForRecognitionComplete , EVasWaitingForSelectTag , EVasWaitingForUnloadRuleComplete , EVasWaitingForRecognitionReadyRejectTag , EVasDirectAdaptation , EVasIdleAdaptation , EVasCorrectingPluginDatabase
}
Private Attributes
RPointerArray < CNssAdaptationItem > iAdaptItemArray
MNssAdaptationEventHandler * iAdaptationHandler
TInt iContextCount
TInt iContextCurrentLoopCount
TMNssContextList * iContextList
CNssContextMgr * iContextMgr
CArrayFixFlat < TBool > * iContextStatus
MNssRecognizeEventHandler * iEventHandler
MNssRecognizeInitCompleteHandler * iInitCompleteHandler
TInt iMaxResults
TNssRState iRState
MNssRejectTagCompleteHandler * iRejectTagCompleteHandler
TInt iRejectTagCount
TInt iRejectTagCurrentLoopCount
CArrayFixFlat < TRuleEntry > * iRuleList
CSIClientResultSet * iSIClientResultSet
CNssSiUtilityWrapper * iSrsApi
TInt iTagCount
TInt iTagCurrentLoopCount
CArrayPtrFlat < CNssTag > * iTagList
CNssTagMgr * iTagMgr
CNssVASDBBuilder * iVasDBBuilder
CActiveSchedulerWait iWait

Constructor & Destructor Documentation

CNssRecognitionHandler()

CNssRecognitionHandler ( ) [private]

Constructor.

~CNssRecognitionHandler()

~CNssRecognitionHandler ( ) [virtual]

Destructor.

Member Functions Documentation

AdaptL(MNssAdaptationEventHandler *, CSIClientResultSet *, TInt)

void AdaptL ( MNssAdaptationEventHandler * aCallback,
CSIClientResultSet * aResultSet,
TInt aCorrect
)
AdaptL - called by adaptation item. Adapts the acoustic models.
Since
2.0

Parameters

MNssAdaptationEventHandler * aCallback
CSIClientResultSet * aResultSet
TInt aCorrect

Cancel()

TNssRecognitionResult Cancel ( )
From MNssRecognitionHandler Interface Cancel the last recognition function.
Since
2.0

Cleanup()

void Cleanup ( ) [private]

Perform required cleanup to get back to the EIdle state

CleanupRecognizeFailed()

void CleanupRecognizeFailed ( ) [private]

Perform required cleanup to get back to the EIdle state and issue the HandleRecognizeError event with RecognizeFailed error code

CleanupRecognizeInitFailed()

void CleanupRecognizeInitFailed ( ) [private]

Perform required cleanup to get back to the EIdle state and issue the HandleRecognizeInitError event with RecognizeInitFailed error code

CleanupRejectTagFailed()

void CleanupRejectTagFailed ( ) [private]

Perform required cleanup to get back to the EIdle state and issue the HandleRejectTagError event with RejectTagFailed error code

ClearContextList()

void ClearContextList ( ) [private]

Delete context objects from iContextList

ClearContextStatus()

void ClearContextStatus ( ) [private]

Delete entries from iContextStatus

ClearRuleList()

void ClearRuleList ( ) [private]

Delete the TRuleEntry objects from iRuleList

ClearTagList()

void ClearTagList ( ) [private]

Delete the tag objects from iTagList

CommonRecognizeInitL(MNssRecognizeInitCompleteHandler *, TInt)

MNssRecognitionHandler::TNssRecognitionResult CommonRecognizeInitL ( MNssRecognizeInitCompleteHandler * aInitCompleteHandler,
TInt aMaxResults
) [private]

Perform those RecognizeInitL tasks, which do not depend on vocabulary.

Parameters

MNssRecognizeInitCompleteHandler * aInitCompleteHandler
TInt aMaxResults

ConstructL()

void ConstructL ( ) [private]

By default Symbian 2nd phase constructor is private.

CreateSrfL()

void CreateSrfL ( ) [private]

Create the SRF object, iSrsApi.

DeleteSrf()

void DeleteSrf ( ) [private]

Gracefully terminate and delete the SRF object, iSrsApi.

DoEouDetected()

void DoEouDetected ( ) [private]

Handle EouDetected SRF event

DoLoadGrammarComplete()

void DoLoadGrammarComplete ( ) [private]

Handle LoadGrammarComplete SRF event

DoLoadGrammarFailed()

void DoLoadGrammarFailed ( ) [private]

Handle LoadGrammarFailed SRF event

DoLoadLexiconComplete()

void DoLoadLexiconComplete ( ) [private]

Handle LoadLexiconComplete SRF event

DoLoadLexiconFailed()

void DoLoadLexiconFailed ( ) [private]

Handle LoadLexiconFailed SRF event

DoLoadModelsComplete()

void DoLoadModelsComplete ( ) [private]

Handle LoadModelsComplete SRF event

DoLoadModelsFailed()

void DoLoadModelsFailed ( ) [private]

Handle LoadModelsFailed SRF event

DoPreStartSamplingComplete(TInt)

void DoPreStartSamplingComplete ( TInt aError ) [private]

Handle PreStartSampling SRSF event

Parameters

TInt aError

DoRecognitionComplete()

void DoRecognitionComplete ( ) [private]

Handle RecognitionComplete SRF event

DoRecognitionFailed()

void DoRecognitionFailed ( ) [private]

Handle RecognitionFailed SRF event

DoRecognitionFailedNoMatch()

void DoRecognitionFailedNoMatch ( ) [private]

Handle RecognitionFailedNoMatch SRF event

DoRecognitionFailedNoSpeech(TInt)

void DoRecognitionFailedNoSpeech ( TInt aResult ) [private]

Handle RecognitionFailedNoSpeech, RecognitionFailedTooEarly, RecognitionFailedTooLong, and RecognitionFailedTooShort SRF events

Parameters

TInt aResult The Msruo event Result code.

DoRecognitionReady()

void DoRecognitionReady ( ) [private]

Handle RecognitionReady SRF event

DoRecordFailed(TInt)

void DoRecordFailed ( TInt aResult ) [private]

Handle RecordFailed SRF event

Parameters

TInt aResult The Msruo event Result code.

DoRecordStarted()

void DoRecordStarted ( ) [private]

Handle RecordStarted SRF event

DoUnloadRuleComplete()

void DoUnloadRuleComplete ( ) [private]

Handle UnloadRuleComplete SRF event

DoUnloadRuleFailed()

void DoUnloadRuleFailed ( ) [private]

Handle UnloadRuleFailed SRF event

GetAdaptationItemL()

MNssAdaptationItem * GetAdaptationItemL ( )
From MNssRecognitionHandler Interface Get the adaptation item to adapt, when you know whether the result was correct or not.
Since
2.0

HandleTagCheckL()

void HandleTagCheckL ( ) [private]

Handle Tag Check for contexts

MsruoEvent(TUid, TInt)

void MsruoEvent ( TUid aEvent,
TInt aResult
)
From MSpeechRecognitionEvent Interface Handle Speech Recognition Utility event
Since
2.0

Parameters

TUid aEvent The event callback to receive Speech Recognition Utility events.
TInt aResult The result value associated with aEvent.

NewL()

CNssRecognitionHandler * NewL ( ) [static]

Two-phased constructor.

NewLC()

CNssRecognitionHandler * NewLC ( ) [static]

Two-phased constructor.

PreStartSampling(MNssRecognizeInitCompleteHandler *)

TNssRecognitionResult PreStartSampling ( MNssRecognizeInitCompleteHandler * aInitCompleteHandler )

From MNssRecognitionHandler Starts sampling already before RecognizeInitL and Recognize calls. This is used to ensure that there is no delay between user notification and sampling start.

Since
3.2

Parameters

MNssRecognizeInitCompleteHandler * aInitCompleteHandler Callback handler

Recognize(MNssRecognizeEventHandler *)

TNssRecognitionResult Recognize ( MNssRecognizeEventHandler * aEventHandler )
From MNssRecognitionHandler Interface Perform the recognize function.
Since
2.0

Parameters

MNssRecognizeEventHandler * aEventHandler The event call back to receive recognize events.

RecognizeInitL(MNssRecognizeInitCompleteHandler *, const CArrayPtrFlat< MNssContext > &, TInt)

TNssRecognitionResult RecognizeInitL ( MNssRecognizeInitCompleteHandler * aInitCompleteHandler,
const CArrayPtrFlat < MNssContext > & aRecognitionVocabulary,
TInt aMaxResults
)
Perform initialization for the recognize funtion.
Since
2.0

Parameters

MNssRecognizeInitCompleteHandler * aInitCompleteHandler The event call back to receive recognize init events.
const CArrayPtrFlat < MNssContext > & aRecognitionVocabulary List of context, which are active in recognition.
TInt aMaxResults The maximum number of voice tags to be recognized.

RecognizeInitL(MNssRecognizeInitCompleteHandler *, TInt)

TNssRecognitionResult RecognizeInitL ( MNssRecognizeInitCompleteHandler * aInitCompleteHandler,
TInt aMaxResults
)
Perform initialization for the recognize funtion. Automatically loads the commands and the names as recognition vocabulary.
Since
2.0

Parameters

MNssRecognizeInitCompleteHandler * aInitCompleteHandler The event call back to receive recognize init events.
TInt aMaxResults The maximum number of voice tags to be recognized.

RejectTagL(MNssRejectTagCompleteHandler *, CArrayPtrFlat< MNssTag > *)

TNssRecognitionResult RejectTagL ( MNssRejectTagCompleteHandler * aRejectTagCompleteHandler,
CArrayPtrFlat < MNssTag > * aClientTagList
)
Request Reject Tag, i.e. blacklisting.
Since
2.0

Parameters

MNssRejectTagCompleteHandler * aRejectTagCompleteHandler
CArrayPtrFlat < MNssTag > * aClientTagList The list of voice tags which is to be rejected, i.e. blacklisted. The tag list is owned by the client.

RemoveAdaptationItem(CNssAdaptationItem *)

void RemoveAdaptationItem ( CNssAdaptationItem * anItem )

RemoveAdaptationItem - When an adaptation item is destroyed, it signals to its "host" recognition handler. This way, the host knows to remove it from the list of active adaptation items.

Parameters

CNssAdaptationItem * anItem

SelectTagL(MNssTag *)

TNssRecognitionResult SelectTagL ( MNssTag * aClientTag )
From MNssRecognitionHandler Interface Initiate the Select Tag event.
Since
2.0

Parameters

MNssTag * aClientTag The voice tag which was selected. The tag is owned by the client.

SelectTagL(MNssTag *, TBool)

TNssRecognitionResult SelectTagL ( MNssTag * aClientTag,
TBool aNotifyHandlers
)
From MNssRecognitionHandler Interface Initiate the Select Tag event.
Since
2.0

Parameters

MNssTag * aClientTag The voice tag which was selected. The tag is owned by the client.
TBool aNotifyHandlers If false, the global context handlers won't be notified.

UnexpectedEvent()

void UnexpectedEvent ( ) [private]

Cleanup and determine the correct event handler

Member Enumerations Documentation

Enum TNssRState

Enumerators

EVasIdle
EVasWaitingForLoadModelsComplete
EVasWaitingForLoadLexiconComplete
EVasWaitingForLoadGrammarComplete
EVasWaitingForRecognitionReadyRecognitionInit
EVasWaitingForRecognize
EVasWaitingForRecordStarted
EVasWaitingForEouDetected
EVasWaitingForRecognitionComplete
EVasWaitingForSelectTag
EVasWaitingForUnloadRuleComplete
EVasWaitingForRecognitionReadyRejectTag
EVasDirectAdaptation
EVasIdleAdaptation
EVasCorrectingPluginDatabase

Member Data Documentation

RPointerArray< CNssAdaptationItem > iAdaptItemArray

RPointerArray < CNssAdaptationItem > iAdaptItemArray [private]

MNssAdaptationEventHandler * iAdaptationHandler

MNssAdaptationEventHandler * iAdaptationHandler [private]

TInt iContextCount

TInt iContextCount [private]

TInt iContextCurrentLoopCount

TInt iContextCurrentLoopCount [private]

TMNssContextList * iContextList

TMNssContextList * iContextList [private]

CNssContextMgr * iContextMgr

CNssContextMgr * iContextMgr [private]

CArrayFixFlat< TBool > * iContextStatus

CArrayFixFlat < TBool > * iContextStatus [private]

MNssRecognizeEventHandler * iEventHandler

MNssRecognizeEventHandler * iEventHandler [private]

MNssRecognizeInitCompleteHandler * iInitCompleteHandler

MNssRecognizeInitCompleteHandler * iInitCompleteHandler [private]

TInt iMaxResults

TInt iMaxResults [private]

TNssRState iRState

TNssRState iRState [private]

MNssRejectTagCompleteHandler * iRejectTagCompleteHandler

MNssRejectTagCompleteHandler * iRejectTagCompleteHandler [private]

TInt iRejectTagCount

TInt iRejectTagCount [private]

TInt iRejectTagCurrentLoopCount

TInt iRejectTagCurrentLoopCount [private]

CArrayFixFlat< TRuleEntry > * iRuleList

CArrayFixFlat < TRuleEntry > * iRuleList [private]

CSIClientResultSet * iSIClientResultSet

CSIClientResultSet * iSIClientResultSet [private]

CNssSiUtilityWrapper * iSrsApi

CNssSiUtilityWrapper * iSrsApi [private]

TInt iTagCount

TInt iTagCount [private]

TInt iTagCurrentLoopCount

TInt iTagCurrentLoopCount [private]

CArrayPtrFlat< CNssTag > * iTagList

CArrayPtrFlat < CNssTag > * iTagList [private]

CNssTagMgr * iTagMgr

CNssTagMgr * iTagMgr [private]

CNssVASDBBuilder * iVasDBBuilder

CNssVASDBBuilder * iVasDBBuilder [private]

CActiveSchedulerWait iWait

CActiveSchedulerWait iWait [private]