|
1 /* |
|
2 * Copyright (c) 2005 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 the License "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: UpdateManager it controls the auto updation of feed. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _UPDATEMANAGER_H_ |
|
20 #define _UPDATEMANAGER_H_ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32property.h> |
|
24 #include <e32base.h> |
|
25 #include "UpdateAllFeedsTask.h" |
|
26 #include "etel3rdparty.h" |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // FUNCTION PROTOTYPES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CFeedsServer; |
|
37 class CUpdateQueue; |
|
38 class CUpdateAllFeedsTask; |
|
39 class CFeedsDatabase; |
|
40 class CServerHttpConnection; |
|
41 class CUpdateTimer; |
|
42 class CRoamingInfo; |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * The feed UpdateManager. |
|
47 * |
|
48 * \b Library: FeedsEngine.lib |
|
49 * |
|
50 * @since 7.1 |
|
51 */ |
|
52 class CUpdateManager: public CTimer, public MUpdateAllFeedsTaskObserver |
|
53 { |
|
54 |
|
55 public: // From CActive |
|
56 /** |
|
57 * Handles an active object's request completion event. |
|
58 * |
|
59 * @since 7.1 |
|
60 * @return void. |
|
61 */ |
|
62 void RunL(); |
|
63 |
|
64 public: // From MUpdateAllFeedsTaskObserver |
|
65 /** |
|
66 * Called to notify the obsever how many feeds remain to be updated. |
|
67 * |
|
68 * @since 7.1 |
|
69 * @param aStatusCode The completion status of the request. |
|
70 * @return Void |
|
71 */ |
|
72 virtual void UpdateAllFeedsProgress(TInt aMaxCount, TInt aRemaining); |
|
73 |
|
74 /** |
|
75 * Called upon completion of the task. |
|
76 * |
|
77 * @since 7.1 |
|
78 * @param aStatusCode The completion status of the request. |
|
79 * @return Void |
|
80 */ |
|
81 virtual void UpdateAllFeedsCompleted(TInt aStatusCode); |
|
82 |
|
83 /** |
|
84 * Returns the http-connection instance; |
|
85 * |
|
86 * @since 7.1 |
|
87 * @return The http-connection instance. |
|
88 */ |
|
89 virtual CHttpConnection& HttpConnection(); |
|
90 |
|
91 public: |
|
92 |
|
93 /** |
|
94 * Two-phased constructor. |
|
95 * @since 7.1 |
|
96 * @param aFolderListId The folder list associate with this background update. |
|
97 * @param aAutoUpdateFreq The frequency of this background update. |
|
98 * @param aAutoUpdateAP The access point to use for this background update. |
|
99 * @param aAutoUpdateWhileRoaming The flag. |
|
100 */ |
|
101 static CUpdateManager* NewL( TInt aFolderListId, TUint32 aAutoUpdateAP, TInt aAutoUpdateFreq, |
|
102 TBool aAutoUpdateWhileRoaming, CFeedsServer& aFeedsServer); |
|
103 |
|
104 /** |
|
105 * |
|
106 * @since 7.1 |
|
107 * Destructor |
|
108 */ |
|
109 ~CUpdateManager(); |
|
110 |
|
111 /** |
|
112 * This Method calls update Feed |
|
113 * |
|
114 * @since 7.1 |
|
115 * @ return Integer |
|
116 */ |
|
117 TInt UpdateL(); |
|
118 |
|
119 /** |
|
120 * This method handles the updation of feeds |
|
121 * |
|
122 * @since 7.1 |
|
123 * @return Integer. |
|
124 */ |
|
125 TInt StartL(); |
|
126 |
|
127 /** |
|
128 * This method Stop the updation; |
|
129 * |
|
130 * @since 7.1 |
|
131 * Stop the Update timer |
|
132 */ |
|
133 void Stop(); |
|
134 |
|
135 /** |
|
136 * This method Returns the FolderListId; |
|
137 * |
|
138 * @since 7.1 |
|
139 * @return The folder list ID. |
|
140 */ |
|
141 TInt FolderListId(); |
|
142 |
|
143 /** |
|
144 * This method Updates the update queue; |
|
145 * |
|
146 * @since 7.1 |
|
147 * @return The folder list ID. |
|
148 */ |
|
149 void UpdateFeedL(TInt aFeedId, TBool aDeleteFeed); |
|
150 |
|
151 /** |
|
152 * This method is a call back; |
|
153 * |
|
154 * @since 7.1 |
|
155 * @return The folder list ID. |
|
156 */ |
|
157 static TBool LazyCallBack(TAny* aPtr); |
|
158 |
|
159 /** |
|
160 * This method Sets the next timer event; |
|
161 * |
|
162 * @since 7.1 |
|
163 * @return The folder list ID. |
|
164 */ |
|
165 void StartTimer(); |
|
166 |
|
167 /** |
|
168 * This method Adds feeds in queue; |
|
169 * |
|
170 * @since 7.1 |
|
171 * @return The folder list ID. |
|
172 */ |
|
173 void AddFeedL(TInt aFeedId); |
|
174 |
|
175 private: |
|
176 /** |
|
177 * |
|
178 * @since 7.1 |
|
179 * By default Symbian 2nd phase constructor is private. |
|
180 */ |
|
181 void ConstructL( TUint32 aAutoUpdateAP); |
|
182 |
|
183 /** |
|
184 * |
|
185 * @since 7.1 |
|
186 * C++ default constructor. |
|
187 */ |
|
188 CUpdateManager( TInt aFolderListId, TInt aAutoUpdateFreq, TBool aAutoUpdateWhileRoaming, CFeedsServer& aFeedsServer); |
|
189 |
|
190 private: |
|
191 TInt iAutoUpdateFreq; |
|
192 TBool iAutoUpdateWhileRoaming; |
|
193 TInt iFolderListId; |
|
194 TUint32 iAutoUpdateAp; |
|
195 RPointerArray<CUpdateQueue> iQueueArray; |
|
196 CFeedsServer& iFeedsServer; |
|
197 CUpdateAllFeedsTask* iUpdateAllFeedTask; |
|
198 CServerHttpConnection* iHttpConnection; |
|
199 |
|
200 CIdle* iLazyCaller; |
|
201 TInt iCurrentFeedCount; |
|
202 RArray<TInt> iFeedIds; |
|
203 TInt iMins; |
|
204 |
|
205 CRoamingInfo* iRoamingInfo; |
|
206 //friend class |
|
207 friend class CRoamingInfo; |
|
208 friend class CFeedsServer; |
|
209 }; |
|
210 |
|
211 /** |
|
212 * The feed RoamingInfo. |
|
213 * |
|
214 * \b Library: FeedsEngine.lib |
|
215 * |
|
216 * @since 7.1 |
|
217 */ |
|
218 class CRoamingInfo: public CActive |
|
219 { |
|
220 public: // Constructors and destructor |
|
221 /** |
|
222 * Two-phased constructor. |
|
223 * |
|
224 * @since 7.1 |
|
225 * @param aFolderListId The folder list associate with this background update. |
|
226 * @param aAutoUpdateFreq The frequency of this background update. |
|
227 * @param aAutoUpdateAP The access point to use for this background update. |
|
228 * @param aAutoUpdateWhileRoaming The flag. |
|
229 */ |
|
230 static CRoamingInfo* NewL(CUpdateManager *aUpdateManager); |
|
231 |
|
232 /** |
|
233 * @since 7.1 |
|
234 * Destructor. |
|
235 */ |
|
236 virtual ~CRoamingInfo(); |
|
237 |
|
238 public: // From CActive |
|
239 /** |
|
240 * Handles an active object's request completion event. |
|
241 * |
|
242 * @since 7.1 |
|
243 * @return void. |
|
244 */ |
|
245 void RunL(); |
|
246 void DoCancel(); |
|
247 |
|
248 public: |
|
249 |
|
250 /** |
|
251 * Check for roaming. |
|
252 * |
|
253 * @since 7.1 |
|
254 * @return void. |
|
255 */ |
|
256 void CheckForRoaming(); |
|
257 |
|
258 private: |
|
259 /** |
|
260 * @since 7.1 |
|
261 * C++ default constructor. |
|
262 * |
|
263 */ |
|
264 CRoamingInfo(CUpdateManager *aUpdateManager); |
|
265 |
|
266 /** |
|
267 * @since 7.1 |
|
268 * By default Symbian 2nd phase constructor is private. |
|
269 * |
|
270 */ |
|
271 void ConstructL(); |
|
272 |
|
273 private: |
|
274 |
|
275 CTelephony *iTelephony; |
|
276 CTelephony::TNetworkRegistrationV1 iRegStatus; |
|
277 CUpdateManager *iUpdateManager; |
|
278 |
|
279 }; |
|
280 |
|
281 |
|
282 #endif //_UPDATEMANAGER_H_ |