epoc32/include/mmf/common/speechrecognitioncustomcommandimplementor.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mmf/common/speechrecognitioncustomcommandimplementor.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,492 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __SPEECHRECOGNITIONCUSTOMCOMMANDIMPLEMENTOR_H__
    1.20 +#define __SPEECHRECOGNITIONCUSTOMCOMMANDIMPLEMENTOR_H__
    1.21 +
    1.22 +// INCLUDES
    1.23 +
    1.24 +#include <mmf/common/speechrecognitiondataclient.h>
    1.25 +
    1.26 +// CLASS DECLARATION
    1.27 +
    1.28 +/**
    1.29 +@publishedAll
    1.30 +@released
    1.31 +
    1.32 +This is the main class of Speech Recognition Custom Commands Implementor.
    1.33 +
    1.34 +@since  8.0
    1.35 +*/
    1.36 +
    1.37 +class MSpeechRecognitionCustomCommandImplementor
    1.38 +	{
    1.39 +public:
    1.40 +	/**
    1.41 +	Adds a new pronunciation for the given model into the specified
    1.42 +	lexicon.
    1.43 +
    1.44 +	@param  aLexiconID
    1.45 +	        The lexicon ID to where the new pronunciation is added.
    1.46 +	@param  aModelBankID
    1.47 +	        The model bank ID.
    1.48 +	@param  aModelID
    1.49 +	        The model ID.
    1.50 +	@param  aPronunciationID
    1.51 +	        A reference to where a new pronunciation ID is assigned.
    1.52 +
    1.53 +	@since  8.0
    1.54 +	*/
    1.55 +	virtual void MSrAddPronunciationL( TLexiconID aLexiconID,
    1.56 +					TModelBankID aModelBankID, TModelID aModelID,
    1.57 +					TPronunciationID& aPronunciationID ) = 0;
    1.58 +
    1.59 +	/**
    1.60 +	Adds a new rule for the given pronunciation into the specified
    1.61 +	grammar.
    1.62 +
    1.63 +	@param  aGrammarID			
    1.64 +	        The grammar ID, where the new rule is added to
    1.65 +	@param  aLexiconID
    1.66 +	        The lexicon ID.
    1.67 +	@param  aPronunciationID
    1.68 +	        The pronunciation ID.
    1.69 +	@param  aRuleID
    1.70 +	        A reference where a new rule ID is assigned to.
    1.71 +
    1.72 +	@since  8.0
    1.73 +	*/
    1.74 +	virtual void MSrAddRuleL( TGrammarID aGrammarID, TLexiconID aLexiconID,
    1.75 +					TPronunciationID aPronunciationID,
    1.76 +					TRuleID& aRuleID ) = 0;
    1.77 +
    1.78 +	/**
    1.79 +	Cancels the current operation.
    1.80 +
    1.81 +	@since  8.0
    1.82 +	*/
    1.83 +	virtual void MSrCancel() = 0;
    1.84 +
    1.85 +	/**
    1.86 +	Commit uncommited changes to the database.
    1.87 +
    1.88 +	@since  8.0
    1.89 +	*/
    1.90 +	virtual void MSrCommitChangesL() = 0;
    1.91 +
    1.92 +	/**
    1.93 +	Creates a new grammar.
    1.94 +
    1.95 +	@param  aGrammarID			
    1.96 +	        A reference where the grammar ID is stored.
    1.97 +
    1.98 +	@since  8.0
    1.99 +	*/
   1.100 +	virtual void MSrCreateGrammarL( TGrammarID& aGrammarID ) = 0;
   1.101 +
   1.102 +	/**
   1.103 +	Creates a new lexicon.
   1.104 +
   1.105 +	@param  aLexiconID			
   1.106 +	        A reference where the lexicon ID is stored.
   1.107 +
   1.108 +	@since  8.0
   1.109 +	*/
   1.110 +	virtual void MSrCreateLexiconL( TLexiconID& aLexiconID ) = 0;
   1.111 +
   1.112 +	/**
   1.113 +	Creates a new model bank.
   1.114 +
   1.115 +	@param  aModelBankID		
   1.116 +	        A reference to where a new model bank ID is assigned.
   1.117 +
   1.118 +	@since	8.0
   1.119 +	*/
   1.120 +	virtual void MSrCreateModelBankL( TModelBankID& aModelBankID ) = 0;
   1.121 +
   1.122 +	/**
   1.123 +	Ends the current recognition session. Resources allocated
   1.124 +	for recognition are freed.
   1.125 +
   1.126 +	@since  8.0
   1.127 +	*/
   1.128 +	virtual void MSrEndRecSessionL() = 0;
   1.129 +
   1.130 +	/**
   1.131 +	Returns all grammar IDs that are owned by the client.
   1.132 +
   1.133 +	@param  aGrammarIDs			
   1.134 +	        A reference where grammar IDs are stored.
   1.135 +
   1.136 +	@since  8.0
   1.137 +	*/
   1.138 +	virtual void MSrGetAllClientGrammarIDsL(RArray<TGrammarID>& aGrammarIDs ) = 0;
   1.139 +
   1.140 +	/**
   1.141 +	Returns all lexicon IDs that are owned by the client.
   1.142 +
   1.143 +	@param  aLexiconIDs	
   1.144 +	        A reference where the lexicon IDs are stored.
   1.145 +
   1.146 +	@since  8.0
   1.147 +	*/
   1.148 +	virtual void MSrGetAllClientLexiconIDsL(RArray<TLexiconID>& aLexiconIDs ) = 0;
   1.149 +	/**
   1.150 +	Returns all modelbank IDs that are owned by the client.
   1.151 +
   1.152 +	@param  aModelBankIDs	
   1.153 +	        A reference where model bank IDs are stored.
   1.154 +
   1.155 +	@since  8.0
   1.156 +	*/
   1.157 +	virtual void MSrGetAllClientModelBankIDsL(RArray<TModelBankID>& aModelBankIDs ) = 0;
   1.158 +
   1.159 +	/**
   1.160 +	Returns all grammar IDs.
   1.161 +
   1.162 +	@param  aGrammarIDs			
   1.163 +	        A reference where grammar IDs are stored.
   1.164 +	*/
   1.165 +	virtual void MSrGetAllGrammarIDsL(RArray<TGrammarID>& aGrammarIDs ) = 0;
   1.166 +
   1.167 +	/**
   1.168 +	Returns all lexicon IDs.
   1.169 +
   1.170 +	@param  aLexiconIDs	
   1.171 +	        A reference where lexicon IDs are stored.
   1.172 +	*/
   1.173 +	virtual void MSrGetAllLexiconIDsL(RArray<TLexiconID>& aLexiconIDs ) = 0;
   1.174 +
   1.175 +	/**
   1.176 +	Returns all modelbank IDs.
   1.177 +
   1.178 +	@param  aModelBankIDs	
   1.179 +	        A reference where the model bank IDs are stored.
   1.180 +	
   1.181 +	@since  8.0
   1.182 +	*/
   1.183 +	virtual void MSrGetAllModelBankIDsL(RArray<TModelBankID>& aModelBankIDs ) = 0;
   1.184 +
   1.185 +	/**
   1.186 +	Returns all model IDs that exist in the specified model bank.
   1.187 +
   1.188 +	@param  aModelBankID
   1.189 +			The model bank ID.
   1.190 +	@param  aModelIDs
   1.191 +	        A reference where model IDs are stored.
   1.192 +
   1.193 +	@since  8.0
   1.194 +	*/
   1.195 +	virtual void MSrGetAllModelIDsL( TModelBankID aModelBankID,
   1.196 +					RArray<TModelID>& aModelIDs ) = 0;
   1.197 +
   1.198 +	/**
   1.199 +	Returns all pronunciation IDs that exist in the specified lexicon.
   1.200 +
   1.201 +	@param  aLexiconID
   1.202 +	        The lexicon ID.
   1.203 +	@param  aPronunciationIDs
   1.204 +	        A reference where pronunciation IDs are stored.
   1.205 +
   1.206 +	@since  8.0
   1.207 +	*/
   1.208 +	virtual void MSrGetAllPronunciationIDsL( TLexiconID aLexiconID,
   1.209 +					RArray<TPronunciationID>& aPronunciationIDs ) = 0;
   1.210 +
   1.211 +	/**
   1.212 +	Returns all rule IDs that exist in the specified grammar.
   1.213 +
   1.214 +	@param  aGrammarID
   1.215 +	        The grammar ID.
   1.216 +	@param  aRuleIDs
   1.217 +	        A reference where rule IDs are stored.
   1.218 +
   1.219 +	@since  8.0
   1.220 +	*/
   1.221 +	virtual void MSrGetAllRuleIDsL( TGrammarID aGrammarID,
   1.222 +					RArray<TRuleID>& aRuleIDs ) = 0;
   1.223 +
   1.224 +	/**
   1.225 +	Returns the number of models available for training system wide,
   1.226 +	based on available disk space.
   1.227 +
   1.228 +
   1.229 +	@param  aCount				
   1.230 +	        A reference where the number of available models is set.
   1.231 +
   1.232 +	@since  8.0
   1.233 +	*/
   1.234 +	virtual void MSrGetAvailableStorageL( TInt& aCount ) = 0;
   1.235 +
   1.236 +	/**
   1.237 +	Returns the engine properties specified by the engine property
   1.238 +	ID array. 
   1.239 +
   1.240 +	On return aPropertyValue contains an array of engine properties.
   1.241 +	
   1.242 +	@param  aPropertyId		
   1.243 +	        A constant reference to an array of engine property IDs.
   1.244 +	@param  aPropertyValue
   1.245 +	        A reference to an array of engine property values.
   1.246 +
   1.247 +	@since  8.0
   1.248 +	*/
   1.249 +	virtual void MSrGetEnginePropertiesL( const RArray<TInt>& aPropertyId,
   1.250 +					RArray<TInt>& aPropertyValue ) = 0;
   1.251 +
   1.252 +	/**
   1.253 +	Returns the number of models in the specified model bank.
   1.254 +
   1.255 +	@param  aModelBankID		
   1.256 +	        The model bank ID.
   1.257 +	@param  aCount				
   1.258 +	        A reference where the number of models is set.
   1.259 +
   1.260 +	@since  8.0
   1.261 +	*/
   1.262 +	virtual void MSrGetModelCountL( TModelBankID aModelBankID, TInt& aCount ) = 0;
   1.263 +
   1.264 +	/**
   1.265 +	Checks if the rule is valid or not.
   1.266 +
   1.267 +	@param  aGrammarID
   1.268 +	        The grammar ID.
   1.269 +	@param  aRuleID
   1.270 +	        The rule ID.
   1.271 +	@param  aValid
   1.272 +	        A reference where the validity of the rule is set.
   1.273 +
   1.274 +	@since  8.0
   1.275 +	*/
   1.276 +	virtual void MSrGetRuleValidityL( TGrammarID aGrammarID,
   1.277 +					TRuleID aRuleID, TBool& aValid ) = 0;
   1.278 +
   1.279 +	/**
   1.280 +	Returns the duration of the utterance for the specified model.
   1.281 +
   1.282 +	@param  aModelBankID		
   1.283 +	        The model bank ID.
   1.284 +	@param  aModelID			
   1.285 +	        The model ID.
   1.286 +	@param  aDuration			
   1.287 +	        A reference where the duration of utterance is set.
   1.288 +
   1.289 +	@since  8.0
   1.290 +	*/
   1.291 +	virtual void MSrGetUtteranceDurationL( TModelBankID aModelBankID,
   1.292 +					TModelID aModelID,
   1.293 +					TTimeIntervalMicroSeconds32& aDuration) = 0;
   1.294 +	/**
   1.295 +	Loads the specified grammar in into the recognizer; done prior to recognition.
   1.296 +
   1.297 +	@param  aGrammarID			
   1.298 +	        The grammar ID.
   1.299 +
   1.300 +	@since  8.0
   1.301 +	*/
   1.302 +	virtual void MSrLoadGrammarL( TGrammarID aGrammarID ) = 0;
   1.303 +
   1.304 +	/**
   1.305 +	Loads the specified lexicon into the recognizer; done prior to recognition.
   1.306 +
   1.307 +	@param  aLexiconID			
   1.308 +	        The lexicon ID.
   1.309 +
   1.310 +	@since  8.0
   1.311 +	*/
   1.312 +	virtual void MSrLoadLexiconL( TLexiconID aLexiconID ) = 0;
   1.313 +
   1.314 +	/**
   1.315 +	Loads the specified model bank into the recognizer; done prior to recognition.
   1.316 +
   1.317 +	@param  aModelBankID		
   1.318 +	        The model bank ID.
   1.319 +
   1.320 +	@since  8.0
   1.321 +	*/
   1.322 +	virtual void MSrLoadModelsL( TModelBankID aModelBankID ) = 0;
   1.323 +
   1.324 +	/**
   1.325 +	Plays the previously trained utterance.
   1.326 +
   1.327 +	@param  aModelBankID		
   1.328 +	        The model bank ID.
   1.329 +	@param  aModelID			
   1.330 +	        The model ID, whose utterance is played.
   1.331 +
   1.332 +	@since  8.0
   1.333 +	*/
   1.334 +	virtual void MSrPlayUtteranceL( TModelBankID aModelBankID,
   1.335 +					TModelID aModelID ) = 0;
   1.336 +
   1.337 +	/**
   1.338 +	Initiates recognition; performed following loading of model bank, lexicon, and grammar.
   1.339 +
   1.340 +	@param  aResultSet			
   1.341 +	        A reference where the recognition result is set.
   1.342 +
   1.343 +	@since  8.0
   1.344 +	*/
   1.345 +	virtual void MSrRecognizeL( CSDClientResultSet& aResultSet ) = 0;
   1.346 +
   1.347 +	/**
   1.348 +	Records user utterance for training and recognition.
   1.349 +
   1.350 +	@param  aRecordTime			
   1.351 +	        A recording time in microseconds.
   1.352 +
   1.353 +	@since  8.0
   1.354 +	*/
   1.355 +	virtual void MSrRecordL( TTimeIntervalMicroSeconds32 aRecordTime ) = 0;
   1.356 +
   1.357 +	/**
   1.358 +	Removes the specified grammar from the permanent storage.
   1.359 +
   1.360 +	Removing a grammar will remove all rules within the grammar.
   1.361 +
   1.362 +	@param  aGrammarID			
   1.363 +	        The grammar ID.
   1.364 +
   1.365 +	@since  8.0
   1.366 +	*/
   1.367 +	virtual void MSrRemoveGrammarL( TGrammarID aGrammarID ) = 0;
   1.368 +
   1.369 +	/**
   1.370 +	Removes the specified lexicon from the permanent storage.
   1.371 +	
   1.372 +	Removing a lexicon will remove all pronunciations within the lexicon.
   1.373 +
   1.374 +	@param  aLexiconID			
   1.375 +	        The lexicon ID.
   1.376 +
   1.377 +	@since  8.0
   1.378 +	*/
   1.379 +	virtual void MSrRemoveLexiconL( TLexiconID aLexiconID ) = 0;
   1.380 +
   1.381 +	/**
   1.382 +	Removes the specified model bank from the permanent storage.
   1.383 +
   1.384 +	Removing a model bank will remove all models within the model bank.
   1.385 +
   1.386 +	@param  aModelBankID		
   1.387 +	        The model bank ID.
   1.388 +
   1.389 +	@since  8.0
   1.390 +	*/
   1.391 +	virtual void MSrRemoveModelBankL( TModelBankID aModelBankID ) = 0;
   1.392 +
   1.393 +	/**
   1.394 +	Removes the specified model from the specified model bank
   1.395 +	permanently.
   1.396 +
   1.397 +	@param  aModelBankID		
   1.398 +	        The model bank ID.
   1.399 +	@param  aModelID			
   1.400 +	        The model ID.
   1.401 +
   1.402 +	@since  8.0
   1.403 +	*/
   1.404 +	virtual void MSrRemoveModelL( TModelBankID aModelBankID,
   1.405 +					TModelID aModelID ) = 0;
   1.406 +
   1.407 +	/**
   1.408 +	Removes the specified pronunciation from the specified lexicon permanently.
   1.409 +
   1.410 +	@param  aLexiconID			
   1.411 +	        The lexicon ID.
   1.412 +	@param  aPronunciationID	
   1.413 +	        The pronunciation ID.
   1.414 +
   1.415 +	@since  8.0
   1.416 +	*/
   1.417 +	virtual void MSrRemovePronunciationL( TLexiconID aLexiconID,
   1.418 +					TPronunciationID aPronunciationID ) = 0;
   1.419 +
   1.420 +	/**
   1.421 +	Removes the specified rule from the specified grammar permanently.
   1.422 +
   1.423 +	@param  aGrammarID			
   1.424 +	        The grammar ID.
   1.425 +	@param  aRuleID				
   1.426 +	        The rule ID.
   1.427 +
   1.428 +	@since  8.0
   1.429 +	*/
   1.430 +	virtual void MSrRemoveRuleL( TGrammarID aGrammarID,
   1.431 +					TRuleID aRuleID ) = 0;
   1.432 +					
   1.433 +	/**
   1.434 +	Sets the specified grammar client UID.
   1.435 +
   1.436 +	@param  aClientUid The client UID.
   1.437 +	*/
   1.438 +	virtual void MSrSetClientUid(TUid aClientUid) = 0;
   1.439 +
   1.440 +	/**
   1.441 +	Starts a new recognition session.
   1.442 +
   1.443 +	@param  aMode				
   1.444 +	        The recognition mode.
   1.445 +
   1.446 +	@since  8.0
   1.447 +	*/
   1.448 +	virtual void MSrStartRecSessionL( TRecognitionMode aMode ) = 0;
   1.449 +
   1.450 +	/**
   1.451 +	Trains a new model into the specified model bank.
   1.452 +
   1.453 +	@param  aModelBankID		
   1.454 +	        The model bank ID.
   1.455 +	@param  aModelID			
   1.456 +	        A reference to where the new model ID is assigned.
   1.457 +
   1.458 +	@since  8.0
   1.459 +	*/
   1.460 +	virtual void MSrTrainL( TModelBankID aModelBankID,
   1.461 +					TModelID& aModelID ) = 0;
   1.462 +
   1.463 +	/**
   1.464 +	Unloads the specified rule from the specified grammar in temporary
   1.465 +	memory, previously loaded with LoadGrammarL().
   1.466 +
   1.467 +	The rule in the permanent storage remains intact.
   1.468 +
   1.469 +	@param  aGrammarID
   1.470 +	        The grammar ID.
   1.471 +	@param  aRuleID
   1.472 +	        The rule ID.
   1.473 +
   1.474 +	@since  8.0
   1.475 +	*/
   1.476 +	virtual void MSrUnloadRuleL( TGrammarID aGrammarID,
   1.477 +					TRuleID aRuleID ) = 0;
   1.478 +
   1.479 +	/**
   1.480 +	Unloads the specified parameters to the engine.
   1.481 +
   1.482 +	@param  aParameterId		
   1.483 +	        An array of parameter IDs.
   1.484 +	@param  aParameterValue		
   1.485 +	        An array of parameter values.
   1.486 +
   1.487 +	@since  8.0
   1.488 +	*/
   1.489 +	virtual void MSrLoadEngineParametersL( 
   1.490 +					const RArray<TInt>& aParameterId, 
   1.491 +					const RArray<TInt>& aParameterValue ) = 0;
   1.492 +					
   1.493 +	};
   1.494 +
   1.495 +#endif  // __SPEECHRECOGNITIONCUSTOMCOMMANDIMPLEMENTOR_H__