1 /* |
|
2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This is the definition of the speech recognition utility. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NSSSISPEECHRECOGNITIONUTILITY_H |
|
20 #define NSSSISPEECHRECOGNITIONUTILITY_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <mmfcontroller.h> |
|
26 #include <nsssispeechrecognitioncustomcommands.h> |
|
27 #include <nsssispeechrecognitionutilityobserver.h> |
|
28 #include <nsssispeechrecognitiondataclient.h> |
|
29 #include <nsssispeechrecognitiondatacommon.h> |
|
30 #include <nsssiutilitybase.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CSDClientResultSet; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * This is the main class of Speech Recognition Utility |
|
39 * |
|
40 * @lib nsssispeechrecognitionutility.lib |
|
41 * @since 2.0 |
|
42 */ |
|
43 |
|
44 class CSISpeechRecognitionUtility : public CBase, |
|
45 public MSISpeechRecognitionUtilityBase, |
|
46 public MMMFControllerEventMonitorObserver |
|
47 { |
|
48 |
|
49 public: |
|
50 |
|
51 /* |
|
52 * Creates instance of CSISpeechRecognitionUtility |
|
53 * Needed when dynamically loading nsssispeechrecognitionutility.dll |
|
54 * Direct users of CSISpeechRecognitionUtility should not use this. |
|
55 * Returns M-class pointer to MSISpeechRecognitionUtilityBase as TAny* |
|
56 * |
|
57 * @return Created instance |
|
58 */ |
|
59 IMPORT_C static TAny* CreateInstanceL(); |
|
60 |
|
61 /** |
|
62 * Second phase of construction after CreateInstanceL call. |
|
63 * Needed when dynamically loading nsssispeechrecognitionutility.dll |
|
64 * Direct users of CSISpeechRecognitionUtility should not use this. |
|
65 * |
|
66 * @since 3.1 |
|
67 * @param aClientUid Client UID for data ownership, other clients won't |
|
68 * be able to modify the data registered to certain client |
|
69 * @param aPluginUid UID of the plugin which will be used, KNullUid to |
|
70 * search for suitable plugin |
|
71 * @param aObserver Callback observer reference |
|
72 */ |
|
73 IMPORT_C void CreateInstanceSecondPhaseL( TUid aClientUid, |
|
74 TUid aPluginUid, |
|
75 MSISpeechRecognitionUtilityObserver& aObserver ); |
|
76 |
|
77 /** |
|
78 * Factory function for creating this class. |
|
79 * |
|
80 * @since 2.0 |
|
81 * @param aSpeechRecognitionUtilityObserver reference to event |
|
82 * observer class |
|
83 * @param aClientUid client UID for data |
|
84 * ownership |
|
85 * @return pointer to CSISpeechRecognitionUtility object |
|
86 */ |
|
87 IMPORT_C static CSISpeechRecognitionUtility* NewL( |
|
88 MSISpeechRecognitionUtilityObserver& |
|
89 aSpeechRecognitionUtilityObserver, TUid aClientUid ); |
|
90 |
|
91 /** |
|
92 * Factory function for creating this class. |
|
93 * Searches for a plugin, which supports the given |
|
94 * recognition mode. If no such plugin is found, leaves. |
|
95 * |
|
96 * @since 2.8 |
|
97 * @param aSpeechRecognitionUtilityObserver reference to the event observer class |
|
98 * @param aClientUid client UID for data ownership |
|
99 * @param aPreferredMode Recognition technology (speaker |
|
100 * independent or dependent) |
|
101 * @return pointer to CSISpeechRecognitionUtility object |
|
102 */ |
|
103 IMPORT_C static CSISpeechRecognitionUtility* NewL( |
|
104 MSISpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver, |
|
105 TUid aClientUid, |
|
106 TNSSRecognitionMode aPreferredMode ); |
|
107 |
|
108 /** |
|
109 * Factory function for creating this class. |
|
110 * Loads the plugin with the given ID. |
|
111 * |
|
112 * @since 2.8 |
|
113 * @param aSpeechRecognitionUtilityObserver reference to the event observer class |
|
114 * @param aClientUid client UID for data ownership |
|
115 * @param aMmfPluginUid UID of the speech recognition plugin |
|
116 * @return pointer to CSISpeechRecognitionUtility object |
|
117 */ |
|
118 IMPORT_C static CSISpeechRecognitionUtility* NewL( |
|
119 MSISpeechRecognitionUtilityObserver& aSpeechRecognitionUtilityObserver, |
|
120 TUid aClientUid, |
|
121 TUid aMmfPluginUid ); |
|
122 |
|
123 /** |
|
124 * Factory function for creating this class. Leaves a pointer |
|
125 * on the cleanup |
|
126 * |
|
127 * @since 2.0 |
|
128 * @param aSpeechRecognitionUtilityObserver reference to event |
|
129 * observer class |
|
130 * @param aClientUid client UID for data |
|
131 * ownership |
|
132 * @return pointer to CSISpeechRecognitionUtility object |
|
133 */ |
|
134 IMPORT_C static CSISpeechRecognitionUtility* NewLC( |
|
135 MSISpeechRecognitionUtilityObserver& |
|
136 aSpeechRecognitionUtilityObserver, TUid aClientUid ); |
|
137 |
|
138 /** |
|
139 * Destructor |
|
140 * |
|
141 * @since 2.0 |
|
142 */ |
|
143 IMPORT_C ~CSISpeechRecognitionUtility(); |
|
144 |
|
145 /** |
|
146 * Returns the engine properties specified by the engine property |
|
147 * ID array. On return aPropertyValue contains an array of engine |
|
148 * properties. |
|
149 * |
|
150 * @since 2.0 |
|
151 * @param aPropertyId constant reference to array of engine |
|
152 * property Ids |
|
153 * @param aPropertyValue reference to array of engine property |
|
154 * values |
|
155 * @return system wide error code |
|
156 */ |
|
157 IMPORT_C TInt GetEngineProperties( const RArray<TInt>& aPropertyId, |
|
158 RArray<TInt>& aPropertyValue ); |
|
159 |
|
160 /** |
|
161 * Adapts the speaker independent models to a specific speaker's voice. |
|
162 * |
|
163 * @since 2.8 |
|
164 * @param aResultSet Recognition result N-Best |
|
165 * @param aCorrect Index to N-Best pointing the correct result. |
|
166 * @return system wide error code |
|
167 */ |
|
168 IMPORT_C TInt Adapt( const CSIClientResultSet& aResultSet, |
|
169 TInt aCorrect ); |
|
170 |
|
171 /** |
|
172 * Adds a new pronunciation for the given text phrase into the |
|
173 * specified lexicon. |
|
174 * |
|
175 * @since 2.8 |
|
176 * @param aLexiconID lexicon Id, where the new |
|
177 * pronunciation is added to |
|
178 * aTextForTraining Text to be trained |
|
179 * aLanguage Pronunciation language |
|
180 * aPronunciationID reference where a new pronunciation |
|
181 * Id is assigned to |
|
182 * @return system wide error code |
|
183 */ |
|
184 IMPORT_C TInt AddPronunciation( TSILexiconID aLexiconID, |
|
185 const TDesC& aTextForTraining, |
|
186 TLanguage aLanguage, |
|
187 TSIPronunciationID& aPronunciationID); |
|
188 |
|
189 /** |
|
190 * Adds a new rule for the given pronunciation into the |
|
191 * specified grammar. |
|
192 * |
|
193 * @since 2.0 |
|
194 * @param aGrammarID grammar Id, where the new rule is |
|
195 * added to |
|
196 * @param aLexiconID lexicon Id |
|
197 * @param aPronunciationID pronunciation Id |
|
198 * @param aRuleID reference where a new rule Id is |
|
199 * assigned to |
|
200 * @return system wide error code |
|
201 */ |
|
202 IMPORT_C TInt AddRule( TSIGrammarID aGrammarID, |
|
203 TSILexiconID aLexiconID, |
|
204 TSIPronunciationID aPronunciationID, |
|
205 TSIRuleID& aRuleID ); |
|
206 |
|
207 /** |
|
208 * Adds a new rule variant for the given pronunciation into the |
|
209 * specified grammar. |
|
210 * |
|
211 * @since 2.8 |
|
212 * @param aGrammarID grammar Id, where the new rule is |
|
213 * added to |
|
214 * @param aRuleID the rule Id, which will contain this variant |
|
215 * @param aPronunciationIDs the phrase is the concatenation |
|
216 * of these pronunciation IDs |
|
217 * @param aRuleVariantID reference where a new rule variant |
|
218 * Id is assigned to |
|
219 * @return system wide error code |
|
220 */ |
|
221 IMPORT_C TInt AddRuleVariant( TSIGrammarID aGrammarID, |
|
222 TSILexiconID aLexiconID, |
|
223 RArray<TSIPronunciationID>& aPronunciationIDs, |
|
224 TSIRuleID aRuleID, |
|
225 TSIRuleVariantID& aRuleVariantID ); |
|
226 |
|
227 /** |
|
228 * Adds a new rule for the given phrase into the |
|
229 * specified grammar. |
|
230 * |
|
231 * @since 2.8 |
|
232 * @param aTextArray the text to be trained, divided in to words. |
|
233 * The phrase is the concatenation of these words. |
|
234 * @param aLanguageArray pronunciations will be generated for these languages |
|
235 * @param aLexiconID lexicon, where to add pronunciations |
|
236 * @param aGrammarID grammar, where to add rules |
|
237 * @param aRuleID the ID of the rule will be placed on this variable. |
|
238 * @return system wide error code |
|
239 */ |
|
240 IMPORT_C TInt AddVoiceTag( MDesCArray& aTextArray, |
|
241 const RArray<TLanguage>& aLanguageArray, |
|
242 TSILexiconID aLexiconID, |
|
243 TSIGrammarID aGrammarID, |
|
244 TSIRuleID& aRuleID ); |
|
245 |
|
246 /** |
|
247 * Adds a new rules for the given phrases into the |
|
248 * specified grammar. |
|
249 * |
|
250 * @since 2.8 |
|
251 * @param aTextArrayArray Array of text arrays. The phrase k is the concatenation |
|
252 * of texts in array k. |
|
253 * @param aLanguageArray pronunciations will be generated for these languages |
|
254 * @param aLexiconID lexicon, where to add pronunciations |
|
255 * @param aGrammarID grammar, where to add rules |
|
256 * @param aRuleID the ID of the rule will be placed on this variable. |
|
257 * If some of the names fail while others succeed, |
|
258 * KInvalidRuleID will be placed to the array. |
|
259 * @return system wide error code |
|
260 */ |
|
261 IMPORT_C TInt AddVoiceTags( const RPointerArray<MDesCArray> &aTextArrayArray, |
|
262 const RArray<TLanguage> &aLanguageArray, |
|
263 TSILexiconID aLexiconID, |
|
264 TSIGrammarID aGrammarID, |
|
265 RArray<TSIRuleID>& aRuleIDArray ); |
|
266 |
|
267 /** |
|
268 * Adds a new rule for the given phrase into the |
|
269 * specified grammar. |
|
270 * |
|
271 * @since 3.1 |
|
272 * @param aTextArray The text to be trained, divided in to words. |
|
273 * The phrase is the concatenation of these words. |
|
274 * @param aLanguageArray Pronunciations will be generated for these languages |
|
275 * @param aLexiconID Lexicon, where to add pronunciations |
|
276 * @param aGrammarID Grammar, where to add rules |
|
277 * @param aRuleID The ID of the rule will be placed on this variable. |
|
278 * |
|
279 * @return System wide error code |
|
280 */ |
|
281 IMPORT_C TInt AddVoiceTag( MDesCArray& aTextArray, |
|
282 const RArray<RLanguageArray>& aLanguageArray, |
|
283 TSILexiconID aLexiconID, |
|
284 TSIGrammarID aGrammarID, |
|
285 TSIRuleID& aRuleID ); |
|
286 |
|
287 /** |
|
288 * Adds a new rules for the given phrases into the |
|
289 * specified grammar. |
|
290 * |
|
291 * @since 3.1 |
|
292 * @param aTextArrayArray Array of text arrays. The phrase k is the concatenation |
|
293 * of texts in array k. |
|
294 * @param aLanguageArray pronunciations will be generated for these languages |
|
295 * @param aLexiconID lexicon, where to add pronunciations |
|
296 * @param aGrammarID grammar, where to add rules |
|
297 * @param aRuleID the ID of the rule will be placed on this variable. |
|
298 * If some of the names fail while others succeed, |
|
299 * KInvalidRuleID will be placed to the array. |
|
300 * @return System wide error code |
|
301 */ |
|
302 IMPORT_C TInt AddVoiceTags( const RPointerArray<MDesCArray>& aTextArrayArray, |
|
303 const RArray<RLanguageArray>& aLanguageArray, |
|
304 TSILexiconID aLexiconID, |
|
305 TSIGrammarID aGrammarID, |
|
306 RArray<TSIRuleID>& aRuleIDArray ); |
|
307 |
|
308 /** |
|
309 * Cancels the current operation |
|
310 * |
|
311 * @since 2.0 |
|
312 */ |
|
313 IMPORT_C void Cancel(); |
|
314 |
|
315 /** |
|
316 * Saves the changes into a permanent storage. |
|
317 * |
|
318 * @since 2.0 |
|
319 * @return System-wide errors |
|
320 */ |
|
321 IMPORT_C TInt CommitChanges(); |
|
322 |
|
323 /** |
|
324 * Creates a new grammar. |
|
325 * |
|
326 * @since 2.0 |
|
327 * @param aGrammarID reference where grammar ID is stored |
|
328 * @return system wide error codes |
|
329 */ |
|
330 IMPORT_C TInt CreateGrammar( TSIGrammarID& aGrammarID ); |
|
331 |
|
332 /** |
|
333 * Creates a new lexicon. |
|
334 * |
|
335 * @since 2.0 |
|
336 * @param aLexiconID reference where lexicon ID is stored |
|
337 * @return system wide error codes |
|
338 */ |
|
339 IMPORT_C TInt CreateLexicon( TSILexiconID& aLexiconID ); |
|
340 |
|
341 /** |
|
342 * Creates a new rule. |
|
343 * |
|
344 * @since 2.8 |
|
345 * @param aGrammarID grammar, where the new rule is to be added |
|
346 * @param aRuleID reference where rule ID is stored |
|
347 * @return system wide error codes |
|
348 */ |
|
349 IMPORT_C TInt CreateRule( TSIGrammarID aGrammarID, TSIRuleID& aRuleID ); |
|
350 |
|
351 /** |
|
352 * Loads the specified model bank into the recognizer; |
|
353 * done prior to recognition. |
|
354 * |
|
355 * @since 2.0 |
|
356 * @param ModelBankID model bank Id |
|
357 * @return system wide error codes |
|
358 */ |
|
359 IMPORT_C TInt LoadModels( TSIModelBankID aModelBankID ); |
|
360 |
|
361 /** |
|
362 * Loads the specified grammar into the recognizer; |
|
363 * done prior to recognition. |
|
364 * |
|
365 * @since 2.0 |
|
366 * @param aGrammarID grammar ID |
|
367 * @return system wide error codes |
|
368 */ |
|
369 IMPORT_C TInt LoadGrammar( TSIGrammarID aGrammarID ); |
|
370 |
|
371 /** |
|
372 * Reactivates a previously deactivated grammar. |
|
373 * |
|
374 * @since 2.0 |
|
375 * @param aGrammarID grammar ID |
|
376 * @return system wide error codes |
|
377 */ |
|
378 IMPORT_C TInt ActivateGrammar( TSIGrammarID aGrammarID ); |
|
379 |
|
380 /** |
|
381 * Deactivates a loaded grammar, so that it is not recognized. |
|
382 * |
|
383 * @since 2.0 |
|
384 * @param aGrammarID grammar ID |
|
385 * @return system wide error codes |
|
386 */ |
|
387 IMPORT_C TInt DeactivateGrammar( TSIGrammarID aGrammarID ); |
|
388 |
|
389 /** |
|
390 * Loads the specified lexicon into the recognizer; |
|
391 * done prior to recognition. |
|
392 * |
|
393 * @since 2.0 |
|
394 * @param aLexiconID lexicon ID |
|
395 * @return system wide error codes |
|
396 */ |
|
397 IMPORT_C TInt LoadLexicon( TSILexiconID aLexiconID ); |
|
398 |
|
399 /** |
|
400 * Returns the number of models in the specified model bank. |
|
401 * @since 2.0 |
|
402 * @param aModelBankID model bank Id |
|
403 * @param aCount reference where the number of |
|
404 * models is set |
|
405 * @return system wide error codes |
|
406 */ |
|
407 IMPORT_C TInt GetModelCount( TSIModelBankID aModelBankID, |
|
408 TInt& aModelCount ); |
|
409 |
|
410 /** |
|
411 * Ends the current recognition session. Resources allocated |
|
412 * for recognition are freed. |
|
413 * |
|
414 * @since 2.0 |
|
415 * @param aModelBankID reference where a new model bank Id is |
|
416 * assigned to |
|
417 * @return system wide error codes |
|
418 */ |
|
419 IMPORT_C TInt EndRecSession(); |
|
420 |
|
421 /** |
|
422 * Starts a new recognition session. |
|
423 * |
|
424 * @since 2.0 |
|
425 * @param aMode recognition mode |
|
426 * @return system wide error codes |
|
427 */ |
|
428 IMPORT_C TInt StartRecSession( TNSSRecognitionMode aMode ); |
|
429 |
|
430 /** |
|
431 * Initiates speaker independent recognition; performed |
|
432 * following loading of model bank, lexicon, and grammar. |
|
433 * |
|
434 * @since 2.8 |
|
435 * @param aResultSet reference where the recognition |
|
436 * result is set |
|
437 * @return system wide error codes |
|
438 */ |
|
439 IMPORT_C TInt Recognize( CSIClientResultSet& aResultSet ); |
|
440 |
|
441 /** |
|
442 * Records uder utterance for training and recognition. |
|
443 * |
|
444 * @since 2.0 |
|
445 * @param aRecordTime recording time in microseconds |
|
446 * @return system wide error codes |
|
447 */ |
|
448 IMPORT_C TInt Record( TTimeIntervalMicroSeconds32 aRecordTime ); |
|
449 |
|
450 /** |
|
451 * Stops the recording. The difference with Cancel is that if |
|
452 * enough samples were recorded, a recognition result will be produced. |
|
453 * |
|
454 * @since 2.8 |
|
455 * @param aRecordTime recording time in microseconds |
|
456 * @return system wide error codes |
|
457 */ |
|
458 IMPORT_C TInt EndRecord(); |
|
459 |
|
460 /** |
|
461 * Pre-starts samping before Record call. |
|
462 * |
|
463 * @since 3.2 |
|
464 * @return System wide error code |
|
465 */ |
|
466 IMPORT_C TInt PreStartSampling(); |
|
467 |
|
468 /** |
|
469 * Removes the specified grammar from the permanent storage. |
|
470 * Removing a grammar will remove all rules within the grammar. |
|
471 * |
|
472 * @since 2.0 |
|
473 * @param aGrammarID grammar Id |
|
474 * @return system wide error codes |
|
475 */ |
|
476 IMPORT_C TInt RemoveGrammar( TSIGrammarID aGrammarID ); |
|
477 |
|
478 /** |
|
479 * Removes the specified pronunciation from the |
|
480 * specified lexicon permanently. |
|
481 * |
|
482 * @since 2.0 |
|
483 * @param aLexiconID lexicon Id |
|
484 * @param aPronunciationID pronunciation Id |
|
485 * @return system wide error codes |
|
486 */ |
|
487 IMPORT_C TInt RemovePronunciation( TSILexiconID aLexiconID, |
|
488 TSIPronunciationID aPronunciationID ); |
|
489 |
|
490 /** |
|
491 * Removes the specified lexicon from the permanent storage. |
|
492 * Removing a lexicon will remove all pronunciations within the |
|
493 * lexicon. |
|
494 * |
|
495 * @since 2.0 |
|
496 * @param aLexiconID lexicon Id |
|
497 * @return system wide error codes |
|
498 */ |
|
499 IMPORT_C TInt RemoveLexicon( TSILexiconID aLexiconID ); |
|
500 |
|
501 /** |
|
502 * Removes the specified model from the specified model bank |
|
503 * permanently. |
|
504 * |
|
505 * @since 2.0 |
|
506 * @param aModelBankID model bank Id |
|
507 * @param aModelID model Id |
|
508 * @return system wide error codes |
|
509 */ |
|
510 IMPORT_C TInt RemoveModel( TSIModelBankID aModelBankID, |
|
511 TSIModelID aModelID ); |
|
512 |
|
513 /** |
|
514 * Removes the specified rule from the specified grammar permanently. |
|
515 * |
|
516 * @since 2.0 |
|
517 * @param aGrammarID grammar Id |
|
518 * @param aRuleID rule Id |
|
519 * @return system wide error codes |
|
520 */ |
|
521 IMPORT_C TInt RemoveRule( TSIGrammarID aGrammarID, TSIRuleID aRuleID ); |
|
522 |
|
523 /** |
|
524 * Removes multiple rules from the specified grammar permanently. |
|
525 * |
|
526 * @since 2.0 |
|
527 * @param aGrammarID grammar Id |
|
528 * @param aRuleID rule Id |
|
529 * @return system wide error codes |
|
530 */ |
|
531 IMPORT_C TInt RemoveRules( TSIGrammarID aGrammarID, RArray<TSIRuleID>& aRuleIDs ); |
|
532 |
|
533 /** |
|
534 * Unloads the specified rule from the specified grammar |
|
535 * in temporary memory, previously loaded with LoadGrammarL. |
|
536 * The rule in the permanent storage remains intact. |
|
537 * |
|
538 * @since 2.0 |
|
539 * @param aGrammarID grammar Id |
|
540 * @param aRuleID rule Id |
|
541 * @return system wide error codes |
|
542 */ |
|
543 IMPORT_C TInt UnloadRule( TSIGrammarID aGrammarID, TSIRuleID aRuleID ); |
|
544 |
|
545 /** |
|
546 * Unloads the specified grammar from the list of grammars |
|
547 * in temporary memory, previously loaded with LoadGrammarL. |
|
548 * The grammar in the permanent storage remains intact. |
|
549 * |
|
550 * @since 2.8 |
|
551 * @param aGrammarID grammar Id |
|
552 * @return system wide error codes |
|
553 */ |
|
554 IMPORT_C TInt UnloadGrammar( TSIGrammarID aGrammarID ); |
|
555 |
|
556 /** |
|
557 * Set the event handler for asynchronous events |
|
558 * |
|
559 * @since 2.0 |
|
560 * @param aSpeechRecognitionUtilityObserver pointer to observer |
|
561 */ |
|
562 IMPORT_C void SetEventHandler( MSISpeechRecognitionUtilityObserver* |
|
563 aSpeechRecognitionUtilityObserver ); |
|
564 |
|
565 /** |
|
566 * Returns all pronunciation Ids that exist in the specified lexicon. |
|
567 * |
|
568 * @since 2.0 |
|
569 * @param aLexiconID lexicon Id |
|
570 * aPronunciationIDs reference where pronunciation |
|
571 * Ids are stored |
|
572 * @return system wide error codes |
|
573 */ |
|
574 IMPORT_C TInt GetAllPronunciationIDs( TSILexiconID aLexiconID, |
|
575 RArray <TSIPronunciationID>& aPronunciationIDs ); |
|
576 |
|
577 /** |
|
578 * Returns all grammar Ids that belong to the current client. |
|
579 * |
|
580 * @since 2.0 |
|
581 * @param aGrammarIDs reference where grammar Ids are stored |
|
582 * @return System-wide errors |
|
583 */ |
|
584 IMPORT_C TInt GetAllClientGrammarIDs( RArray<TSIGrammarID>& aGrammarIDs ); |
|
585 |
|
586 /** |
|
587 * Returns all lexicon Ids that belong to the current client. |
|
588 * |
|
589 * @since 2.0 |
|
590 * @param aLexiconIDs reference where lexicon Ids are stored |
|
591 * @return System-wide errors |
|
592 */ |
|
593 IMPORT_C TInt GetAllClientLexiconIDs( RArray<TSILexiconID>& aLexiconIDs ); |
|
594 |
|
595 /** |
|
596 * Returns all model bank Ids that belong to the current client. |
|
597 * @since 2.0 |
|
598 * @param aModelBankIDs reference where model bank |
|
599 * Ids are stored |
|
600 * @return System-wide errors |
|
601 */ |
|
602 IMPORT_C TInt GetAllClientModelBankIDs( |
|
603 RArray<TSIModelBankID>& aModelBankIDs ); |
|
604 |
|
605 /** |
|
606 * Returns all grammar Ids that exist (for all clients). |
|
607 * |
|
608 * @since 2.0 |
|
609 * @param aGrammarIDs reference where grammar Ids are stored |
|
610 * @return System-wide errors |
|
611 */ |
|
612 IMPORT_C TInt GetAllGrammarIDs( RArray<TSIGrammarID>& aGrammarIDs ); |
|
613 |
|
614 /** |
|
615 * Returns all lexicon Ids that exist (for all clients). |
|
616 * |
|
617 * @since 2.0 |
|
618 * @param aLexiconIDs reference where lexicon Ids are stored |
|
619 * @return System-wide errors |
|
620 */ |
|
621 IMPORT_C TInt GetAllLexiconIDs( RArray<TSILexiconID>& aLexiconIDs ); |
|
622 |
|
623 /** |
|
624 * Returns all model bank Ids that exist (for all clients). |
|
625 * |
|
626 * @since 2.0 |
|
627 * @param aModelBankIDs reference where model bank |
|
628 * Ids are stored |
|
629 * @return System-wide errors |
|
630 */ |
|
631 IMPORT_C TInt GetAllModelBankIDs( |
|
632 RArray<TSIModelBankID>& aModelBankIDs ); |
|
633 |
|
634 /** |
|
635 * Returns all model Ids that exist in the specified model bank. |
|
636 * |
|
637 * @since 2.0 |
|
638 * @param aModelBankID model bank Id |
|
639 * aModelIDs reference where model Ids are stored |
|
640 * @return system wide error codes |
|
641 */ |
|
642 IMPORT_C TInt GetAllModelIDs( TSIModelBankID aModelBankID, |
|
643 RArray <TSIModelID>& aModelIDs ); |
|
644 |
|
645 /** |
|
646 * Checks if the rule is valid or not. |
|
647 * |
|
648 * @since 2.0 |
|
649 * @param aGrammarID grammar Id |
|
650 * aRuleID rule Id |
|
651 * aValid reference where the validity of |
|
652 * the rule is set |
|
653 * @return system wide error codes |
|
654 */ |
|
655 IMPORT_C TInt GetRuleValidity( TSIGrammarID aGrammarID, TSIRuleID aRuleID, |
|
656 TBool& aValid ); |
|
657 |
|
658 /** |
|
659 * Returns all rule Ids that exist in the specified grammar. |
|
660 * |
|
661 * @since 2.0 |
|
662 * @param aGrammarID grammar Id |
|
663 * aRuleIDs reference where rule Ids are stored |
|
664 * @return system wide error codes |
|
665 */ |
|
666 IMPORT_C TInt GetAllRuleIDs( TSIGrammarID aGrammarID, |
|
667 RArray <TSIRuleID>& aRuleIDs ); |
|
668 |
|
669 /** |
|
670 * Creates a new model bank. |
|
671 * |
|
672 * @since 2.0 |
|
673 * @param aModelBankID reference where a new model |
|
674 * bank Id is assigned to |
|
675 * @return system wide error codes |
|
676 */ |
|
677 IMPORT_C TInt CreateModelBank( TSIModelBankID& aModelBankID ); |
|
678 |
|
679 /** |
|
680 * Removes the specified model bank from the permanent storage. |
|
681 * Removing a model bank will remove all models within the model bank. |
|
682 * @since 2.0 |
|
683 * @param aModelBankID model bank Id |
|
684 * @return system wide error codes |
|
685 */ |
|
686 IMPORT_C TInt RemoveModelBank( TSIModelBankID aModelBankID ); |
|
687 |
|
688 /** |
|
689 * Uploads the specified parameters into the engine. |
|
690 * |
|
691 * @since 2.0 |
|
692 * @param aParameterId array of parameter IDs |
|
693 * @param aParameterValue array of parameter values |
|
694 * @return system wide error codes |
|
695 */ |
|
696 IMPORT_C TInt LoadEngineParameters( const RArray<TInt>& aParameterId, |
|
697 const RArray<TInt>& aParameterValue ); |
|
698 |
|
699 /** |
|
700 * Set the audio priority and preference for train, playback |
|
701 * and recognition |
|
702 * |
|
703 * @since 2.0 |
|
704 * @param aPriority priority for voice recognition |
|
705 * @param aTrainPreference preference for training |
|
706 * @param aPlaybackPreference preference for playback |
|
707 * @param aRecognitionPreference preference for recognition |
|
708 * @return system wide error codes |
|
709 */ |
|
710 IMPORT_C TInt SetAudioPriority( TInt aPriority, TInt aTrainPreference, |
|
711 TInt aPlaybackPreference, TInt aRecognitionPreference ); |
|
712 |
|
713 /** |
|
714 * From MSISpeechRecognitionUtilityObserver |
|
715 * |
|
716 * @since 2.0 |
|
717 * @param aEvent event code indicating what |
|
718 * asynchronous event occurred |
|
719 */ |
|
720 void HandleEvent( const TMMFEvent& aEvent ); |
|
721 |
|
722 private: // Functions |
|
723 |
|
724 /** |
|
725 * Private C++ constructor for this class. |
|
726 * |
|
727 * @since 2.0 |
|
728 * @param aSpeechRecognitionUtilityObserver reference to event |
|
729 * observer class |
|
730 */ |
|
731 CSISpeechRecognitionUtility( MSISpeechRecognitionUtilityObserver& |
|
732 aSpeechRecognitionUtilityObserver ); |
|
733 |
|
734 /** |
|
735 * Default C++ constructor |
|
736 */ |
|
737 CSISpeechRecognitionUtility(); |
|
738 |
|
739 /** |
|
740 * Second phase constructor for this class. |
|
741 * |
|
742 * @since 2.0 |
|
743 * @param aClientUid Client UID for data ownership, other clients won't |
|
744 * be able to modify the data registered to certain client |
|
745 * @param aPluginUid UID of the plugin which will be used, KNullUid to |
|
746 * search for suitable plugin |
|
747 * @param aObserver Callback observer reference |
|
748 */ |
|
749 void ConstructL( TUid aClientUid, |
|
750 TUid aPluginUid, |
|
751 MSISpeechRecognitionUtilityObserver& aObserver ); |
|
752 |
|
753 |
|
754 private: // Member variables |
|
755 |
|
756 // member variable MMF controller |
|
757 RMMFController iMMFController; |
|
758 |
|
759 // member variable for custom commands |
|
760 RSISpeechRecognitionCustomCommands iSrCustomCommands; |
|
761 // member variable pointer for observer class |
|
762 MSISpeechRecognitionUtilityObserver* iSpeechRecognitionUtilityObserver; |
|
763 // member variable pointer for controller event monitor class |
|
764 CMMFControllerEventMonitor* iControllerEventMonitor; |
|
765 // used to indicate if an event is the result of an internal command |
|
766 TBool iInternalCommand; |
|
767 |
|
768 // member variable pointer for array of rule IDs |
|
769 RArray <TSIRuleID>* iRuleIDs; |
|
770 // member variable pointer for array of pronunciation IDs |
|
771 RArray <TSIPronunciationID>* iPronunciationIDs; |
|
772 // member variable pointer for array of model IDs |
|
773 RArray <TSIModelID>* iModelIDs; |
|
774 // member variable pointer for array of grammar IDs |
|
775 RArray <TSIGrammarID>* iGrammarIDs; |
|
776 // member variable pointer for array of lexicon IDs |
|
777 RArray <TSILexiconID>* iLexiconIDs; |
|
778 // member variable pointer for array of model bank IDs |
|
779 RArray <TSIModelBankID>* iModelBankIDs; |
|
780 // member variable for model bank IDs |
|
781 TSIModelBankID iModelBankID; |
|
782 // member variable for grammar IDs |
|
783 TSIGrammarID iGrammarID; |
|
784 // member variable for lexicon IDs |
|
785 TSILexiconID iLexiconID; |
|
786 // member variable for pronunciation count |
|
787 TInt iPronunciationCount; |
|
788 // member variable for rule count |
|
789 TInt iRuleCount; |
|
790 // member variable for model count |
|
791 TInt iModelCount; |
|
792 |
|
793 // member variable for audio priority |
|
794 TInt iAudioPriority; |
|
795 // member variable for train preference |
|
796 TInt iTrainPreference; |
|
797 // member variable for playback preference |
|
798 TInt iPlaybackPreference; |
|
799 // member variable for recognition preference |
|
800 TInt iRecognitionPreference; |
|
801 |
|
802 // member variable pointer for array of client result sets |
|
803 CSDClientResultSet* iResultSet; |
|
804 |
|
805 // member variable for client UID |
|
806 TUid iClientUid; |
|
807 |
|
808 // For SI: N-Best list |
|
809 CSIClientResultSet* iSIResultSet; |
|
810 |
|
811 // reserved for future expansion |
|
812 TAny* iReservedPtr_1; |
|
813 // reserved for future expansion |
|
814 TAny* iReservedPtr_2; |
|
815 }; |
|
816 |
|
817 #endif // of NSSSISPEECHRECOGNITIONUTILITY_H |
|
818 |
|
819 // End of File |
|