sl@0: // Copyright (c) 2002-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 __SPEECHRECOGNITIONCUSTOMCOMMANDPARSER_H__ sl@0: #define __SPEECHRECOGNITIONCUSTOMCOMMANDPARSER_H__ sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: This is the main class of Speech Recognition Custom Commands Parser. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: class CSpeechRecognitionCustomCommandParser : public CMMFCustomCommandParserBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Factory function for creating this class. sl@0: sl@0: @param aImplementor sl@0: A reference to a custom commands implementor. sl@0: sl@0: @return A pointer to a CSpeechRecognitionCustomCommandParser object. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C static CSpeechRecognitionCustomCommandParser* NewL( sl@0: MSpeechRecognitionCustomCommandImplementor& sl@0: aImplementor); sl@0: sl@0: /** sl@0: Destructor. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C ~CSpeechRecognitionCustomCommandParser(); sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Handles the request from the client. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void HandleRequest(TMMFMessage& aMessage); sl@0: sl@0: private: sl@0: /** sl@0: C++ constructor for a CSpeechRecognitionCustomCommandParser class. sl@0: sl@0: @param aImplementor sl@0: A reference to a custom commands implementor. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: CSpeechRecognitionCustomCommandParser( sl@0: MSpeechRecognitionCustomCommandImplementor& aImplementor); sl@0: sl@0: /** sl@0: Private method to handle the request from the client. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoHandleRequestL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Adds a new pronunciation for the given model into the specified lexicon. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoAddPronunciationL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Adds a new rule for the given pronunciation into the specified grammar. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoAddRuleL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Cancels the current operation. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCancel(); sl@0: sl@0: /** sl@0: Commits uncommitted database operations to the database. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCommitChangesL(); sl@0: sl@0: /** sl@0: Creates a new grammar. sl@0: sl@0: @param aMessage sl@0: A message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCreateGrammarL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Creates a new lexicon. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCreateLexiconL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Creates a new model bank. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCreateModelBankL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Ends the current recognition session. Resources allocated for recognition are freed. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoEndRecSessionL(); sl@0: sl@0: /** sl@0: Returns all grammar IDs that belong to the current client, whose UID was set with sl@0: SetClientUid(). sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllClientGrammarIDsL(); sl@0: sl@0: /** sl@0: Returns all lexicon IDs that belong to the current client, whose UID was set with sl@0: SetClientUid(). sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllClientLexiconIDsL(); sl@0: sl@0: /** sl@0: Returns all model bank IDs that belong to the current client, whose UID was set with sl@0: SetClientUid(). sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllClientModelBankIDsL(); sl@0: sl@0: /** sl@0: Returns all grammar IDs that exist (for all clients). sl@0: sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllGrammarIDsL(); sl@0: sl@0: /** sl@0: Returns all lexicon IDs that exist (for all clients). sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllLexiconIDsL(); sl@0: sl@0: /** sl@0: Returns all model bank IDs that exist (for all clients). sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllModelBankIDsL(); sl@0: sl@0: /** sl@0: Returns all model IDs that exist in the specified model bank. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllModelIDsL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Returns all pronunciation IDs that exist in the specified lexicon. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllPronunciationIDsL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Returns all rule IDs that exist in the specified grammar. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAllRuleIDsL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Returns the number of models available for training system wide, based on available disk space. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetAvailableStorageL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Returns the engine properties. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetEnginePropertiesL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Returns the number of models in the specified model bank. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetModelCountL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Checks if the rule is valid or not. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetRuleValidityL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Returns the duration of the utterance for the specified model. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoGetUtteranceDurationL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Loads the specified grammar into the recognizer; done prior to recognition. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoLoadGrammarL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Loads the specified lexicon into the recognizer; done prior to recognition. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoLoadLexiconL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Loads the specified model bank into the recognizer; done prior to recognition. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoLoadModelsL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Plays the previously trained utterance. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoPlayUtteranceL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Initiates recognition; performed following loading of model bank, lexicon, and grammar. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRecognizeL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Records user utterance for training and recognition. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRecordL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Removes the specified grammar from the permanent storage. sl@0: sl@0: Removing a grammar will remove all rules within the grammar. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRemoveGrammarL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Removes the specified lexicon from the permanent storage. sl@0: sl@0: Removing a lexicon will remove all pronunciations within the lexicon. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRemoveLexiconL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Removes the specified model bank from the permanent storage. sl@0: sl@0: Removing a model bank will remove all models within the model bank. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRemoveModelBankL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Removes the specified model from the specified model bank permanently. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRemoveModelL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Removes the specified pronunciation from the specified lexicon permanently. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRemovePronunciationL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Removes the specified rule from the specified grammar permanently. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoRemoveRuleL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Sets the UID of the client. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoSetClientUidL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Starts a new recognition session. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoStartRecSessionL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Trains a new model into the specified model bank. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoTrainL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Unloads the specified rule from the specified grammar in temporary sl@0: memory, previously loaded with LoadGrammarL(). sl@0: sl@0: The rule in the permanent storage remains intact. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoUnloadRuleL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Loads the specified parameters into the engine. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoLoadEngineParametersL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Copies the pronunciation ID array stored by a previous GetAllPronunciationIDs call. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCopyPronunciationIDArrayL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Copy the model ID array stored by a previous GetAllModelIDs call. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCopyModelIDArrayL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Copies the rule ID array stored by a previous GetAllRuleIDs call. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCopyRuleIDArrayL(TMMFMessage& aMessage); sl@0: /** sl@0: Copies the grammar ID array stored by a previous GetAllGrammarIDs call. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCopyGrammarIDArrayL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Copies the lexicon ID array stored by a previous GetAllLexiconIDs call. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCopyLexiconIDArrayL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Copies the modelBank ID array stored by a previous GetAllModelBankIDs call. sl@0: sl@0: @param aMessage sl@0: The message containing the information of the request. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCopyModelBankIDArrayL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Externalises the result set into a descriptor, so that it can be copied into an array. sl@0: */ sl@0: void DoExternalizeResultSetL(); sl@0: sl@0: /** sl@0: Copies the previously externalised result set into a message. The message must be the same size as sl@0: the stored externalized result set. sl@0: */ sl@0: void DoCopyResultSetL(TMMFMessage& aMessage); sl@0: sl@0: sl@0: /** sl@0: Extracts an array from first parameter of TMMFMessage. sl@0: sl@0: @param aMessage sl@0: The message to copy the array from. sl@0: @param aArray sl@0: The array to copy into. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoExtractIntArrayFromData1L(TMMFMessage& aMessage, RArray& aArray); sl@0: sl@0: /** sl@0: Extracts an array from second parameter of TMMFMessage. sl@0: sl@0: @param aMessage sl@0: The message to copy array from. sl@0: @param aArray sl@0: The array to copy into. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoExtractIntArrayFromData2L(TMMFMessage& aMessage, RArray& aArray); sl@0: sl@0: /** sl@0: Extracts an integer array from the descriptor. sl@0: sl@0: @param aDescriptor sl@0: The descriptor containing an integer. sl@0: @param aArray sl@0: The array to copy into. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoExtractIntArrayL(TDes8& aDescriptor, RArray& aArray); sl@0: sl@0: sl@0: sl@0: /** sl@0: Copies the specified integer array given into a TMMFMessage. sl@0: sl@0: @param aMessage sl@0: The message to copy the array into. sl@0: @param aArray sl@0: The array to copy from. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void DoCopyIntArrayL(TMMFMessage& aMessage, const RArray& aArray); sl@0: sl@0: sl@0: private: sl@0: // reference to the Custom Command Implementor class sl@0: MSpeechRecognitionCustomCommandImplementor& iImplementor; sl@0: sl@0: RArray iPronunciationIDs; sl@0: RArray iModelIDs; sl@0: RArray iRuleIDs; sl@0: sl@0: RArray iGrammarIDs; sl@0: RArray iLexiconIDs; sl@0: RArray iModelBankIDs; sl@0: sl@0: sl@0: CSDClientResultSet* iResultSet; sl@0: CBufFlat* iResultCopyBuffer; sl@0: sl@0: // Remove? sl@0: // TAny* iReservedPtr_1; // reserved for future expansion sl@0: // TAny* iReservedPtr_2; // reserved for future expansion sl@0: }; sl@0: #endif // of __SPEECHRECOGNITIONCUSTOMCOMMANDPARSER_H__ sl@0: sl@0: // End of file