|
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 __SPEECHRECOGNITIONDATACLIENT_H__ |
|
17 #define __SPEECHRECOGNITIONDATACLIENT_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <s32strm.h> |
|
21 |
|
22 // INCLUDES |
|
23 #include <mmf/common/mmfcontrollerframework.h> |
|
24 #include <mmf/common/speechrecognitiondatacommon.h> |
|
25 |
|
26 |
|
27 // FORWARD DECLARATION |
|
28 class TDiagnostic; |
|
29 |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 @publishedAll |
|
35 @released |
|
36 |
|
37 Class to encapsulate a client recognition result. |
|
38 The result is formulated for client consumption. |
|
39 |
|
40 @since 8.0 |
|
41 */ |
|
42 class CSDClientResult : public CBase |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 /** |
|
46 Destructor. |
|
47 */ |
|
48 IMPORT_C ~CSDClientResult(); |
|
49 |
|
50 /** |
|
51 Two-phased constructor. Creates an uninitialised recognition result. |
|
52 |
|
53 Can leave with one of the system-wide error codes |
|
54 |
|
55 @return CSDClientResult object |
|
56 */ |
|
57 IMPORT_C static CSDClientResult* NewL(); |
|
58 |
|
59 /** |
|
60 Two-phased constructor. Creates an uninitialised recognition result. A copy of the newly created class |
|
61 is pushed onto the cleanup stack. |
|
62 |
|
63 Can leave with one of the system-wide error codes. |
|
64 |
|
65 @return CSDClientResult object |
|
66 */ |
|
67 IMPORT_C static CSDClientResult* NewLC(); |
|
68 |
|
69 /** |
|
70 Two-phased constructor. Creates a result with a grammar and rule ID. |
|
71 |
|
72 Can leave with one of the system-wide error codes. |
|
73 |
|
74 @param aGrammarID |
|
75 The grammar ID of the result. |
|
76 @param aRuleID |
|
77 The rule ID of the result. |
|
78 |
|
79 @return CSDClientResult object. |
|
80 */ |
|
81 IMPORT_C static CSDClientResult* NewL(TGrammarID aGrammarID, TRuleID aRuleID); |
|
82 |
|
83 /** |
|
84 Two-phased constructor. Creates a result with a grammar and rule ID. A copy of the newly created class |
|
85 is pushed onto the cleanup stack. |
|
86 |
|
87 Can leave with one of the system-wide error codes. |
|
88 |
|
89 @param aGrammarID |
|
90 The grammar ID of the result |
|
91 @param aRuleID |
|
92 The rule ID of the result |
|
93 |
|
94 @return CSDClientResult object. |
|
95 */ |
|
96 IMPORT_C static CSDClientResult* NewLC(TGrammarID aGrammarID, TRuleID aRuleID); |
|
97 |
|
98 /** |
|
99 Sets the grammar ID on the result. |
|
100 |
|
101 @param aGrammarID |
|
102 The grammar identifier. |
|
103 |
|
104 @since 8.0 |
|
105 */ |
|
106 IMPORT_C void SetGrammarID(TGrammarID aGrammarID); |
|
107 |
|
108 /** |
|
109 Retrieves the grammar ID of the result. |
|
110 |
|
111 @return Grammar identifier. |
|
112 @since 8.0 |
|
113 */ |
|
114 IMPORT_C TGrammarID GrammarID() const; |
|
115 |
|
116 /** |
|
117 Sets the rule ID of the result. |
|
118 |
|
119 @param aRuleID |
|
120 The rule identifier. |
|
121 |
|
122 @since 8.0 |
|
123 */ |
|
124 IMPORT_C void SetRuleID(TRuleID aRuleID); |
|
125 |
|
126 /** |
|
127 Returns the rule ID of the result. |
|
128 |
|
129 @return The rule identifier. |
|
130 @since 8.0 |
|
131 */ |
|
132 IMPORT_C TRuleID RuleID() const; |
|
133 |
|
134 /** |
|
135 @internalTechnology |
|
136 |
|
137 Writes the class to a stream. |
|
138 |
|
139 @param aStream |
|
140 A RWriteStream to write the class to. |
|
141 |
|
142 @since 8.0 |
|
143 */ |
|
144 void ExternalizeL(RWriteStream& aStream) const; |
|
145 /** |
|
146 @internalTechnology |
|
147 |
|
148 Reads the class from a stream. |
|
149 |
|
150 @param aStream |
|
151 A RReadStream to read from. |
|
152 |
|
153 @since 8.0 |
|
154 */ |
|
155 void InternalizeL(RReadStream& aStream); |
|
156 |
|
157 private: |
|
158 void ConstructL(); |
|
159 CSDClientResult(); |
|
160 CSDClientResult(TGrammarID aGrammarID, TRuleID aRuleID); |
|
161 |
|
162 |
|
163 private: |
|
164 TGrammarID iGrammarID; |
|
165 TRuleID iRuleID; |
|
166 }; |
|
167 |
|
168 |
|
169 /** |
|
170 @publishedAll |
|
171 @released |
|
172 |
|
173 Class to encapsulate a client recogntion result set |
|
174 This is a lightweight result set formulated for client consumption |
|
175 |
|
176 @since 8.0 |
|
177 */ |
|
178 class CSDClientResultSet : public CBase |
|
179 { |
|
180 public: // Constructors and destructor |
|
181 /** |
|
182 Destructor. |
|
183 */ |
|
184 IMPORT_C ~CSDClientResultSet(); |
|
185 |
|
186 /** |
|
187 Two-phased constructor. |
|
188 |
|
189 @return CSDClientResultSet object. |
|
190 */ |
|
191 IMPORT_C static CSDClientResultSet* NewL(); |
|
192 |
|
193 /** |
|
194 Two-phased constructor. Pushes the newly created object onto the cleanup stack |
|
195 |
|
196 @return CSDClientResultSet object. |
|
197 */ |
|
198 IMPORT_C static CSDClientResultSet* NewLC(); |
|
199 |
|
200 |
|
201 /** |
|
202 Sets the maximum number of best matches (N-best) expected in the recognition result after |
|
203 recognition. |
|
204 |
|
205 @param aMaxResults |
|
206 The maximum number of matches expected in the recognition result. |
|
207 |
|
208 @since 8.0 |
|
209 */ |
|
210 IMPORT_C void SetMaxResultsL(TInt aMaxResults); |
|
211 |
|
212 /** |
|
213 Returns the current value of the max number of expected after recognition. |
|
214 |
|
215 @return The maximum number of best matches (N-best) expected in the recognition result. |
|
216 |
|
217 @since 8.0 |
|
218 */ |
|
219 IMPORT_C TInt MaxResults() const; |
|
220 |
|
221 /** |
|
222 Returns a result at a given index within the result set. |
|
223 |
|
224 @param aIndex |
|
225 The index of result to return. |
|
226 |
|
227 @return A pointer to CSDClientResult object. |
|
228 |
|
229 @since 8.0 |
|
230 */ |
|
231 IMPORT_C const CSDClientResult& At(TInt aIndex) const; |
|
232 |
|
233 /** |
|
234 Sets the number of results actually returned after recogntion. |
|
235 |
|
236 @param aResultCount |
|
237 The number of results returned by the recognizer. |
|
238 |
|
239 @since 8.0 |
|
240 */ |
|
241 IMPORT_C void SetResultCount(TInt aResultCount); |
|
242 |
|
243 /** |
|
244 Returns the number of results actually returned after recogntion. |
|
245 |
|
246 @return The number of results actually returned after recogntion. |
|
247 |
|
248 @since 8.0 |
|
249 */ |
|
250 IMPORT_C TInt ResultCount() const; |
|
251 |
|
252 /** |
|
253 Sets the diagnostic of this result set. |
|
254 |
|
255 @param aDiagnostic |
|
256 The reference to the diagostic object. |
|
257 |
|
258 @since 8.0 |
|
259 */ |
|
260 IMPORT_C void SetDiagnostic(TDiagnostic& aDiagnostic); |
|
261 |
|
262 /** |
|
263 Gets the diagnostic of this result set. |
|
264 |
|
265 @return A reference to TDiagnostic object. |
|
266 |
|
267 @since 8.0 |
|
268 */ |
|
269 IMPORT_C const TDiagnostic& Diagnostic() const; |
|
270 |
|
271 |
|
272 /** |
|
273 Writes the state of the class to a stream. |
|
274 |
|
275 @param aStream |
|
276 The stream to write to. |
|
277 |
|
278 @since 8.0 |
|
279 */ |
|
280 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
281 |
|
282 /** |
|
283 Restores the state of the object from a stream. |
|
284 |
|
285 @param aStream |
|
286 The stream to read from. |
|
287 |
|
288 @since 8.0 |
|
289 */ |
|
290 IMPORT_C void InternalizeL(RReadStream& aStream); |
|
291 |
|
292 private: |
|
293 void ConstructL(); |
|
294 CSDClientResultSet(); |
|
295 |
|
296 private: |
|
297 TInt iMaxResults; // maximum number of results |
|
298 TInt iResultCount; // number of recognition results |
|
299 RPointerArray<CSDClientResult> iResultArray; // array of recognition results |
|
300 TDiagnostic* iDiagnostic; // diagnostic information |
|
301 }; |
|
302 |
|
303 #endif // __SPEECHRECOGNITIONDATACLIENT_H__ |
|
304 |