|
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: Tracked Presence ID entry. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPENGTRACKEDPRESENCEIDENTRY_H |
|
19 #define CPENGTRACKEDPRESENCEIDENTRY_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Base.h> |
|
23 |
|
24 |
|
25 //FORWARD DECLARATIONS |
|
26 class CPEngTrackedPresenceID2; |
|
27 |
|
28 |
|
29 /** |
|
30 * Tracked Presence ID entry. |
|
31 * |
|
32 * This class can be derived to provide additional |
|
33 * functionality for Presence ID handling. |
|
34 * |
|
35 * @lib |
|
36 * @since 3.0 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CPEngTrackedPresenceIDEntry ): public CBase |
|
39 { |
|
40 //----------------------------------------------------------------------- |
|
41 public: /* Construction */ |
|
42 |
|
43 /** |
|
44 * Instantiates CPEngTrackedPresenceIDEntry object. |
|
45 * |
|
46 * @param aPresenceID Tracked Presence ID. |
|
47 * @param aTypes Initial tracked attributes. |
|
48 * @param aFilterFlags Initial filter flags. |
|
49 * @return New CPEngTrackedPresenceIDEntry instance. |
|
50 */ |
|
51 static CPEngTrackedPresenceIDEntry* NewLC( |
|
52 const TDesC& aPresenceID, |
|
53 const TArray<TUint32>& aTypes, |
|
54 TInt aFilterFlag ); |
|
55 |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 * Virtual by CBase. |
|
60 */ |
|
61 ~CPEngTrackedPresenceIDEntry(); |
|
62 |
|
63 |
|
64 |
|
65 protected: // Constructor |
|
66 |
|
67 /** |
|
68 * C++ default constructor. |
|
69 */ |
|
70 CPEngTrackedPresenceIDEntry(); |
|
71 |
|
72 |
|
73 /** |
|
74 * Symbian OS constructor. |
|
75 */ |
|
76 void ConstructL( const TDesC& aPresenceID, |
|
77 const TArray<TUint32>& aTypes, |
|
78 TInt aFilterFlag ); |
|
79 |
|
80 |
|
81 //----------------------------------------------------------------------- |
|
82 public: /* Interface */ |
|
83 |
|
84 |
|
85 /** |
|
86 * Interface getter. |
|
87 * |
|
88 * @since 3.0 |
|
89 * @return Reference to interface. |
|
90 */ |
|
91 CPEngTrackedPresenceID2& Interface(); |
|
92 |
|
93 |
|
94 |
|
95 //----------------------------------------------------------------------- |
|
96 public: /* Tracked presence ID */ |
|
97 |
|
98 /** |
|
99 * Gets the presence id. |
|
100 * |
|
101 * Virtual so derived class can override |
|
102 * behaviour. |
|
103 * |
|
104 * @since 3.0 |
|
105 * @return The Presence ID. |
|
106 */ |
|
107 virtual TPtrC PresenceID() const; |
|
108 |
|
109 |
|
110 /** |
|
111 * Compares two tracked PresenceID entry |
|
112 * according to Presence IDs. |
|
113 * |
|
114 * @since 3.0 |
|
115 * @return Return values according to common |
|
116 * compare functionality. |
|
117 */ |
|
118 static TInt Compare( const CPEngTrackedPresenceIDEntry& aLhs, |
|
119 const CPEngTrackedPresenceIDEntry& aRhs ); |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 //----------------------------------------------------------------------- |
|
125 public: /* Tracked attributes */ |
|
126 |
|
127 /** |
|
128 * Checks is given attribute in the list of |
|
129 * tracked attributes. |
|
130 * |
|
131 * @since 3.0 |
|
132 * @param Attribute to check. |
|
133 * @return ETrue if given attribute is in the |
|
134 * list of tracked attributes. Else EFalse. |
|
135 */ |
|
136 TBool IsOnlyTrackedAttribute( TUint32 aType ) const; |
|
137 |
|
138 |
|
139 /** |
|
140 * Checks is there any attributes in the list of |
|
141 * tracked attributes. |
|
142 * |
|
143 * @since 3.0 |
|
144 * @return ETrue if there is one or more tracked attributes. |
|
145 * Else EFalse. |
|
146 */ |
|
147 TBool AttributesTracked() const; |
|
148 |
|
149 |
|
150 /** |
|
151 * Adds new attributes to list of tracked attributes. |
|
152 * |
|
153 * "Already exist" errors are ignored. |
|
154 * |
|
155 * @since 3.0 |
|
156 * @param Tracked presence attributes. |
|
157 */ |
|
158 void AddTrackedAttributesL( const TArray<TUint32>& aTypes ); |
|
159 |
|
160 |
|
161 /** |
|
162 * Removes the given attributes from the list of |
|
163 * tracked attributes. |
|
164 * |
|
165 * "Not found" errors are ignored. |
|
166 * |
|
167 * @since 3.0 |
|
168 * @param aTypes Attributes to remove. |
|
169 */ |
|
170 void RemoveTrackedAttributes( const TArray<TUint32>& aTypes ); |
|
171 |
|
172 |
|
173 /** |
|
174 * Generic array presenting tracked attributes. |
|
175 * |
|
176 * @since 3.0 |
|
177 * @return Generic array presenting tracked attributes. |
|
178 */ |
|
179 TArray<TUint32> TrackedAttributes() const; |
|
180 |
|
181 |
|
182 /** |
|
183 * Iterates to next tracked attribute and returns |
|
184 * its value. |
|
185 * |
|
186 * If no more tracked attributes, returns |
|
187 * KPEngNullAttributeType. |
|
188 * |
|
189 * @since 3.0 |
|
190 * @Param Iteration start index. |
|
191 * Updates the index during iteration. |
|
192 * @return Iterated attribute value. |
|
193 */ |
|
194 TUint32 NextTrackedAttribute( TInt& aIterIx ) const; |
|
195 |
|
196 |
|
197 |
|
198 //----------------------------------------------------------------------- |
|
199 public: /* Filter flags */ |
|
200 |
|
201 /** |
|
202 * Sets filter flag. |
|
203 * |
|
204 * @since 3.0 |
|
205 * @param aFlag New flag value. |
|
206 */ |
|
207 void SetFilterFlag( TInt aFlag ); |
|
208 |
|
209 |
|
210 /** |
|
211 * Gets filter flag. |
|
212 * |
|
213 * @since 3.0 |
|
214 * @return Filter flag |
|
215 */ |
|
216 TInt FilterFlag() const; |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 //----------------------------------------------------------------------- |
|
223 public: /* Attribute change marks */ |
|
224 |
|
225 |
|
226 /** |
|
227 * Marks all attributes as changed. |
|
228 * |
|
229 * |
|
230 * @since 3.0 |
|
231 */ |
|
232 void MarkAllAttributesChanged(); |
|
233 |
|
234 /** |
|
235 * Resets change mark from all tracked attributes. |
|
236 * |
|
237 * @since 3.0 |
|
238 */ |
|
239 void ResetChangeMarks(); |
|
240 |
|
241 |
|
242 /** |
|
243 * Gets change status. |
|
244 * |
|
245 * @since 3.0 |
|
246 * @return ETrue if one or more attributes is marked as changed. |
|
247 * Else EFalse. |
|
248 */ |
|
249 TBool AttributesChanged() const; |
|
250 |
|
251 |
|
252 /** |
|
253 * Iterates to next changed attribute and |
|
254 * returns its value. |
|
255 * |
|
256 * If no more changed attributes, returns |
|
257 * KPEngNullAttributeType. |
|
258 * |
|
259 * @since 3.0 |
|
260 * @Param Iteration start index. |
|
261 * Updates the index during iteration. |
|
262 * @return Iterated attribute value. |
|
263 */ |
|
264 TUint32 NextChangedAttribute( TInt& aIterIx ) const; |
|
265 |
|
266 |
|
267 |
|
268 private: //Helpers |
|
269 |
|
270 /** |
|
271 * Generic array accessors. |
|
272 * @since 3.0 |
|
273 */ |
|
274 static TInt TrackedAttributesCount( const CBase* aThis ); |
|
275 static const TAny* TrackedAttributeAt( const CBase* aThis, TInt aIndex ); |
|
276 |
|
277 |
|
278 |
|
279 private: //Data |
|
280 |
|
281 //OWN: Exported class interface |
|
282 CPEngTrackedPresenceID2* iInterface; |
|
283 |
|
284 //OWN: Tracked Presence ID |
|
285 HBufC* iPresenceID; |
|
286 |
|
287 //OWN: Attributes tracked for Presence ID |
|
288 RArray< TUint32 > iTrackedAttributes; |
|
289 |
|
290 //OWN: Is any of the tracked attributes changed? |
|
291 TBool iAttributesChanged; |
|
292 |
|
293 //OWN: Filter flags |
|
294 TInt iFilterFlag; |
|
295 |
|
296 |
|
297 }; |
|
298 |
|
299 #endif //CPENGTRACKEDPRESENCEIDENTRY_H |
|
300 |
|
301 |
|
302 |