|
1 /* |
|
2 * Copyright (c) 2002 - 2007 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: Handling end time based automated content |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef ENDTIMEFACTORY_H |
|
21 #define ENDTIMEFACTORY_H |
|
22 |
|
23 // INCLUDES |
|
24 // CONSTANTS |
|
25 // MACROS |
|
26 // DATA TYPES |
|
27 // FUNCTION PROTOTYPES |
|
28 // FORWARD DECLARATIONS |
|
29 class CDRMHelperServer; |
|
30 class CEndTimeBased; |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * End time based rights storage class |
|
35 * |
|
36 * |
|
37 * @lib DRMHelperServer.lib |
|
38 * @since Series60 2.6 |
|
39 */ |
|
40 class CEndTimeFactory : public CTimer |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CEndTimeFactory* NewL(CDRMHelperServer& aServer); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CEndTimeFactory(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Add a specific content uri into list. if the uri is already in the list, |
|
58 * then update the status. |
|
59 * @since Series60 3.0 |
|
60 * @param aUri content uri |
|
61 * @param aPermType permission type |
|
62 * @param aRegType regist type |
|
63 * @param aAutoType automatic type |
|
64 * |
|
65 */ |
|
66 void AddL( |
|
67 const TDesC8& aUri , |
|
68 TTime aEndTime , |
|
69 const TUint8& aPermType , |
|
70 const TUint8& aRegType , |
|
71 const TUint8& aAutoType ); |
|
72 |
|
73 /** |
|
74 * update all items in the list. |
|
75 * @since Series60 2.6 |
|
76 * @param |
|
77 * @return KErrNone if it works OK, |
|
78 */ |
|
79 void UpdateL(); |
|
80 |
|
81 /** |
|
82 * update the end time of a specific content uri in the list. |
|
83 * @since Series60 3.0 |
|
84 * @param aItem the item needs to be updated |
|
85 * @param aEndTime the new end time |
|
86 * |
|
87 */ |
|
88 void UpdateEndTimeL( CEndTimeBased*& aItem , const TTime& aEndTime ); |
|
89 |
|
90 /** |
|
91 * update the end time of a specific content uri in the list. |
|
92 * @since Series60 3.0 |
|
93 * @param aUri the specific content uri for this item. |
|
94 * @param aEndTime the new end time |
|
95 * @param aPermType permission type |
|
96 * @param aRegType regist type |
|
97 */ |
|
98 void UpdateEndTimeL( |
|
99 const TDesC8& aUri , |
|
100 const TTime& aEndTime , |
|
101 const TUint8& aPermType , |
|
102 const TUint8& aRegType ); |
|
103 |
|
104 /** |
|
105 * update the end time of a specific content uri in the list. |
|
106 * @since Series60 3.0 |
|
107 * @param aUri the specific content uri for this item. |
|
108 * @param aEndTime the new end time |
|
109 * @param aPermType permission type |
|
110 * @param aRegType regist type |
|
111 * @param aAutoType automatic type |
|
112 */ |
|
113 void UpdateEndTimeL( |
|
114 const TDesC8& aUri , |
|
115 const TTime& aEndTime , |
|
116 const TUint8& aPermType , |
|
117 const TUint8& aRegType , |
|
118 const TUint8& aAutoType ); |
|
119 |
|
120 /** |
|
121 * IsRegisteredL register one item with specific content uri. |
|
122 * @since S60Rel3.0 |
|
123 * @param aUri the specific content uri for this item. |
|
124 * @param aPermType permission type |
|
125 * @param aRegType regist type |
|
126 * @param aAutoType automatic type |
|
127 * @return ETrue if registered, otherwise EFalse |
|
128 */ |
|
129 TBool IsRegistered( |
|
130 const TDesC8& aUri , |
|
131 const TUint8& aPermType , |
|
132 const TUint8& aRegType , |
|
133 const TUint8& aAutoType ); |
|
134 /** |
|
135 * IsRegisteredL register one item with specific content uri. |
|
136 * @since S60Rel3.0 |
|
137 * @param aUri the specific content uri for this item. |
|
138 * @param aPermType permission type |
|
139 * @param aRegType regist type |
|
140 * @return ETrue if registered, otherwise EFalse |
|
141 */ |
|
142 TBool IsRegistered( |
|
143 const TDesC8& aUri , |
|
144 const TUint8& aPermType , |
|
145 const TUint8& aRegType ); |
|
146 |
|
147 |
|
148 /** |
|
149 * IsRegisteredL register one item with specific content uri. |
|
150 * @since S60Rel3.0 |
|
151 * @param aUri the specific content uri for this item. |
|
152 * @param aPermType permission type |
|
153 * @param aRegType regist type |
|
154 * @return ETrue if registered, otherwise EFalse |
|
155 */ |
|
156 TBool IsRegistered2( |
|
157 const TDesC8& aUri , |
|
158 const TUint8& aRegType, |
|
159 const TUint8& aAutoType ); |
|
160 |
|
161 /** |
|
162 * IsRegisteredL register one item with specific content uri. |
|
163 * @since S60Rel3.0 |
|
164 * @param aUri the specific content uri for this item. |
|
165 * @return ETrue if registered, otherwise EFalse |
|
166 */ |
|
167 TBool IsRegistered( const TDesC8& aUri ); |
|
168 |
|
169 /** |
|
170 * Remove a specific content uri into list. |
|
171 * @since Series60 3.0 |
|
172 * @param aUri content uri |
|
173 * @param aPermType permission type |
|
174 * @param aRegType regist type |
|
175 * @param aAutoType automatic type |
|
176 */ |
|
177 void Remove( |
|
178 const TDesC8& aUri , |
|
179 const TUint8& aPermType , |
|
180 const TUint8& aRegType , |
|
181 const TUint8& aAutoType ); |
|
182 |
|
183 /** |
|
184 * Handle items about to expire and expired when idle status comes |
|
185 * @since Series60 2.6 |
|
186 * @ |
|
187 */ |
|
188 void HandleIdleL(); |
|
189 |
|
190 /** |
|
191 * Externalize the list into data file. |
|
192 * @since Series60 2.6 |
|
193 * @param aStream data file stream |
|
194 */ |
|
195 void ExternalizeL(RWriteStream& aStream) const; |
|
196 |
|
197 /** |
|
198 * Internalize the data from data file. |
|
199 * @since Series60 2.6 |
|
200 * @param aStream data file stream |
|
201 */ |
|
202 void InternalizeL(RReadStream& aStream); |
|
203 |
|
204 /** |
|
205 * Reset the alarm |
|
206 * @since Series60 2.6 |
|
207 */ |
|
208 void ResetAlarm(); |
|
209 |
|
210 /** |
|
211 * Remove all items in the list |
|
212 * @since Series60 2.6 |
|
213 */ |
|
214 void RemoveAllL(); |
|
215 |
|
216 /** |
|
217 * Handle the expiration case for one event |
|
218 * @since Series60 3.0 |
|
219 */ |
|
220 void HandleExpiredL(); |
|
221 |
|
222 public: // Functions from base classes |
|
223 protected: // New functions |
|
224 |
|
225 /** |
|
226 * From CActive |
|
227 * @since Series60 2.6 |
|
228 */ |
|
229 void RunL(); |
|
230 |
|
231 /** |
|
232 * From CActive |
|
233 * @since Series60 2.6 |
|
234 */ |
|
235 void DoCancel(); |
|
236 |
|
237 protected: // Functions from base classes |
|
238 private: |
|
239 |
|
240 /** |
|
241 * C++ default constructor. |
|
242 */ |
|
243 CEndTimeFactory( CDRMHelperServer& aServer ); |
|
244 |
|
245 /** |
|
246 * By default Symbian 2nd phase constructor is private. |
|
247 */ |
|
248 void ConstructL(); |
|
249 |
|
250 // Prohibit copy constructor if not deriving from CBase. |
|
251 CEndTimeFactory( const CEndTimeFactory& ); |
|
252 // Prohibit assigment operator if not deriving from CBase. |
|
253 CEndTimeFactory& operator=( const CEndTimeFactory& ); |
|
254 |
|
255 |
|
256 |
|
257 /** |
|
258 * Find index for a specific content uri into list. |
|
259 * @since Series60 2.6 |
|
260 * @param aUri content uri |
|
261 * @param aPermType permission type |
|
262 * @param aRegType regist type |
|
263 * @param aAutoType automatic type |
|
264 * @return index for content uri in the list |
|
265 */ |
|
266 TInt Find( |
|
267 const TDesC8& aUri , |
|
268 const TUint8& aPermType , |
|
269 const TUint8& aRegType , |
|
270 const TUint8& aAutoType ); |
|
271 |
|
272 /** |
|
273 * Find index for a specific content uri into list. |
|
274 * @since Series60 2.6 |
|
275 * @param aUri content uri |
|
276 * @param aPermType permission type |
|
277 * @param aRegType regist type |
|
278 * @param aIndex the position to start searching in the list |
|
279 * @return index for content uri in the list |
|
280 */ |
|
281 TInt FindNext( |
|
282 const TDesC8& aUri , |
|
283 const TUint8& aPermType , |
|
284 const TUint8& aRegType , |
|
285 const TUint8& aIndex ); |
|
286 |
|
287 /** |
|
288 * Find index for a specific content uri into list. |
|
289 * @since Series60 2.6 |
|
290 * @param aUri content uri |
|
291 * @param aRegType regist type |
|
292 * @return index for content uri in the list |
|
293 */ |
|
294 TInt FindNext( |
|
295 const TDesC8& aUri , |
|
296 const TUint8& aindex); |
|
297 |
|
298 /** |
|
299 * Find index for a specific content uri into list. |
|
300 * @since Series60 2.6 |
|
301 * @param aUri content uri |
|
302 * @return index for content uri in the list |
|
303 */ |
|
304 TInt Exists( |
|
305 const TDesC8& aUri , |
|
306 const TUint8& aRegType, |
|
307 const TUint8& aAutoType ); |
|
308 |
|
309 /** |
|
310 * Reset the expiration status for all items in the list |
|
311 * @since Series60 2.6 |
|
312 */ |
|
313 void ResetExpired(); |
|
314 |
|
315 |
|
316 /** |
|
317 * Reset registered times for specific content with specific type. |
|
318 * @since Series60 2.6 |
|
319 * @param aUri content uri |
|
320 * @param aPermType permission type |
|
321 * @param aRegType regist type |
|
322 * @param aAutoType automatic type |
|
323 * @param aRegTimes registered times |
|
324 * @return |
|
325 */ |
|
326 void ResetRegTimes( |
|
327 const TDesC8& aUri , |
|
328 const TUint8& aPermType , |
|
329 const TUint8& aRegType , |
|
330 const TUint8& aAutoType , |
|
331 const TUint8& aRegTimes ); |
|
332 |
|
333 public: // Data |
|
334 protected: // Data |
|
335 private: // Data |
|
336 CDRMHelperServer& iServer; |
|
337 RPointerArray<CEndTimeBased> iList; |
|
338 TTime iAlarm; |
|
339 TTime iOverflowedAlarm; |
|
340 public: // Friend classes |
|
341 protected: // Friend classes |
|
342 private: // Friend classes |
|
343 |
|
344 |
|
345 }; |
|
346 |
|
347 #endif // ENDTIMEFACTORY_H |
|
348 |
|
349 // End of File |