|
1 /* |
|
2 * Copyright (c) 2002-2006 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: CNssTagMgr implements the MNssTagMgr interface. In addition, it also provides |
|
15 * methods for internal use by VAS components. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef NSSVASCTAGMGR_H |
|
21 #define NSSVASCTAGMGR_H |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include "nssvasmtagmgr.h" |
|
26 #include "nssvasmgettagclient.h" |
|
27 #include "nssvasmdeletetagclient.h" |
|
28 #include "nssvasmsavetagclient.h" |
|
29 #include "nssvasmintercomptagmgrclient.h" |
|
30 #include "nssvasmcoresrsdbeventhandler.h" |
|
31 #include "nssvasmvasdatabaseclient.h" |
|
32 #include "nssvascoreconstant.h" |
|
33 #include "nssvasmtagreference.h" |
|
34 #include "nssvasmgettagreferenceclient.h" |
|
35 #include "nssvasmcoresyncrecoveryhandler.h" |
|
36 #include "nssvascvasdbdataexchanger.h" |
|
37 |
|
38 // FORWARD DECLARATION |
|
39 class CNssSpeechItemBuilder; |
|
40 class CNssContextMgr; |
|
41 class CNssTag; |
|
42 class CNssVASDatabase; |
|
43 |
|
44 // CLASS DECLARATIONS |
|
45 /** |
|
46 * CNssTagMgr implements the MNssTagMgr interface for tag management services. |
|
47 * @lib NssVASApi.lib |
|
48 * @since 2.8 |
|
49 */ |
|
50 class CNssTagMgr: |
|
51 public CActive, |
|
52 public MNssTagMgr, |
|
53 public MNssCoreSrsDBEventHandler, |
|
54 public MNssVASDatabaseClient |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * destructor |
|
60 */ |
|
61 ~CNssTagMgr(); |
|
62 |
|
63 /** |
|
64 * 2 phase constructor |
|
65 * @param aVasDatabase - pointer to the VAS Database |
|
66 * @param aContextManager - pointer to the context manager |
|
67 * @return pointer the created tag manager |
|
68 */ |
|
69 static CNssTagMgr* NewL(CNssVASDatabase* aVasDatabase, CNssContextMgr *aContextManager); |
|
70 |
|
71 /** |
|
72 * 2 phase constructor |
|
73 * @param aVasDatabase - pointer to the VAS Database |
|
74 * @param aContextManager - pointer to the context manager |
|
75 * @return pointer the created tag manager |
|
76 */ |
|
77 static CNssTagMgr* NewLC(CNssVASDatabase* aVasDatabase, CNssContextMgr *aContextManager); |
|
78 |
|
79 /** |
|
80 * Creates a new tag |
|
81 * @since 2.0 |
|
82 * @param aContext - pointer to context |
|
83 * @return newly created tag |
|
84 */ |
|
85 MNssTag* CreateTagL(MNssContext* aContext); |
|
86 |
|
87 /** |
|
88 * gets tag list, implementation of interface MNssTagMgr |
|
89 * @since 2.0 |
|
90 * @param aTagClient - call back address |
|
91 * @param aContext - context for which to get tags |
|
92 * @return synchronous error codes |
|
93 */ |
|
94 TInt GetTagList(MNssGetTagClient* aTagClient,MNssContext* aContext); |
|
95 |
|
96 /** |
|
97 * gets tag list, implementation of interface MNssTagMgr |
|
98 * @since 2.0 |
|
99 * @param aTagClient - call back address |
|
100 * @param aName - name for which to get tags |
|
101 * @return synchronous error codes |
|
102 */ |
|
103 TInt GetTagList(MNssGetTagClient* aTagClient, MNssContext* aContext, const TDesC& aName); |
|
104 |
|
105 |
|
106 /** |
|
107 * delete tag, implementation of interface MNssTagMgr |
|
108 * @since 2.0 |
|
109 * @param aTagClient - call back address |
|
110 * @param aTag - tag to delete |
|
111 * @return synchronous error codes |
|
112 */ |
|
113 TInt DeleteTag(MNssDeleteTagClient* aTagClient,MNssTag* aTag); |
|
114 |
|
115 /** |
|
116 * save tag, implementation of interface MNssTagMgr |
|
117 * @since 2.0 |
|
118 * @param aTagClient - call back address |
|
119 * @param aTag - tag to save |
|
120 * @return synchronous error codes |
|
121 */ |
|
122 TInt SaveTag(MNssSaveTagClient* aTagClient,MNssTag* aTag); |
|
123 |
|
124 /** |
|
125 * get a tag based on grammar id and rule id. |
|
126 * for use by VAS components, call back returns a list with one element. |
|
127 * @since 2.0 |
|
128 * @param aTagClient - call back address |
|
129 * @param aGrammarId - grammar id |
|
130 * @param aRuleId - rule id |
|
131 * @return synchronous error codes |
|
132 */ |
|
133 CNssTag* GetTag( TUint32 aGrammarId, TUint32 aRuleId ); |
|
134 |
|
135 /** |
|
136 * get tags based on their grammar id and rule id. |
|
137 * for use by VAS components, call back returns a list with one element. |
|
138 * @param aGrammarIdRuleIds array of grammarid-ruleid pairs |
|
139 * return array list. It is to be destroyed by the client |
|
140 */ |
|
141 MNssTagListArray* GetTags( TNssGrammarIdRuleIdListArray& aGrammarIdRuleIds); |
|
142 |
|
143 |
|
144 /** |
|
145 * call back implementation from MNssVASDatabaseClient |
|
146 * @since 2.0 |
|
147 * @param aContextList - list of contexts (not used in tag manager) |
|
148 * @param aTagList - list of tags |
|
149 * @param aCode - error code if failed |
|
150 * @return |
|
151 */ |
|
152 void VASDatabaseComplete( CArrayPtrFlat<CNssContext>* aContextList, |
|
153 CArrayPtrFlat<CNssTag>* aTagList, |
|
154 CArrayPtrFlat<CNssTagReference>* aTagRefList, |
|
155 MNssVASDatabaseClient::TNssVASDBClientReturnCode aCode); |
|
156 |
|
157 |
|
158 /** |
|
159 * call back implementation from MNssCoreSrsDBEventHandler |
|
160 * @since 2.0 |
|
161 * @param |
|
162 * @return |
|
163 */ |
|
164 void HandleSaveSrsDBCompleted(); |
|
165 |
|
166 /** |
|
167 * call back implementation from MNssCoreSrsDBEventHandler |
|
168 * @since 2.0 |
|
169 * @param |
|
170 * @return |
|
171 */ |
|
172 void HandleDeleteSrsDBCompleted(); |
|
173 |
|
174 /** |
|
175 * Call back function from SRS DB, through interface MNssCoreSrsDBEventHandler |
|
176 * Called after deleting from SRS DB is successful |
|
177 * @since 2.8 |
|
178 * @param |
|
179 * @return |
|
180 */ |
|
181 void HandleResetSrsDBCompleted(); |
|
182 |
|
183 /** |
|
184 * call back implementation from MNssCoreSrsDBEventHandler |
|
185 * @since 2.0 |
|
186 * @param |
|
187 * @return |
|
188 */ |
|
189 void HandleSrsDBError(MNssCoreSrsDBEventHandler::TNssSrsDBResult aResult); |
|
190 |
|
191 /** |
|
192 * utility function for CNssTag List to MNssTag List conversion, and call back to client |
|
193 * @since 2.0 |
|
194 * @param aSourceList - CNssTag List |
|
195 * @return |
|
196 */ |
|
197 void CNssTagListToMNssTagListConvertorL(CArrayPtrFlat<CNssTag>* aSourceList); |
|
198 |
|
199 /** |
|
200 * Cancel get tag, for use by inter component clients only, not provided for |
|
201 * external clients. |
|
202 * @since 2.0 |
|
203 * @param none |
|
204 * @return none |
|
205 */ |
|
206 void CancelGetTag(); |
|
207 |
|
208 /** |
|
209 * gets a tagCount, implementation of interface MNssTagMgr |
|
210 * @since 2.0 |
|
211 * @param aContext - context for which to get tag count. |
|
212 * @return synchronous error codes or tagCount |
|
213 */ |
|
214 TInt TagCount(MNssContext* aContext); |
|
215 |
|
216 /** |
|
217 * get the tag(s) based on partial rrd int data and position |
|
218 * @since 2.0 |
|
219 * @param aTInt - the rrd int value. |
|
220 * @param aPosition - the position of the int value in rrd int array |
|
221 * @return synchronous error codes or tagCount |
|
222 */ |
|
223 |
|
224 TInt GetTagList(MNssGetTagClient* aTagClient,MNssContext* aContext,TInt aNum,TInt aPosition); |
|
225 /** |
|
226 * get the tag(s) based on partial rrd text data and position |
|
227 * @since 2.0 |
|
228 * @param aTInt - the rrd text value. |
|
229 * @param aPosition - the position of the int value in rrd int array |
|
230 * @return synchronous error codes or tagCount |
|
231 */ |
|
232 |
|
233 TInt GetTagList(MNssGetTagClient* aTagClient,MNssContext* aContext,TDesC& aText,TInt aPosition); |
|
234 /** |
|
235 * Get a list of tag references based on context. |
|
236 * @since 2.0 |
|
237 * @param aTagReferenceClient - call back address |
|
238 * @param aContext - a context |
|
239 * @return asynchronous return error code |
|
240 */ |
|
241 TInt GetTagReferenceList(MNssGetTagReferenceClient* aTagRefClient,MNssContext* aContext); |
|
242 /** |
|
243 * Get a tag based on tagreference. |
|
244 * @since 2.0 |
|
245 * @param aTagClient - call back address |
|
246 * @param aTagReference - a tagreferenc |
|
247 * @return asynchronous return error code |
|
248 */ |
|
249 TInt GetTag(MNssGetTagClient* aTagClient,MNssTagReference* aTagReference); |
|
250 |
|
251 void CNssTagRefListToMNssTagRefListConvertorL(CArrayPtrFlat<CNssTagReference>* aSourceList); |
|
252 |
|
253 /********************** ACTIVE OBJECT *******************/ |
|
254 TInt RunError( TInt aError ); |
|
255 void RunL(); |
|
256 void DoCancel(); |
|
257 |
|
258 private: |
|
259 |
|
260 enum TCallBackState |
|
261 { |
|
262 ENone, |
|
263 EGetTagClient, |
|
264 EDeleteTagClient, |
|
265 ESaveTagClient, |
|
266 EInterCompTagMgrClient, |
|
267 EGetTagReferenceClient |
|
268 }; |
|
269 |
|
270 /** |
|
271 * C++ constructor |
|
272 * @param |
|
273 * @return |
|
274 */ |
|
275 CNssTagMgr(); |
|
276 |
|
277 /** |
|
278 * C++ constructor |
|
279 * @param aVasDatabase - pointer to the VAS Database |
|
280 * @param aContextManager - pointer to the context manager |
|
281 * @return |
|
282 */ |
|
283 CNssTagMgr(CNssVASDatabase* aVasDatabase, CNssContextMgr *aContextManager); |
|
284 |
|
285 /** |
|
286 * EPOC constructor |
|
287 */ |
|
288 void ConstructL(); |
|
289 |
|
290 |
|
291 private: |
|
292 |
|
293 // pointer to the VAS Database |
|
294 CNssVASDatabase* iVasDatabase; |
|
295 |
|
296 // pointer to the speech item builder, tag manager owns this builder |
|
297 CNssSpeechItemBuilder* iSpeechItemBuilder; |
|
298 |
|
299 // pointer to a context manager, association |
|
300 CNssContextMgr* iContextManager; |
|
301 |
|
302 // state of the tag manager |
|
303 TCallBackState iState; |
|
304 |
|
305 // get tag client call back address |
|
306 MNssGetTagClient* iGetTagClient; |
|
307 |
|
308 // delete tag client call back address |
|
309 MNssDeleteTagClient* iDeleteTagClient; |
|
310 |
|
311 // save tag clienat call back address |
|
312 MNssSaveTagClient* iSaveTagClient; |
|
313 |
|
314 // internal VAS components as clients, call back address |
|
315 MNssInterCompTagMgrClient* iInterCompTagMgrClient; |
|
316 |
|
317 // local pointer to tag, for error handling |
|
318 CNssTag* iLocalTag; |
|
319 |
|
320 // local pointer to speech item, for error handling |
|
321 CNssSpeechItem* iLocalSpeechItem; |
|
322 |
|
323 // for error handling |
|
324 TBool iRecovery; |
|
325 |
|
326 // get tag reference client call back address |
|
327 MNssGetTagReferenceClient* iGetTagReferenceClient; |
|
328 |
|
329 // Tag array for GetTag[List] |
|
330 CArrayPtrFlat<MNssTag>* iTagList; |
|
331 |
|
332 // Tag array for GetTagReferenceList |
|
333 CArrayPtrFlat<MNssTagReference>* iTagRefList; |
|
334 }; |
|
335 |
|
336 #endif // NSSVASCTAGMGR_H |
|
337 |
|
338 // End of file |