|
1 /* |
|
2 * Copyright (c) 2004 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: Presence attribute model interface & related definitions. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MPENGPRESENCEATTRMODEL2_H |
|
19 #define __MPENGPRESENCEATTRMODEL2_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Std.h> |
|
23 #include <PEngPresenceEngineConsts2.h> |
|
24 |
|
25 |
|
26 |
|
27 //FORWARD DECLARATIONS |
|
28 class MPEngAttrModelExtension2; |
|
29 class MPEngPresenceAdvancedAttrModel2; |
|
30 class MPEngPresenceAttrTypeProperties2; |
|
31 |
|
32 |
|
33 |
|
34 // DATA DECLARATION |
|
35 /** |
|
36 * Attribute model data source. |
|
37 * |
|
38 * Attribute model data source identifies source |
|
39 * of the currently handled attribute model data. |
|
40 * |
|
41 * @since 3.0 |
|
42 */ |
|
43 enum TPEngAttrDataSource |
|
44 { |
|
45 /** |
|
46 * Presence attribute data is committed to network. |
|
47 */ |
|
48 EPEngAttrNetwork = 1, |
|
49 |
|
50 |
|
51 /** |
|
52 * Presence attribute data is locally edited. |
|
53 */ |
|
54 EPEngAttrLocalEdited, |
|
55 |
|
56 /** |
|
57 * Data is local default. |
|
58 * Attribute has it attribute type specific default values. |
|
59 */ |
|
60 EPEngAttrLocalDefault |
|
61 }; |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 /** |
|
67 * Default group value for simple |
|
68 * structured presence attributes. |
|
69 * |
|
70 * @since 3.0 |
|
71 */ |
|
72 const TInt KPEngDefaultAttrValueGroup = -1; |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 // CLASS DECLARATION |
|
78 |
|
79 /** |
|
80 * Abstract interface for Presence Attribute models. |
|
81 * |
|
82 * Presence Attribute present Presence Attribute data. |
|
83 * Attribute model interface defines uniform way to |
|
84 * access and edit presence attributes. |
|
85 * |
|
86 * Each concrete attribute type supports just certain, |
|
87 * most suitable, data set and get methods. |
|
88 * |
|
89 * @since 3.0 |
|
90 */ |
|
91 class MPEngPresenceAttrModel2 |
|
92 { |
|
93 public: //Attribute type details |
|
94 |
|
95 /** |
|
96 * Attribute type ID. |
|
97 * |
|
98 * Returns ID identifying type of handled attribute model. |
|
99 * See attribute type documentation for information |
|
100 * about available attributes. |
|
101 * |
|
102 * Attribute type identifies the presence data hold in |
|
103 * the handled attribute model. Each concrete attribute |
|
104 * type has its own data semantics that has to be known |
|
105 * before using the attribute model. |
|
106 * |
|
107 * Presence Engine known attribute types are listed |
|
108 * in PEngWVPresenceAttributes2.h. Currently supported |
|
109 * types are: |
|
110 * - KUidPrAttrOnlineStatus |
|
111 * - KUidPrAttrClientInfo |
|
112 * - KUidPrAttrCommCap |
|
113 * - KUidPrAttrUserAvailability |
|
114 * - KUidPrAttrStatusText |
|
115 * - KUidPrAttrStatusContent (former KUidPrAttrMyLogoStatusContent) |
|
116 * - KUidPrAttrMyLogoThumbnail |
|
117 * - KUidPrAttrInfoLink |
|
118 * - KUidPrAttrAlias |
|
119 * |
|
120 * @since 3.0 |
|
121 * @return Attribute model type ID. |
|
122 */ |
|
123 virtual TUint32 Type() const = 0; |
|
124 |
|
125 |
|
126 /** |
|
127 * Attribute type properties. |
|
128 * |
|
129 * Returns abstract interface which can be used to |
|
130 * query different attribute type specific |
|
131 * properties like attribute type XML name etc. |
|
132 * |
|
133 * Lifetime of the returned property interface |
|
134 * is guaranteed to be valid only as long as |
|
135 * the attribute model. Property object |
|
136 * ownership is kept on attribute model. |
|
137 * |
|
138 * @since 3.0 |
|
139 * @return The attribute type properties. |
|
140 */ |
|
141 virtual const MPEngPresenceAttrTypeProperties2& TypeProperties() const = 0; |
|
142 |
|
143 |
|
144 |
|
145 /** |
|
146 * Makes a new deep copy from attribute model object. |
|
147 * |
|
148 * Returns new object ownership to caller. |
|
149 * Returned object can be only read. |
|
150 * @since 3.0 |
|
151 */ |
|
152 virtual MPEngPresenceAttrModel2* CloneLC() const = 0; |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 public: //Attribute instance details |
|
158 |
|
159 /** |
|
160 * Gets the attribute owners presence ID. |
|
161 * |
|
162 * @since 3.0 |
|
163 * @return Attribute owner presence ID. For user own |
|
164 * attributes, method returns empty string. |
|
165 * (KPEngUserOwnPresenceId from PEngPresenceEngineConsts2.h) |
|
166 */ |
|
167 virtual const TDesC& PresenceID() const = 0; |
|
168 |
|
169 |
|
170 /** |
|
171 * Attribute current data source. |
|
172 * |
|
173 * @since 3.0 |
|
174 * @return Enumeration specifying attribute data source. |
|
175 */ |
|
176 virtual TPEngAttrDataSource DataSource() const = 0; |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 public: //Attribute data getters |
|
182 |
|
183 |
|
184 /** |
|
185 * Attribute qualifier. |
|
186 * |
|
187 * @since 3.0 |
|
188 * @return A TBool indicating attribute qualification. |
|
189 * ETrue if the attribute qualifier is TRUE. |
|
190 * EFalse if the attribute qualifier is FALSE. |
|
191 */ |
|
192 virtual TBool Qualifier() const = 0; |
|
193 |
|
194 |
|
195 |
|
196 /** |
|
197 * Gets integer or 8/16 bit descriptor value. |
|
198 * - Integer values are usually attribute type |
|
199 * specific enumerations. |
|
200 * - 8 bit descriptor values are attribute type specific |
|
201 * data buffers or similar objects. |
|
202 * - 16 bit descriptor values are usually a screen texts. |
|
203 * |
|
204 * |
|
205 * Common error handling: |
|
206 * 1. Attribute type doesn't support given scope (field/group): |
|
207 * - debug build: panic, |
|
208 * - release build: return KErrNotSupported / empty descriptor |
|
209 * |
|
210 * 2. Attribute type doesn't support getting specified type: |
|
211 * - debug build: panic |
|
212 * - release build: return KErrNotSupported / empty descriptor |
|
213 * |
|
214 * @since 3.0 |
|
215 * @param aField The field of the attribute value. |
|
216 * @param aGroup The group of individual attribute field. |
|
217 * @return The integer or 8/16 bit descriptor data. |
|
218 */ |
|
219 virtual TInt DataInt( |
|
220 TInt aField, |
|
221 TInt aGroup = KPEngDefaultAttrValueGroup ) const = 0; |
|
222 |
|
223 virtual const TPtrC8 DataDesC8( |
|
224 TInt aField, |
|
225 TInt aGroup = KPEngDefaultAttrValueGroup ) const = 0; |
|
226 |
|
227 virtual const TPtrC16 DataDesC16( |
|
228 TInt aField, |
|
229 TInt aGroup = KPEngDefaultAttrValueGroup ) const = 0; |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 public: //Attribute data mutators |
|
237 |
|
238 |
|
239 /** |
|
240 * Sets attribute qualifier. |
|
241 * |
|
242 * Basicly most of time the attribute qualifier should |
|
243 * remain set to true. |
|
244 * |
|
245 * NOTE!! Successful setting the attribute data from |
|
246 * client side causes automaticly the qualifier to be set |
|
247 * to true. |
|
248 * |
|
249 * @since 3.0 |
|
250 * @param aQualifier A TBool indicating attribute qualification. |
|
251 * If ETrue, then the attribute qualifier is set to TRUE. |
|
252 * If EFalse, then the attribute qualifier is set to FALSE. |
|
253 */ |
|
254 virtual void SetQualifier( TBool aQualifier ) = 0; |
|
255 |
|
256 |
|
257 |
|
258 /** |
|
259 * Sets integer or 8/16 bit descriptor value. |
|
260 * - Integer values are usually attribute type |
|
261 * specific enumerations. |
|
262 * - 8 bit descriptor values are attribute type specific |
|
263 * data buffers or similar objects. |
|
264 * - 16 bit descriptor values are usually a screen texts. |
|
265 * |
|
266 * If value set operation succeeds, sets also the |
|
267 * attribute qualifier to TRUE. |
|
268 * |
|
269 * Common error handling: |
|
270 * 1. Attribute type doesn't support given scope (field/group): |
|
271 * - debug build: panic |
|
272 * - release build: leave KErrNotSupported |
|
273 * |
|
274 * 2. Attribute type doesn't support given integer value, |
|
275 * or descriptor value is out of attribute type specific bounds: |
|
276 * - debug build: panic |
|
277 * - release build: leave KErrArgument |
|
278 * |
|
279 * 3. Attribute type doesn't support setting specified type: |
|
280 * - debug build: panic |
|
281 * - release build: leave KErrNotSupported |
|
282 * |
|
283 * 4. Concrete attribute might do also other checks and |
|
284 * conversions for the data. If these fail, data set |
|
285 * operation fails and leaves with error code coming from |
|
286 * concrete attribute implementation. |
|
287 * |
|
288 * @since 3.0 |
|
289 * @param aData The new integer or 8/16 bit descriptor data. |
|
290 * @param aField The field of the attribute value. |
|
291 * @param aGroup The group of individual attribute field. |
|
292 */ |
|
293 virtual void SetDataIntL( |
|
294 TInt aData, |
|
295 TInt aField, |
|
296 TInt aGroup = KPEngDefaultAttrValueGroup ) = 0; |
|
297 |
|
298 virtual void SetDataDesC8L( |
|
299 const TDesC8& aData, |
|
300 TInt aField, |
|
301 TInt aGroup = KPEngDefaultAttrValueGroup ) = 0; |
|
302 |
|
303 virtual void SetDataDesC16L( |
|
304 const TDesC16& aData, |
|
305 TInt aField, |
|
306 TInt aGroup = KPEngDefaultAttrValueGroup ) = 0; |
|
307 |
|
308 |
|
309 /** |
|
310 * Sets 8/16 bit descriptor value with asynchronous processing. |
|
311 * |
|
312 * Sets 8/16 bit descriptor value and performs asynchronous |
|
313 * processing for validating or converting the value. |
|
314 * |
|
315 * If value set operation succeeds, sets also the |
|
316 * attribute qualifier to TRUE. |
|
317 * |
|
318 * If attribute has several asynchronously set data |
|
319 * fields, only one set operation is suppoted at time. |
|
320 * |
|
321 * Common error handling: |
|
322 * 1. Attribute type doesn't support given scope (field/group): |
|
323 * - debug build: panic |
|
324 * - release build: leave KErrNotSupported |
|
325 * |
|
326 * 2. Attribute type doesn't support setting specified data type |
|
327 * asynchronously: |
|
328 * - debug build: panic |
|
329 * - release build: leave KErrNotSupported |
|
330 * |
|
331 * 3. Asynchronous processing starting fails: |
|
332 * - leaves with error codes coming from concrete implementation. |
|
333 * |
|
334 * |
|
335 * @since 3.0 |
|
336 * @param aData The 8/16 bit descriptor data. |
|
337 * @param aRequestStatus Asynchronous completion code. |
|
338 * The attribute model sets the passed request status to |
|
339 * KRequestPending state if asynchronous processing is started. |
|
340 * When asynchronous processing completes, successfully or otherwise, |
|
341 * the end status is returned in aRequestStatus. |
|
342 * - KErrNone if processing was successful. In this case |
|
343 * attribute qualifier is set to ETrue. |
|
344 * - Else an attribute type specific error code or |
|
345 * one of the system-wide error codes. |
|
346 * |
|
347 * @param aField The field of the attribute value. |
|
348 * @param aGroup The group of individual attribute field. |
|
349 */ |
|
350 virtual void SetDataDesC8AsyncL( |
|
351 const TDesC8& aData, |
|
352 TRequestStatus& aRequestStatus, |
|
353 TInt aField, |
|
354 TInt aGroup = KPEngDefaultAttrValueGroup ) = 0; |
|
355 |
|
356 virtual void SetDataDesC16AsyncL( |
|
357 const TDesC16& aData, |
|
358 TRequestStatus& aRequestStatus, |
|
359 TInt aField, |
|
360 TInt aGroup = KPEngDefaultAttrValueGroup ) = 0; |
|
361 |
|
362 |
|
363 /** |
|
364 * Cancels previously issued asynchronous set processing. |
|
365 * |
|
366 * Attribute value state after cancelling depends from |
|
367 * concrete attribute type. |
|
368 * |
|
369 * @since 3.0 |
|
370 */ |
|
371 virtual void CancelSetDataAsync() = 0; |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 private: //Extensions interfaces |
|
378 |
|
379 |
|
380 /** |
|
381 * Generic attribute model extension interface. |
|
382 * |
|
383 * @since 3.0 |
|
384 * @return Attribute model extension. |
|
385 */ |
|
386 virtual const MPEngAttrModelExtension2* Extension() const = 0; |
|
387 virtual MPEngAttrModelExtension2* Extension() = 0; |
|
388 |
|
389 |
|
390 |
|
391 /** |
|
392 * Attribute model type specific extension. |
|
393 * |
|
394 * @since 3.0 |
|
395 * @return Attribute type specific extension. |
|
396 */ |
|
397 virtual TAny* TypeExtension( TUint32 aType ) = 0; |
|
398 |
|
399 |
|
400 |
|
401 public: //Presence Engine internal interface access |
|
402 |
|
403 /** |
|
404 * Presence Engine internal attribute model interface. |
|
405 * |
|
406 * @since 3.0 |
|
407 * @return Attribute model internal interface. |
|
408 */ |
|
409 virtual const MPEngPresenceAdvancedAttrModel2* Advanced() const = 0; |
|
410 virtual MPEngPresenceAdvancedAttrModel2* Advanced() = 0; |
|
411 |
|
412 |
|
413 |
|
414 public: //Cleanup support & destructor |
|
415 |
|
416 /** |
|
417 * Support for attribute model cleanup. |
|
418 * |
|
419 * When this method is called, concrete |
|
420 * attribute object is deleted and all |
|
421 * it runtime resources are freed. |
|
422 * ==> Attribute models can be pushed on the |
|
423 * CleanupStack using CleanupClosePushL(). |
|
424 * |
|
425 * @since 3.0 |
|
426 */ |
|
427 virtual void Close() = 0; |
|
428 |
|
429 |
|
430 /** |
|
431 * Inline virtual destructor. Concrete |
|
432 * attribute objects can be deleted through |
|
433 * this interface. |
|
434 * |
|
435 * Deleting cancels possibly active |
|
436 * asynchronous processing operations. |
|
437 * |
|
438 * @since 3.0 |
|
439 */ |
|
440 virtual ~MPEngPresenceAttrModel2() {}; |
|
441 |
|
442 }; |
|
443 |
|
444 |
|
445 #endif // __MPENGPRESENCEATTRMODEL2_H |
|
446 |
|
447 |
|
448 |
|
449 // End of File |
|
450 |
|
451 |