epoc32/include/mmf/common/speechrecognitioncustomcommandimplementor.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100 (2010-03-31)
branchSymbian2
changeset 3 e1b950c65cb4
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __SPEECHRECOGNITIONCUSTOMCOMMANDIMPLEMENTOR_H__
    17 #define __SPEECHRECOGNITIONCUSTOMCOMMANDIMPLEMENTOR_H__
    18 
    19 // INCLUDES
    20 
    21 #include <mmf/common/speechrecognitiondataclient.h>
    22 
    23 // CLASS DECLARATION
    24 
    25 /**
    26 @publishedAll
    27 @released
    28 
    29 This is the main class of Speech Recognition Custom Commands Implementor.
    30 
    31 @since  8.0
    32 */
    33 
    34 class MSpeechRecognitionCustomCommandImplementor
    35 	{
    36 public:
    37 	/**
    38 	Adds a new pronunciation for the given model into the specified
    39 	lexicon.
    40 
    41 	@param  aLexiconID
    42 	        The lexicon ID to where the new pronunciation is added.
    43 	@param  aModelBankID
    44 	        The model bank ID.
    45 	@param  aModelID
    46 	        The model ID.
    47 	@param  aPronunciationID
    48 	        A reference to where a new pronunciation ID is assigned.
    49 
    50 	@since  8.0
    51 	*/
    52 	virtual void MSrAddPronunciationL( TLexiconID aLexiconID,
    53 					TModelBankID aModelBankID, TModelID aModelID,
    54 					TPronunciationID& aPronunciationID ) = 0;
    55 
    56 	/**
    57 	Adds a new rule for the given pronunciation into the specified
    58 	grammar.
    59 
    60 	@param  aGrammarID			
    61 	        The grammar ID, where the new rule is added to
    62 	@param  aLexiconID
    63 	        The lexicon ID.
    64 	@param  aPronunciationID
    65 	        The pronunciation ID.
    66 	@param  aRuleID
    67 	        A reference where a new rule ID is assigned to.
    68 
    69 	@since  8.0
    70 	*/
    71 	virtual void MSrAddRuleL( TGrammarID aGrammarID, TLexiconID aLexiconID,
    72 					TPronunciationID aPronunciationID,
    73 					TRuleID& aRuleID ) = 0;
    74 
    75 	/**
    76 	Cancels the current operation.
    77 
    78 	@since  8.0
    79 	*/
    80 	virtual void MSrCancel() = 0;
    81 
    82 	/**
    83 	Commit uncommited changes to the database.
    84 
    85 	@since  8.0
    86 	*/
    87 	virtual void MSrCommitChangesL() = 0;
    88 
    89 	/**
    90 	Creates a new grammar.
    91 
    92 	@param  aGrammarID			
    93 	        A reference where the grammar ID is stored.
    94 
    95 	@since  8.0
    96 	*/
    97 	virtual void MSrCreateGrammarL( TGrammarID& aGrammarID ) = 0;
    98 
    99 	/**
   100 	Creates a new lexicon.
   101 
   102 	@param  aLexiconID			
   103 	        A reference where the lexicon ID is stored.
   104 
   105 	@since  8.0
   106 	*/
   107 	virtual void MSrCreateLexiconL( TLexiconID& aLexiconID ) = 0;
   108 
   109 	/**
   110 	Creates a new model bank.
   111 
   112 	@param  aModelBankID		
   113 	        A reference to where a new model bank ID is assigned.
   114 
   115 	@since	8.0
   116 	*/
   117 	virtual void MSrCreateModelBankL( TModelBankID& aModelBankID ) = 0;
   118 
   119 	/**
   120 	Ends the current recognition session. Resources allocated
   121 	for recognition are freed.
   122 
   123 	@since  8.0
   124 	*/
   125 	virtual void MSrEndRecSessionL() = 0;
   126 
   127 	/**
   128 	Returns all grammar IDs that are owned by the client.
   129 
   130 	@param  aGrammarIDs			
   131 	        A reference where grammar IDs are stored.
   132 
   133 	@since  8.0
   134 	*/
   135 	virtual void MSrGetAllClientGrammarIDsL(RArray<TGrammarID>& aGrammarIDs ) = 0;
   136 
   137 	/**
   138 	Returns all lexicon IDs that are owned by the client.
   139 
   140 	@param  aLexiconIDs	
   141 	        A reference where the lexicon IDs are stored.
   142 
   143 	@since  8.0
   144 	*/
   145 	virtual void MSrGetAllClientLexiconIDsL(RArray<TLexiconID>& aLexiconIDs ) = 0;
   146 	/**
   147 	Returns all modelbank IDs that are owned by the client.
   148 
   149 	@param  aModelBankIDs	
   150 	        A reference where model bank IDs are stored.
   151 
   152 	@since  8.0
   153 	*/
   154 	virtual void MSrGetAllClientModelBankIDsL(RArray<TModelBankID>& aModelBankIDs ) = 0;
   155 
   156 	/**
   157 	Returns all grammar IDs.
   158 
   159 	@param  aGrammarIDs			
   160 	        A reference where grammar IDs are stored.
   161 	*/
   162 	virtual void MSrGetAllGrammarIDsL(RArray<TGrammarID>& aGrammarIDs ) = 0;
   163 
   164 	/**
   165 	Returns all lexicon IDs.
   166 
   167 	@param  aLexiconIDs	
   168 	        A reference where lexicon IDs are stored.
   169 	*/
   170 	virtual void MSrGetAllLexiconIDsL(RArray<TLexiconID>& aLexiconIDs ) = 0;
   171 
   172 	/**
   173 	Returns all modelbank IDs.
   174 
   175 	@param  aModelBankIDs	
   176 	        A reference where the model bank IDs are stored.
   177 	
   178 	@since  8.0
   179 	*/
   180 	virtual void MSrGetAllModelBankIDsL(RArray<TModelBankID>& aModelBankIDs ) = 0;
   181 
   182 	/**
   183 	Returns all model IDs that exist in the specified model bank.
   184 
   185 	@param  aModelBankID
   186 			The model bank ID.
   187 	@param  aModelIDs
   188 	        A reference where model IDs are stored.
   189 
   190 	@since  8.0
   191 	*/
   192 	virtual void MSrGetAllModelIDsL( TModelBankID aModelBankID,
   193 					RArray<TModelID>& aModelIDs ) = 0;
   194 
   195 	/**
   196 	Returns all pronunciation IDs that exist in the specified lexicon.
   197 
   198 	@param  aLexiconID
   199 	        The lexicon ID.
   200 	@param  aPronunciationIDs
   201 	        A reference where pronunciation IDs are stored.
   202 
   203 	@since  8.0
   204 	*/
   205 	virtual void MSrGetAllPronunciationIDsL( TLexiconID aLexiconID,
   206 					RArray<TPronunciationID>& aPronunciationIDs ) = 0;
   207 
   208 	/**
   209 	Returns all rule IDs that exist in the specified grammar.
   210 
   211 	@param  aGrammarID
   212 	        The grammar ID.
   213 	@param  aRuleIDs
   214 	        A reference where rule IDs are stored.
   215 
   216 	@since  8.0
   217 	*/
   218 	virtual void MSrGetAllRuleIDsL( TGrammarID aGrammarID,
   219 					RArray<TRuleID>& aRuleIDs ) = 0;
   220 
   221 	/**
   222 	Returns the number of models available for training system wide,
   223 	based on available disk space.
   224 
   225 
   226 	@param  aCount				
   227 	        A reference where the number of available models is set.
   228 
   229 	@since  8.0
   230 	*/
   231 	virtual void MSrGetAvailableStorageL( TInt& aCount ) = 0;
   232 
   233 	/**
   234 	Returns the engine properties specified by the engine property
   235 	ID array. 
   236 
   237 	On return aPropertyValue contains an array of engine properties.
   238 	
   239 	@param  aPropertyId		
   240 	        A constant reference to an array of engine property IDs.
   241 	@param  aPropertyValue
   242 	        A reference to an array of engine property values.
   243 
   244 	@since  8.0
   245 	*/
   246 	virtual void MSrGetEnginePropertiesL( const RArray<TInt>& aPropertyId,
   247 					RArray<TInt>& aPropertyValue ) = 0;
   248 
   249 	/**
   250 	Returns the number of models in the specified model bank.
   251 
   252 	@param  aModelBankID		
   253 	        The model bank ID.
   254 	@param  aCount				
   255 	        A reference where the number of models is set.
   256 
   257 	@since  8.0
   258 	*/
   259 	virtual void MSrGetModelCountL( TModelBankID aModelBankID, TInt& aCount ) = 0;
   260 
   261 	/**
   262 	Checks if the rule is valid or not.
   263 
   264 	@param  aGrammarID
   265 	        The grammar ID.
   266 	@param  aRuleID
   267 	        The rule ID.
   268 	@param  aValid
   269 	        A reference where the validity of the rule is set.
   270 
   271 	@since  8.0
   272 	*/
   273 	virtual void MSrGetRuleValidityL( TGrammarID aGrammarID,
   274 					TRuleID aRuleID, TBool& aValid ) = 0;
   275 
   276 	/**
   277 	Returns the duration of the utterance for the specified model.
   278 
   279 	@param  aModelBankID		
   280 	        The model bank ID.
   281 	@param  aModelID			
   282 	        The model ID.
   283 	@param  aDuration			
   284 	        A reference where the duration of utterance is set.
   285 
   286 	@since  8.0
   287 	*/
   288 	virtual void MSrGetUtteranceDurationL( TModelBankID aModelBankID,
   289 					TModelID aModelID,
   290 					TTimeIntervalMicroSeconds32& aDuration) = 0;
   291 	/**
   292 	Loads the specified grammar in into the recognizer; done prior to recognition.
   293 
   294 	@param  aGrammarID			
   295 	        The grammar ID.
   296 
   297 	@since  8.0
   298 	*/
   299 	virtual void MSrLoadGrammarL( TGrammarID aGrammarID ) = 0;
   300 
   301 	/**
   302 	Loads the specified lexicon into the recognizer; done prior to recognition.
   303 
   304 	@param  aLexiconID			
   305 	        The lexicon ID.
   306 
   307 	@since  8.0
   308 	*/
   309 	virtual void MSrLoadLexiconL( TLexiconID aLexiconID ) = 0;
   310 
   311 	/**
   312 	Loads the specified model bank into the recognizer; done prior to recognition.
   313 
   314 	@param  aModelBankID		
   315 	        The model bank ID.
   316 
   317 	@since  8.0
   318 	*/
   319 	virtual void MSrLoadModelsL( TModelBankID aModelBankID ) = 0;
   320 
   321 	/**
   322 	Plays the previously trained utterance.
   323 
   324 	@param  aModelBankID		
   325 	        The model bank ID.
   326 	@param  aModelID			
   327 	        The model ID, whose utterance is played.
   328 
   329 	@since  8.0
   330 	*/
   331 	virtual void MSrPlayUtteranceL( TModelBankID aModelBankID,
   332 					TModelID aModelID ) = 0;
   333 
   334 	/**
   335 	Initiates recognition; performed following loading of model bank, lexicon, and grammar.
   336 
   337 	@param  aResultSet			
   338 	        A reference where the recognition result is set.
   339 
   340 	@since  8.0
   341 	*/
   342 	virtual void MSrRecognizeL( CSDClientResultSet& aResultSet ) = 0;
   343 
   344 	/**
   345 	Records user utterance for training and recognition.
   346 
   347 	@param  aRecordTime			
   348 	        A recording time in microseconds.
   349 
   350 	@since  8.0
   351 	*/
   352 	virtual void MSrRecordL( TTimeIntervalMicroSeconds32 aRecordTime ) = 0;
   353 
   354 	/**
   355 	Removes the specified grammar from the permanent storage.
   356 
   357 	Removing a grammar will remove all rules within the grammar.
   358 
   359 	@param  aGrammarID			
   360 	        The grammar ID.
   361 
   362 	@since  8.0
   363 	*/
   364 	virtual void MSrRemoveGrammarL( TGrammarID aGrammarID ) = 0;
   365 
   366 	/**
   367 	Removes the specified lexicon from the permanent storage.
   368 	
   369 	Removing a lexicon will remove all pronunciations within the lexicon.
   370 
   371 	@param  aLexiconID			
   372 	        The lexicon ID.
   373 
   374 	@since  8.0
   375 	*/
   376 	virtual void MSrRemoveLexiconL( TLexiconID aLexiconID ) = 0;
   377 
   378 	/**
   379 	Removes the specified model bank from the permanent storage.
   380 
   381 	Removing a model bank will remove all models within the model bank.
   382 
   383 	@param  aModelBankID		
   384 	        The model bank ID.
   385 
   386 	@since  8.0
   387 	*/
   388 	virtual void MSrRemoveModelBankL( TModelBankID aModelBankID ) = 0;
   389 
   390 	/**
   391 	Removes the specified model from the specified model bank
   392 	permanently.
   393 
   394 	@param  aModelBankID		
   395 	        The model bank ID.
   396 	@param  aModelID			
   397 	        The model ID.
   398 
   399 	@since  8.0
   400 	*/
   401 	virtual void MSrRemoveModelL( TModelBankID aModelBankID,
   402 					TModelID aModelID ) = 0;
   403 
   404 	/**
   405 	Removes the specified pronunciation from the specified lexicon permanently.
   406 
   407 	@param  aLexiconID			
   408 	        The lexicon ID.
   409 	@param  aPronunciationID	
   410 	        The pronunciation ID.
   411 
   412 	@since  8.0
   413 	*/
   414 	virtual void MSrRemovePronunciationL( TLexiconID aLexiconID,
   415 					TPronunciationID aPronunciationID ) = 0;
   416 
   417 	/**
   418 	Removes the specified rule from the specified grammar permanently.
   419 
   420 	@param  aGrammarID			
   421 	        The grammar ID.
   422 	@param  aRuleID				
   423 	        The rule ID.
   424 
   425 	@since  8.0
   426 	*/
   427 	virtual void MSrRemoveRuleL( TGrammarID aGrammarID,
   428 					TRuleID aRuleID ) = 0;
   429 					
   430 	/**
   431 	Sets the specified grammar client UID.
   432 
   433 	@param  aClientUid The client UID.
   434 	*/
   435 	virtual void MSrSetClientUid(TUid aClientUid) = 0;
   436 
   437 	/**
   438 	Starts a new recognition session.
   439 
   440 	@param  aMode				
   441 	        The recognition mode.
   442 
   443 	@since  8.0
   444 	*/
   445 	virtual void MSrStartRecSessionL( TRecognitionMode aMode ) = 0;
   446 
   447 	/**
   448 	Trains a new model into the specified model bank.
   449 
   450 	@param  aModelBankID		
   451 	        The model bank ID.
   452 	@param  aModelID			
   453 	        A reference to where the new model ID is assigned.
   454 
   455 	@since  8.0
   456 	*/
   457 	virtual void MSrTrainL( TModelBankID aModelBankID,
   458 					TModelID& aModelID ) = 0;
   459 
   460 	/**
   461 	Unloads the specified rule from the specified grammar in temporary
   462 	memory, previously loaded with LoadGrammarL().
   463 
   464 	The rule in the permanent storage remains intact.
   465 
   466 	@param  aGrammarID
   467 	        The grammar ID.
   468 	@param  aRuleID
   469 	        The rule ID.
   470 
   471 	@since  8.0
   472 	*/
   473 	virtual void MSrUnloadRuleL( TGrammarID aGrammarID,
   474 					TRuleID aRuleID ) = 0;
   475 
   476 	/**
   477 	Unloads the specified parameters to the engine.
   478 
   479 	@param  aParameterId		
   480 	        An array of parameter IDs.
   481 	@param  aParameterValue		
   482 	        An array of parameter values.
   483 
   484 	@since  8.0
   485 	*/
   486 	virtual void MSrLoadEngineParametersL( 
   487 					const RArray<TInt>& aParameterId, 
   488 					const RArray<TInt>& aParameterValue ) = 0;
   489 					
   490 	};
   491 
   492 #endif  // __SPEECHRECOGNITIONCUSTOMCOMMANDIMPLEMENTOR_H__