os/mm/mmdevicefw/speechrecogsupport/ASR/inc/mmf/common/SpeechRecognitionCustomCommandParser.h
Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __SPEECHRECOGNITIONCUSTOMCOMMANDPARSER_H__
17 #define __SPEECHRECOGNITIONCUSTOMCOMMANDPARSER_H__
20 #include <mmf/common/mmfcontroller.h>
21 #include <mmf/common/speechrecognitioncustomcommandimplementor.h>
22 #include <mmf/common/speechrecognitiondataclient.h>
30 This is the main class of Speech Recognition Custom Commands Parser.
34 class CSpeechRecognitionCustomCommandParser : public CMMFCustomCommandParserBase
39 Factory function for creating this class.
42 A reference to a custom commands implementor.
44 @return A pointer to a CSpeechRecognitionCustomCommandParser object.
48 IMPORT_C static CSpeechRecognitionCustomCommandParser* NewL(
49 MSpeechRecognitionCustomCommandImplementor&
57 IMPORT_C ~CSpeechRecognitionCustomCommandParser();
62 Handles the request from the client.
65 The message containing the information of the request.
69 void HandleRequest(TMMFMessage& aMessage);
73 C++ constructor for a CSpeechRecognitionCustomCommandParser class.
76 A reference to a custom commands implementor.
80 CSpeechRecognitionCustomCommandParser(
81 MSpeechRecognitionCustomCommandImplementor& aImplementor);
84 Private method to handle the request from the client.
87 The message containing the information of the request.
91 void DoHandleRequestL(TMMFMessage& aMessage);
94 Adds a new pronunciation for the given model into the specified lexicon.
97 The message containing the information of the request.
101 void DoAddPronunciationL(TMMFMessage& aMessage);
104 Adds a new rule for the given pronunciation into the specified grammar.
107 The message containing the information of the request.
111 void DoAddRuleL(TMMFMessage& aMessage);
114 Cancels the current operation.
121 Commits uncommitted database operations to the database.
125 void DoCommitChangesL();
128 Creates a new grammar.
131 A message containing the information of the request.
135 void DoCreateGrammarL(TMMFMessage& aMessage);
138 Creates a new lexicon.
141 The message containing the information of the request.
145 void DoCreateLexiconL(TMMFMessage& aMessage);
148 Creates a new model bank.
151 The message containing the information of the request.
155 void DoCreateModelBankL(TMMFMessage& aMessage);
158 Ends the current recognition session. Resources allocated for recognition are freed.
162 void DoEndRecSessionL();
165 Returns all grammar IDs that belong to the current client, whose UID was set with
170 void DoGetAllClientGrammarIDsL();
173 Returns all lexicon IDs that belong to the current client, whose UID was set with
178 void DoGetAllClientLexiconIDsL();
181 Returns all model bank IDs that belong to the current client, whose UID was set with
186 void DoGetAllClientModelBankIDsL();
189 Returns all grammar IDs that exist (for all clients).
191 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
192 another of the system-wide error codes.
196 void DoGetAllGrammarIDsL();
199 Returns all lexicon IDs that exist (for all clients).
203 void DoGetAllLexiconIDsL();
206 Returns all model bank IDs that exist (for all clients).
210 void DoGetAllModelBankIDsL();
213 Returns all model IDs that exist in the specified model bank.
216 The message containing the information of the request.
220 void DoGetAllModelIDsL(TMMFMessage& aMessage);
223 Returns all pronunciation IDs that exist in the specified lexicon.
226 The message containing the information of the request.
230 void DoGetAllPronunciationIDsL(TMMFMessage& aMessage);
233 Returns all rule IDs that exist in the specified grammar.
236 The message containing the information of the request.
240 void DoGetAllRuleIDsL(TMMFMessage& aMessage);
243 Returns the number of models available for training system wide, based on available disk space.
246 The message containing the information of the request.
250 void DoGetAvailableStorageL(TMMFMessage& aMessage);
253 Returns the engine properties.
256 The message containing the information of the request.
260 void DoGetEnginePropertiesL(TMMFMessage& aMessage);
263 Returns the number of models in the specified model bank.
266 The message containing the information of the request.
270 void DoGetModelCountL(TMMFMessage& aMessage);
273 Checks if the rule is valid or not.
276 The message containing the information of the request.
280 void DoGetRuleValidityL(TMMFMessage& aMessage);
283 Returns the duration of the utterance for the specified model.
286 The message containing the information of the request.
290 void DoGetUtteranceDurationL(TMMFMessage& aMessage);
293 Loads the specified grammar into the recognizer; done prior to recognition.
296 The message containing the information of the request.
300 void DoLoadGrammarL(TMMFMessage& aMessage);
303 Loads the specified lexicon into the recognizer; done prior to recognition.
306 The message containing the information of the request.
310 void DoLoadLexiconL(TMMFMessage& aMessage);
313 Loads the specified model bank into the recognizer; done prior to recognition.
316 The message containing the information of the request.
320 void DoLoadModelsL(TMMFMessage& aMessage);
323 Plays the previously trained utterance.
326 The message containing the information of the request.
330 void DoPlayUtteranceL(TMMFMessage& aMessage);
333 Initiates recognition; performed following loading of model bank, lexicon, and grammar.
336 The message containing the information of the request.
340 void DoRecognizeL(TMMFMessage& aMessage);
343 Records user utterance for training and recognition.
346 The message containing the information of the request.
350 void DoRecordL(TMMFMessage& aMessage);
353 Removes the specified grammar from the permanent storage.
355 Removing a grammar will remove all rules within the grammar.
358 The message containing the information of the request.
362 void DoRemoveGrammarL(TMMFMessage& aMessage);
365 Removes the specified lexicon from the permanent storage.
367 Removing a lexicon will remove all pronunciations within the lexicon.
370 The message containing the information of the request.
374 void DoRemoveLexiconL(TMMFMessage& aMessage);
377 Removes the specified model bank from the permanent storage.
379 Removing a model bank will remove all models within the model bank.
382 The message containing the information of the request.
386 void DoRemoveModelBankL(TMMFMessage& aMessage);
389 Removes the specified model from the specified model bank permanently.
392 The message containing the information of the request.
396 void DoRemoveModelL(TMMFMessage& aMessage);
399 Removes the specified pronunciation from the specified lexicon permanently.
402 The message containing the information of the request.
406 void DoRemovePronunciationL(TMMFMessage& aMessage);
409 Removes the specified rule from the specified grammar permanently.
412 The message containing the information of the request.
416 void DoRemoveRuleL(TMMFMessage& aMessage);
419 Sets the UID of the client.
422 The message containing the information of the request.
426 void DoSetClientUidL(TMMFMessage& aMessage);
429 Starts a new recognition session.
432 The message containing the information of the request.
436 void DoStartRecSessionL(TMMFMessage& aMessage);
439 Trains a new model into the specified model bank.
442 The message containing the information of the request.
446 void DoTrainL(TMMFMessage& aMessage);
449 Unloads the specified rule from the specified grammar in temporary
450 memory, previously loaded with LoadGrammarL().
452 The rule in the permanent storage remains intact.
455 The message containing the information of the request.
459 void DoUnloadRuleL(TMMFMessage& aMessage);
462 Loads the specified parameters into the engine.
465 The message containing the information of the request.
469 void DoLoadEngineParametersL(TMMFMessage& aMessage);
472 Copies the pronunciation ID array stored by a previous GetAllPronunciationIDs call.
475 The message containing the information of the request.
479 void DoCopyPronunciationIDArrayL(TMMFMessage& aMessage);
482 Copy the model ID array stored by a previous GetAllModelIDs call.
485 The message containing the information of the request.
489 void DoCopyModelIDArrayL(TMMFMessage& aMessage);
492 Copies the rule ID array stored by a previous GetAllRuleIDs call.
495 The message containing the information of the request.
499 void DoCopyRuleIDArrayL(TMMFMessage& aMessage);
501 Copies the grammar ID array stored by a previous GetAllGrammarIDs call.
504 The message containing the information of the request.
508 void DoCopyGrammarIDArrayL(TMMFMessage& aMessage);
511 Copies the lexicon ID array stored by a previous GetAllLexiconIDs call.
514 The message containing the information of the request.
518 void DoCopyLexiconIDArrayL(TMMFMessage& aMessage);
521 Copies the modelBank ID array stored by a previous GetAllModelBankIDs call.
524 The message containing the information of the request.
528 void DoCopyModelBankIDArrayL(TMMFMessage& aMessage);
531 Externalises the result set into a descriptor, so that it can be copied into an array.
533 void DoExternalizeResultSetL();
536 Copies the previously externalised result set into a message. The message must be the same size as
537 the stored externalized result set.
539 void DoCopyResultSetL(TMMFMessage& aMessage);
543 Extracts an array from first parameter of TMMFMessage.
546 The message to copy the array from.
548 The array to copy into.
552 void DoExtractIntArrayFromData1L(TMMFMessage& aMessage, RArray<TInt>& aArray);
555 Extracts an array from second parameter of TMMFMessage.
558 The message to copy array from.
560 The array to copy into.
564 void DoExtractIntArrayFromData2L(TMMFMessage& aMessage, RArray<TInt>& aArray);
567 Extracts an integer array from the descriptor.
570 The descriptor containing an integer.
572 The array to copy into.
576 void DoExtractIntArrayL(TDes8& aDescriptor, RArray<TInt>& aArray);
581 Copies the specified integer array given into a TMMFMessage.
584 The message to copy the array into.
586 The array to copy from.
590 void DoCopyIntArrayL(TMMFMessage& aMessage, const RArray<TInt>& aArray);
594 // reference to the Custom Command Implementor class
595 MSpeechRecognitionCustomCommandImplementor& iImplementor;
597 RArray<TPronunciationID> iPronunciationIDs;
598 RArray<TModelID> iModelIDs;
599 RArray<TRuleID> iRuleIDs;
601 RArray<TGrammarID> iGrammarIDs;
602 RArray<TLexiconID> iLexiconIDs;
603 RArray<TModelBankID> iModelBankIDs;
606 CSDClientResultSet* iResultSet;
607 CBufFlat* iResultCopyBuffer;
610 // TAny* iReservedPtr_1; // reserved for future expansion
611 // TAny* iReservedPtr_2; // reserved for future expansion
613 #endif // of __SPEECHRECOGNITIONCUSTOMCOMMANDPARSER_H__