sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __TEST_MMF_CUSTOM_MMF_ASR_CONTROLLER_H__ sl@0: #define __TEST_MMF_CUSTOM_MMF_ASR_CONTROLLER_H__ sl@0: sl@0: //include all the header files for now sl@0: // sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: sl@0: #include "Database/sddatabase.h" sl@0: sl@0: sl@0: // custom asr controller plugin class sl@0: class CCustomMmfASRController: public CMMFController, sl@0: public MAsyncEventHandler, sl@0: public MSpeechRecognitionCustomCommandImplementor sl@0: sl@0: { sl@0: public: sl@0: static CMMFController* NewL() ; sl@0: ~CCustomMmfASRController(); sl@0: sl@0: //implement CMMFController ecom plugin interface sl@0: virtual void AddDataSourceL(MDataSource& aDataSource); sl@0: virtual void AddDataSinkL(MDataSink& aDataSink); sl@0: virtual void RemoveDataSourceL(MDataSource& aDataSource); sl@0: virtual void RemoveDataSinkL(MDataSink& aDataSink); sl@0: virtual void ResetL(); sl@0: virtual void PrimeL(); sl@0: virtual void PlayL(); sl@0: virtual void PauseL(); sl@0: virtual void StopL(); sl@0: virtual TTimeIntervalMicroSeconds PositionL() const; sl@0: virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition); sl@0: virtual TTimeIntervalMicroSeconds DurationL() const; sl@0: virtual void CustomCommand(TMMFMessage& aMessage); sl@0: virtual void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); sl@0: virtual void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries) ; sl@0: virtual CMMFMetaDataEntry* GetMetaDataEntryL(TInt aIndex) ; sl@0: sl@0: //from MAsyncEventHandler sl@0: virtual TInt SendEventToClient(const TMMFEvent& aEvent); sl@0: sl@0: // sl@0: virtual void MSrAddPronunciationL( TLexiconID aLexiconID, TModelBankID aModelBankID, sl@0: TModelID aModelID, TPronunciationID& aPronunciationID ) ; sl@0: virtual void MSrAddRuleL( TGrammarID aGrammarID, TLexiconID aLexiconID, sl@0: TPronunciationID aPronunciationID, TRuleID& aRuleID ); sl@0: virtual void MSrCancel() ; sl@0: virtual void MSrCommitChangesL() ; sl@0: virtual void MSrCreateGrammarL( TGrammarID& aGrammarID ) ; sl@0: virtual void MSrCreateLexiconL( TLexiconID& aLexiconID ) ; sl@0: virtual void MSrCreateModelBankL( TModelBankID& aModelBankID ) ; sl@0: virtual void MSrEndRecSessionL() ; sl@0: virtual void MSrGetAllModelIDsL( TModelBankID aModelBankID, RArray& aModelIDs ) ; sl@0: virtual void MSrGetAllPronunciationIDsL( TLexiconID aLexiconID, RArray& aPronunciationIDs ) ; sl@0: virtual void MSrGetAllRuleIDsL( TGrammarID aGrammarID, RArray& aRuleIDs ) ; sl@0: sl@0: virtual void MSrGetAllModelBankIDsL( RArray& aModelBankIDs ) ; sl@0: virtual void MSrGetAllLexiconIDsL( RArray& aLexiconIDs ) ; sl@0: virtual void MSrGetAllGrammarIDsL( RArray& aGrammarIDs ) ; sl@0: sl@0: virtual void MSrGetAllClientModelBankIDsL( RArray& aModelBankIDs ) ; sl@0: virtual void MSrGetAllClientLexiconIDsL( RArray& aLexiconIDs ) ; sl@0: virtual void MSrGetAllClientGrammarIDsL( RArray& aGrammarIDs ) ; sl@0: sl@0: virtual void MSrGetAvailableStorageL( TInt& aCount ) ; sl@0: virtual void MSrGetEnginePropertiesL( const RArray& aPropertyId, sl@0: RArray& aPropertyValue) ; sl@0: virtual void MSrLoadEngineParametersL( const RArray& aParameterId, sl@0: const RArray& aParameterValue ); sl@0: virtual void MSrGetModelCountL( TModelBankID aModelBankID, TInt& aCount ) ; sl@0: virtual void MSrGetRuleValidityL( TGrammarID aGrammarID, TRuleID aRuleID, TBool& aValid ) ; sl@0: virtual void MSrGetUtteranceDurationL( TModelBankID aModelBankID, TModelID aModelID, sl@0: TTimeIntervalMicroSeconds32& aDuration) ; sl@0: virtual void MSrLoadGrammarL( TGrammarID aGrammarID ) ; sl@0: virtual void MSrLoadLexiconL( TLexiconID aLexiconID ) ; sl@0: virtual void MSrLoadModelsL( TModelBankID aModelBankID ) ; sl@0: virtual void MSrPlayUtteranceL( TModelBankID aModelBankID, TModelID aModelID) ; sl@0: virtual void MSrRecognizeL( CSDClientResultSet& aResultSet ) ; sl@0: virtual void MSrRecordL( TTimeIntervalMicroSeconds32 aRecordTime ) ; sl@0: virtual void MSrRemoveGrammarL( TGrammarID aGrammarID ) ; sl@0: virtual void MSrRemoveLexiconL( TLexiconID aLexiconID ) ; sl@0: virtual void MSrRemoveModelBankL( TModelBankID aModelBankID ); sl@0: virtual void MSrRemoveModelL( TModelBankID aModelBankID, TModelID aModelID ); sl@0: virtual void MSrRemovePronunciationL( TLexiconID aLexiconID, TPronunciationID aPronunciationID ); sl@0: virtual void MSrRemoveRuleL( TGrammarID aGrammarID, TRuleID aRuleID ); sl@0: virtual void MSrStartRecSessionL( TRecognitionMode aMode ); sl@0: virtual void MSrTrainL( TModelBankID aModelBankID, TModelID& aModelID ); sl@0: virtual void MSrUnloadRuleL( TGrammarID aGrammarID, TRuleID aRuleID ); sl@0: virtual void MSrSetClientUid(TUid aClientUid); sl@0: sl@0: public: sl@0: sl@0: enum TControllerState sl@0: { sl@0: ESTraining, sl@0: ESRecognition sl@0: }; sl@0: sl@0: private: sl@0: TBool IsMemoryAllocCmd(TMMFMessage& aMessage ); sl@0: TInt AllocMemoryTestL(); sl@0: sl@0: //[ state access functions ] sl@0: TControllerState State() const; sl@0: void SetState( TControllerState aState ); sl@0: sl@0: //[ Invariant function ] sl@0: TBool InVariant() const; sl@0: protected: sl@0: CCustomMmfASRController(); sl@0: void ConstructL(); sl@0: sl@0: private: sl@0: TControllerState iState; // main state of the controller sl@0: TRecognitionMode iRecognitionMode; // recognition mode the controller is in sl@0: TTimeIntervalMicroSeconds32 iRecordTime; // the duration of the recording for both recognition and trainning sl@0: sl@0: TGrammarID iLoadedGrammarID; sl@0: TLexiconID iLoadedLexiconID; sl@0: TModelBankID iLoadedModelBankID; sl@0: sl@0: CSDClientResultSet* iResultSet; // data structure containing the result set sl@0: TInt iMaxResults; // maximum number of results sl@0: sl@0: TBool iRecognizeComplete; //a flag to rememeber that we are in recognize mode sl@0: CSDDatabase* iDatabase; sl@0: }; sl@0: sl@0: #endif