|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * WV Services tree data structures for Service Negotiation. |
|
16 * TImpsServices and TImpsFeature. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef CImpsServices_H |
|
22 #define CImpsServices_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include "impsconst.h" |
|
27 |
|
28 |
|
29 // *** FUNCTIONS *** |
|
30 |
|
31 // Fundamental functions |
|
32 const TInt KImpsServiceFunc = 0x0001; |
|
33 const TInt KImpsSearchFunc = 0x0002; |
|
34 const TInt KImpsInviteFunc = 0x0004; |
|
35 |
|
36 // Presence functions |
|
37 const TInt KImpsContListFunc = 0x0008; |
|
38 const TInt KImpsPresAuthFunc = 0x0010; |
|
39 const TInt KImpsPresDeliverFunc = 0x0020; |
|
40 const TInt KImpsAttListFunc = 0x0040; |
|
41 |
|
42 // IM Functions |
|
43 const TInt KImpsIMSendFunc = 0x0080; |
|
44 const TInt KImpsIMReceiveFunc = 0x0100; |
|
45 const TInt KImpsIMAuthFunc = 0x0200; |
|
46 |
|
47 // Group functions |
|
48 const TInt KImpsGroupMgmtFunc = 0x0400; |
|
49 const TInt KImpsGroupUseFunc = 0x0800; |
|
50 const TInt KImpsGroupAuthFunc = 0x1000; |
|
51 |
|
52 // Service value bitmap flags |
|
53 // Use plus operation or method SetThisFlag to build a set of methods and |
|
54 // bit mask or method IsThisFlagSet to check if a single method is supported. |
|
55 |
|
56 const TInt KImpsServiceNone = 0x0000; |
|
57 const TInt KAllFuncs = 0xFFFFFFFF; |
|
58 |
|
59 // *** CAPABILITIES *** |
|
60 // Named also sub-functions or elements in CSP definition |
|
61 |
|
62 // Fundamental capability flags |
|
63 const TInt KImpsServiceGETSPI = 0x0001; |
|
64 const TInt KImpsServiceSRCH = 0x0002; |
|
65 const TInt KImpsServiceSTSRC = 0x0004; |
|
66 const TInt KImpsServiceINVIT = 0x0008; |
|
67 const TInt KImpsServiceCAINV = 0x0010; |
|
68 |
|
69 // Presence capability flags |
|
70 const TInt KImpsServiceGCLI = 0x0001; |
|
71 const TInt KImpsServiceCCLI = 0x0002; |
|
72 const TInt KImpsServiceDCLI = 0x0004; |
|
73 const TInt KImpsServiceMCLS = 0x0008; |
|
74 const TInt KImpsServiceGETWL = 0x0010; |
|
75 const TInt KImpsServiceREACT = 0x0020; |
|
76 const TInt KImpsServiceCAAUT = 0x0040; |
|
77 const TInt KImpsServiceGETPR = 0x0080; |
|
78 const TInt KImpsServiceUPDPR = 0x0100; |
|
79 const TInt KImpsServiceCALI = 0x0200; |
|
80 const TInt KImpsServiceDALI = 0x0400; |
|
81 const TInt KImpsServiceGALS = 0x0800; |
|
82 const TInt KImpsServiceGETAUT = 0x1000; // WV 1.2 |
|
83 |
|
84 // IM capability flags |
|
85 const TInt KImpsServiceMDELIV = 0x0001; |
|
86 const TInt KImpsServiceFWMSG = 0x0002; |
|
87 const TInt KImpsServiceSETD = 0x0004; |
|
88 const TInt KImpsServiceGETLM = 0x0008; |
|
89 const TInt KImpsServiceGETM = 0x0010; |
|
90 const TInt KImpsServiceREJCM = 0x0020; |
|
91 const TInt KImpsServiceNOTIF = 0x0040; |
|
92 const TInt KImpsServiceNEWM = 0x0080; |
|
93 const TInt KImpsServiceGLBLU = 0x0100; |
|
94 const TInt KImpsServiceBLENT = 0x0200; |
|
95 |
|
96 // Group capability flags |
|
97 const TInt KImpsServiceCREAG = 0x0001; |
|
98 const TInt KImpsServiceDELGR = 0x0002; |
|
99 const TInt KImpsServiceGETGP = 0x0004; |
|
100 const TInt KImpsServiceSETGP = 0x0008; |
|
101 const TInt KImpsServiceSUBGCN = 0x0010; |
|
102 const TInt KImpsServiceGRCHN = 0x0020; |
|
103 const TInt KImpsServiceGETGM = 0x0040; |
|
104 const TInt KImpsServiceADDGM = 0x0080; |
|
105 const TInt KImpsServiceRMVGM = 0x0100; |
|
106 const TInt KImpsServiceMBRAC = 0x0200; |
|
107 const TInt KImpsServiceREJEC = 0x0400; |
|
108 |
|
109 |
|
110 const TInt KImpsMaxSapLen = 255; |
|
111 const TInt KImpsMaxUserIdLen = 50; |
|
112 |
|
113 // DATA TYPES |
|
114 enum TImpsFeatures |
|
115 { |
|
116 //Features |
|
117 EFundamentalFeat = 1, |
|
118 EPresenceFeat, |
|
119 EIMFeat, |
|
120 EGroupFeat |
|
121 }; |
|
122 |
|
123 enum TImpsFunctions |
|
124 { |
|
125 //Functions |
|
126 EServiceFunc = KImpsServiceFunc, |
|
127 ESearchFunc = KImpsSearchFunc, |
|
128 EInviteFunc = KImpsInviteFunc , |
|
129 EContListFunc = KImpsContListFunc, |
|
130 EPresenceAuthFunc = KImpsPresAuthFunc, |
|
131 EPresenceDeliverFunc = KImpsPresDeliverFunc, |
|
132 EAttrListFunc = KImpsAttListFunc, |
|
133 EIMSendFunc = KImpsIMSendFunc, |
|
134 EIMReceiveFunc = KImpsIMReceiveFunc, |
|
135 EIMAuthFunc = KImpsIMAuthFunc, |
|
136 EGroupMgmtFunc = KImpsGroupMgmtFunc, |
|
137 EGroupUseFunc = KImpsGroupUseFunc, |
|
138 EGroupAuthFunc = KImpsGroupAuthFunc, |
|
139 EAllFuncs = KAllFuncs |
|
140 }; |
|
141 |
|
142 // General Feature class |
|
143 class TImpsFeature |
|
144 { |
|
145 public: |
|
146 |
|
147 /** |
|
148 * Feature type accessor |
|
149 * @return feature |
|
150 */ |
|
151 inline TImpsFeatures Feature( ) const; |
|
152 |
|
153 /** |
|
154 * Feature type mutator |
|
155 * @return aFeature feature |
|
156 */ |
|
157 void SetFeature( TImpsFeatures aFeature ); |
|
158 |
|
159 /** |
|
160 * Is this element active |
|
161 * @return True if this element exists |
|
162 */ |
|
163 inline TBool IsSupported( ) const; |
|
164 |
|
165 /** |
|
166 * Feature activity mutator |
|
167 * @param aVal True if this element exists |
|
168 */ |
|
169 inline void SetSupported( TBool aVal ); |
|
170 |
|
171 /** |
|
172 * Function accessor |
|
173 * @param aFunc function |
|
174 * @return EImpsTrue if the function exists |
|
175 */ |
|
176 inline TBool Function( TImpsFunctions aFunc ); |
|
177 |
|
178 /** |
|
179 * Function mutator |
|
180 * @param aFunc function |
|
181 * @param aVal new value for the function |
|
182 */ |
|
183 inline void SetFunction( TImpsFunctions aFunc, TBool aVal ); |
|
184 |
|
185 /** |
|
186 * Capability (sub-function) accessor |
|
187 * @param aFunc sub-function(s) |
|
188 * @return True if this element(s) exists |
|
189 */ |
|
190 inline TBool Capability( TInt aFunc ); |
|
191 |
|
192 /** |
|
193 * Capability (sub-function) mutator. |
|
194 * You should set corresponding Function with SetFunction |
|
195 * @param aCapa sub-function(s) |
|
196 * @param aVal sub-function value |
|
197 */ |
|
198 inline void SetCapability( TInt aCapa, TBool aVal ); |
|
199 |
|
200 /** |
|
201 * Reset |
|
202 * Functions and capabilities are cleaned expect if aAll is true. |
|
203 * @param aAll if true then all functions and capabilities are set on. |
|
204 */ |
|
205 IMPORT_C void Reset( TBool aAll = EFalse ); |
|
206 |
|
207 /** |
|
208 * Copy data |
|
209 */ |
|
210 IMPORT_C void Copy( TImpsFeature& aCopy ); |
|
211 |
|
212 private: |
|
213 |
|
214 /** |
|
215 * general bit map flag accessor |
|
216 * @param aValues service values |
|
217 * @prama aFlag single service flag |
|
218 * @return ETrue if the flag is set on |
|
219 */ |
|
220 inline TBool IsThisFlagSet( TInt aValues, TInt aFlag ) const; |
|
221 |
|
222 /** |
|
223 * General bit map flag mutator |
|
224 * @param aValues service values |
|
225 * @parama aFlag single service flag |
|
226 * @param aValue new value for aFlag in aValue |
|
227 */ |
|
228 inline void SetThisFlag( |
|
229 TInt &aValues, |
|
230 TInt aFlag, |
|
231 TBool aValue); |
|
232 |
|
233 private: // Data |
|
234 |
|
235 TImpsFeatures iFeature; |
|
236 TBool iOn; |
|
237 TInt iFunctions; |
|
238 TInt iCapabilities; |
|
239 }; |
|
240 |
|
241 /** |
|
242 * WV Services tree data structure |
|
243 */ |
|
244 class TImpsServices |
|
245 { |
|
246 public: // Constructors and destructor |
|
247 |
|
248 /** |
|
249 * C++ default constructor. |
|
250 */ |
|
251 IMPORT_C TImpsServices(); |
|
252 |
|
253 |
|
254 public: // New functions |
|
255 |
|
256 |
|
257 /** |
|
258 * Reset |
|
259 * Clean everyting expect if aAll is true. |
|
260 * @param aAll if true then all features, |
|
261 * functions and capabilities are set on. |
|
262 */ |
|
263 IMPORT_C void Reset( TBool aAll = EFalse ); |
|
264 |
|
265 /** |
|
266 * Copy data |
|
267 */ |
|
268 IMPORT_C void Copy( TImpsServices& aCopy ); |
|
269 |
|
270 /** |
|
271 * Feature accessor |
|
272 */ |
|
273 IMPORT_C TImpsFeature* Feature( TImpsFeatures aFeature ); |
|
274 |
|
275 private: // Data |
|
276 |
|
277 TImpsFeature iFundamental; |
|
278 TImpsFeature iPresence; |
|
279 TImpsFeature iIM; |
|
280 TImpsFeature iGroup; |
|
281 |
|
282 }; |
|
283 |
|
284 /** |
|
285 * general bit map flag accessor |
|
286 * @param aValues service values |
|
287 * @prama aFlag single service flag |
|
288 * @return ETrue if the flag is set on |
|
289 */ |
|
290 inline TBool TImpsFeature::IsThisFlagSet( TInt aValues, TInt aFlag ) const |
|
291 { |
|
292 return ( aValues & aFlag ? ETrue : EFalse ); |
|
293 } |
|
294 |
|
295 /** |
|
296 * General bit map flag mutator |
|
297 * @param aValues service values |
|
298 * @parama aFlag single service flag |
|
299 * @param aValue new value for aFlag in aValue |
|
300 */ |
|
301 inline void TImpsFeature::SetThisFlag( |
|
302 TInt &aValues, |
|
303 TInt aFlag, |
|
304 TBool aValue) |
|
305 { |
|
306 aValues = ( aValues & ~aFlag ) | ( aValue ? aFlag : 0x0000 ); |
|
307 } |
|
308 |
|
309 /** |
|
310 * Feature type accessor |
|
311 * @return feature |
|
312 */ |
|
313 inline TImpsFeatures TImpsFeature::Feature( ) const |
|
314 { |
|
315 return iFeature; |
|
316 } |
|
317 |
|
318 /** |
|
319 * Is this element active |
|
320 * @return True if this element exists |
|
321 */ |
|
322 inline TBool TImpsFeature::IsSupported( ) const |
|
323 { |
|
324 return iOn; |
|
325 } |
|
326 |
|
327 /** |
|
328 * Feature activity mutator |
|
329 * @param aVal True if this element exists |
|
330 */ |
|
331 inline void TImpsFeature::SetSupported( TBool aVal ) |
|
332 { |
|
333 iOn = aVal; |
|
334 } |
|
335 |
|
336 /** |
|
337 * Function mutator |
|
338 * @param aFunc function |
|
339 * @param aVal new value for the function |
|
340 */ |
|
341 inline void TImpsFeature::SetFunction( TImpsFunctions aFunc, TBool aVal ) |
|
342 { |
|
343 SetThisFlag( iFunctions, aFunc, aVal ); |
|
344 } |
|
345 |
|
346 /** |
|
347 * Function accessor |
|
348 * @param aFunc function |
|
349 * @return EImpsTrue if the function exists |
|
350 */ |
|
351 inline TBool TImpsFeature::Function( TImpsFunctions aFunc ) |
|
352 { |
|
353 return IsThisFlagSet( iFunctions, aFunc ); |
|
354 } |
|
355 |
|
356 /** |
|
357 * Capability (sub-function) mutator. |
|
358 * You should set corresponding Function with SetFunction |
|
359 * @param aCapa sub-function(s) |
|
360 * @param aVal sub-function value |
|
361 */ |
|
362 inline void TImpsFeature::SetCapability( TInt aCapa, TBool aVal ) |
|
363 { |
|
364 SetThisFlag( iCapabilities, aCapa, aVal ); |
|
365 } |
|
366 |
|
367 /** |
|
368 * Capability (sub-function) accessor |
|
369 * @param aFunc sub-function(s) |
|
370 * @return True if this element(s) exists |
|
371 */ |
|
372 inline TBool TImpsFeature::Capability( TInt aCapa ) |
|
373 { |
|
374 return IsThisFlagSet( iCapabilities, aCapa ); |
|
375 } |
|
376 |
|
377 /** |
|
378 * CspSession identifier |
|
379 */ |
|
380 class TImpsCspIdentifier |
|
381 { |
|
382 public: // Constructors and destructor |
|
383 |
|
384 /** |
|
385 * C++ default constructor. |
|
386 */ |
|
387 IMPORT_C TImpsCspIdentifier(); |
|
388 |
|
389 /** |
|
390 * Constructor |
|
391 */ |
|
392 IMPORT_C TImpsCspIdentifier( const TDesC& aSap, |
|
393 const TDesC& aUserId ); |
|
394 |
|
395 public: // New functions |
|
396 |
|
397 /** |
|
398 * Sap accessor |
|
399 * Leaves with KErrNotFound if no value |
|
400 * @return SAP URI |
|
401 */ |
|
402 inline TPtrC Sap( ); |
|
403 |
|
404 /** |
|
405 * UserId accessor |
|
406 * Leaves with KErrNotFound if no value |
|
407 * @return UserId |
|
408 */ |
|
409 inline TPtrC UserId( ); |
|
410 |
|
411 /** |
|
412 * Sap mutator |
|
413 * @param aSap SAP URI, may include port number |
|
414 */ |
|
415 inline void SetSapL( const TDesC& aSap ); |
|
416 |
|
417 /** |
|
418 * UserId mutator |
|
419 * @param aUserId UserId, (max 50 characters) |
|
420 */ |
|
421 inline void SetUserIdL( const TDesC& aUserId ); |
|
422 |
|
423 private: // Data |
|
424 |
|
425 TBuf<KImpsMaxSapLen> iSAP; |
|
426 TBuf<KImpsMaxUserIdLen> iUserId; |
|
427 }; |
|
428 |
|
429 /** |
|
430 * Sap accessor |
|
431 * Leaves with KErrNotFound if no value |
|
432 * @return SAP URI |
|
433 */ |
|
434 inline TPtrC TImpsCspIdentifier::Sap( ) |
|
435 { |
|
436 return iSAP; |
|
437 } |
|
438 |
|
439 /** |
|
440 * UserId accessor |
|
441 * Leaves with KErrNotFound if no value |
|
442 * @return UserId |
|
443 */ |
|
444 inline TPtrC TImpsCspIdentifier::UserId( ) |
|
445 { |
|
446 return iUserId; |
|
447 } |
|
448 |
|
449 /** |
|
450 * Sap mutator |
|
451 * @param aSap SAP URI, may include port number |
|
452 */ |
|
453 inline void TImpsCspIdentifier::SetSapL( const TDesC& aSap ) |
|
454 { |
|
455 iSAP = aSap; |
|
456 } |
|
457 |
|
458 /** |
|
459 * UserId mutator |
|
460 * @param aUserId UserId, (max 50 characters) |
|
461 */ |
|
462 inline void TImpsCspIdentifier::SetUserIdL( const TDesC& aUserId ) |
|
463 { |
|
464 iUserId = aUserId; |
|
465 } |
|
466 |
|
467 #endif |
|
468 |