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