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 "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: Header for updater active object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __UPDATER_H___ |
|
21 #define __UPDATER_H___ |
|
22 |
|
23 // INCLUDES |
|
24 #include <etelmm.h> |
|
25 #include <mmtsy_names.h> // for etel |
|
26 #include <bautils.h> |
|
27 #include <schinfo.h> |
|
28 |
|
29 #include "FotaServer.h" |
|
30 #include "fotaUpdateAgentComms.h" |
|
31 #include "fotaengine.h" |
|
32 |
|
33 // CONSTANTS |
|
34 _LIT (KUpdateResultFile, "update.resp"); |
|
35 _LIT (KUpdateRequestFile, "update.req"); |
|
36 _LIT (KUpdateBitmap ,"installing.bmp"); |
|
37 _LIT (KRestartingBitmap ,"restarting.bmp"); |
|
38 _LIT (KUpdateTimeStampFileName, "updatetimestamp"); |
|
39 _LIT8 (KSwupdPath8, "c:\\private\\102072C4\\"); |
|
40 _LIT8 (KSwupdFileExt8, ".swupd"); |
|
41 _LIT(KDefaultSched, "1h:4h:1d:3d"); |
|
42 _LIT(Ksep,";"); |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 class CFotaServer; |
|
46 class CFotaUpdate; |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 |
|
51 |
|
52 /** |
|
53 * Update related activities |
|
54 * |
|
55 * @lib fotaserver |
|
56 * @since S60 v3.1 |
|
57 */ |
|
58 NONSHARABLE_CLASS( CFotaUpdate ): public CActive |
|
59 { |
|
60 public: |
|
61 |
|
62 static CFotaUpdate* NewL (CFotaServer* aServer); |
|
63 |
|
64 virtual ~CFotaUpdate (); |
|
65 |
|
66 |
|
67 /** |
|
68 * Start update |
|
69 * |
|
70 * @since S60 v3.1 |
|
71 * @param aParams details |
|
72 * @return none |
|
73 */ |
|
74 void StartUpdateL( const TDownloadIPCParams &aParams ); |
|
75 |
|
76 |
|
77 /** |
|
78 * Update. boot. |
|
79 * |
|
80 * @since S60 v3.1 |
|
81 * @param none |
|
82 * @return none |
|
83 */ |
|
84 void UpdateL(); |
|
85 |
|
86 |
|
87 /** |
|
88 * Check update result written update agent. Is it there? |
|
89 * |
|
90 * @since S60 v3.1 |
|
91 * @param aRfs |
|
92 * @return is it there |
|
93 */ |
|
94 static TBool CheckUpdateResults( RFs& aRfs ); |
|
95 |
|
96 |
|
97 |
|
98 /** |
|
99 * Delete update result file |
|
100 * |
|
101 * @since S60 v3.1 |
|
102 * @param aRfs |
|
103 * @return none |
|
104 */ |
|
105 static void DeleteUpdateResultFileL( RFs& aRfs ); |
|
106 |
|
107 |
|
108 |
|
109 /** |
|
110 * Execute update result file. That is, read result code. Send it to srv. |
|
111 * |
|
112 * @since S60 v3.1 |
|
113 * @param aRfs |
|
114 * @return none |
|
115 */ |
|
116 void ExecuteUpdateResultFileL( RFs& aRfs ); |
|
117 |
|
118 /** |
|
119 * Checks the FOTA Install update note variation |
|
120 * @since S60 v3.2 |
|
121 * @param None |
|
122 * @return TBool, ETrue / EFalse |
|
123 */ |
|
124 TBool CheckUpdateVariations(); |
|
125 |
|
126 /** |
|
127 * HandleUpdateAcceptStartL handle the update process when the user pressed Now |
|
128 * |
|
129 * @since S60 v5.0 |
|
130 * @param None |
|
131 * @return None |
|
132 */ |
|
133 void HandleUpdateAcceptStartL(TBool aSkipBatteryChk = EFalse); |
|
134 |
|
135 /** |
|
136 * This method handles any update related error. |
|
137 * |
|
138 * @since S60 v5.2 |
|
139 * @param the error code and value if applicable |
|
140 * @return None, can leave with system wide error. |
|
141 */ |
|
142 void HandleUpdateErrorL(TInt aError, TInt aValue = 0); |
|
143 |
|
144 /** |
|
145 * This method handles any encryption related error. |
|
146 * |
|
147 * @since S60 v5.2 |
|
148 * @param the error code |
|
149 * @return None, can leave with system wide error. |
|
150 */ |
|
151 void HandleEncryptionErrorL(TInt aError); |
|
152 |
|
153 |
|
154 protected: // from base classes |
|
155 |
|
156 |
|
157 /** |
|
158 * Hanlde notifier clicking |
|
159 * |
|
160 * @since S60 v3.1 |
|
161 * @param none |
|
162 * @return none |
|
163 */ |
|
164 virtual void RunL(); |
|
165 |
|
166 |
|
167 /** |
|
168 * Cancel outstanding reqeust |
|
169 * |
|
170 * @since S60 v3.1 |
|
171 * @param none |
|
172 * @return none |
|
173 */ |
|
174 void DoCancel(); |
|
175 |
|
176 |
|
177 /** |
|
178 * Handle leaving runl |
|
179 * |
|
180 * @since S60 v3.1 |
|
181 * @param aError error |
|
182 * @return none |
|
183 */ |
|
184 virtual TInt RunError(TInt aError); |
|
185 /** |
|
186 * Enum for Interval type of scheduling |
|
187 * |
|
188 * @since S60 v3.2 |
|
189 */ |
|
190 enum TUpdateIntervalType |
|
191 { |
|
192 /** The interval is based on hours. */ |
|
193 EHourly, |
|
194 /** The interval is based on days. */ |
|
195 EDaily, |
|
196 /** The interval is based on months. */ |
|
197 EMonthly, |
|
198 /** The interval is based on years. */ |
|
199 EYearly, |
|
200 /**Show the No reminder */ |
|
201 ENoReminderOn, |
|
202 /**Show the No reminder */ |
|
203 ENoReminderOff |
|
204 }; |
|
205 |
|
206 private: |
|
207 |
|
208 CFotaUpdate (); |
|
209 |
|
210 /** |
|
211 * Check if there's enough battery power to update |
|
212 * |
|
213 * @since S60 v3.1 |
|
214 * @param aUSBCharger |
|
215 * @return TBool is there enough battery |
|
216 */ |
|
217 TBool CheckBatteryL(TBool aUSBCharger); |
|
218 |
|
219 /** |
|
220 * HandleUpdateAcceptLaterL handle the update process when the user pressed Later |
|
221 * |
|
222 * @since S60 v5.0 |
|
223 * @param None |
|
224 * @return None |
|
225 */ |
|
226 void HandleUpdateAcceptLaterL(); |
|
227 |
|
228 /** |
|
229 * HandleErrorBasedonChargingTypeL handle the error based on chrager type |
|
230 * |
|
231 * @since S60 v5.0 |
|
232 * @param None |
|
233 * @return None |
|
234 */ |
|
235 void HandleErrorBasedonChargingTypeL(); |
|
236 |
|
237 /** |
|
238 * SetUpdateFailedStatesL Set the state to update failed |
|
239 * |
|
240 * @since S60 v5.0 |
|
241 * @param None |
|
242 * @return None |
|
243 */ |
|
244 void SetUpdateFailedStatesL(); |
|
245 |
|
246 /** |
|
247 * GetSchedulesInfoL Get the schedule info of FOTA update |
|
248 * |
|
249 * @since S60 v5.0 |
|
250 * @param None |
|
251 * @return None |
|
252 */ |
|
253 void GetSchedulesInfoL(); |
|
254 |
|
255 |
|
256 /** |
|
257 * Launch notifier for user to interact with |
|
258 * |
|
259 * @since S60 v3.1 |
|
260 * @param aNotetype |
|
261 * @param aIntparam |
|
262 * @return none |
|
263 */ |
|
264 void LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype , const TInt aIntParam, const TInt aEnc=EFalse ); |
|
265 |
|
266 /** |
|
267 * Prepare and display Reminder Dialog using RFotaReminderDlg |
|
268 * on radio button setting page |
|
269 * @since S60 v3.1 |
|
270 * @param None |
|
271 * @return none |
|
272 */ |
|
273 void ShowReminderDialogL(); |
|
274 |
|
275 /** |
|
276 * Create the Schedule |
|
277 * @since S60 v3.1 |
|
278 * |
|
279 * @param package id |
|
280 * @param interval type |
|
281 * @param interval |
|
282 * @return TInt |
|
283 */ |
|
284 TInt CreateScheduleL ( const TInt aPackageId |
|
285 ,const TIntervalType aIntervalType,const TInt aInterval); |
|
286 |
|
287 |
|
288 /** |
|
289 * Create the new Schedule |
|
290 * @since S60 v3.1 |
|
291 * |
|
292 * @param package id |
|
293 * @param aRet |
|
294 * @param aRadioSelectionIndex |
|
295 * @return None |
|
296 */ |
|
297 |
|
298 void CreateNewScheduleL(TInt aRet, TInt aRadioSelectionIndex); |
|
299 |
|
300 /** |
|
301 * Fins the schedule or deletes it |
|
302 * @since S60 v3.1 |
|
303 * |
|
304 * @param aDelete if true the delete the schedule |
|
305 * @return TScheduleEntryInfo2 |
|
306 */ |
|
307 TScheduleEntryInfo2 FindScheduleL ( const TBool aDelete ); |
|
308 /** |
|
309 * Parse the schedule string from Cenrep |
|
310 * @since S60 v3.2 |
|
311 * @param None |
|
312 * @return none |
|
313 */ |
|
314 void ParseScheduleStringL(); |
|
315 |
|
316 public: |
|
317 |
|
318 |
|
319 /** |
|
320 * Creates the Array of radio buttons and returns to the caller |
|
321 */ |
|
322 CDesCArray* CreateRadionButtonArrayLC(const TScheduleEntryInfo2 aScEntry,TInt& aSelectionIndex); |
|
323 |
|
324 private: |
|
325 |
|
326 /** |
|
327 * State of the update package. For convenience. |
|
328 */ |
|
329 TPackageState iUpdateState; |
|
330 |
|
331 |
|
332 /** |
|
333 * reference to fotaserver. |
|
334 * Not own |
|
335 */ |
|
336 CFotaServer* iFotaServer; |
|
337 |
|
338 |
|
339 /** |
|
340 * Notifier |
|
341 */ |
|
342 RNotifier iNotifier; |
|
343 |
|
344 |
|
345 |
|
346 /** |
|
347 * Interval Type |
|
348 */ |
|
349 |
|
350 RArray<TInt> iIntervalType; |
|
351 |
|
352 /** |
|
353 * Interval |
|
354 */ |
|
355 RArray<TInt> iInterval; |
|
356 /** |
|
357 * Notifier params |
|
358 */ |
|
359 TSyncMLFwUpdNotifParams iNotifParams; |
|
360 |
|
361 |
|
362 |
|
363 /** |
|
364 * NOtifier response |
|
365 */ |
|
366 TSyncMLFwUpdNotifRetValPckg iDummyResponsePckg; |
|
367 |
|
368 |
|
369 /** |
|
370 * file server session |
|
371 * not own |
|
372 */ |
|
373 RFs* iFs; |
|
374 |
|
375 /** |
|
376 * scheduled times |
|
377 */ |
|
378 TBuf<255> iscInfo; |
|
379 |
|
380 /** |
|
381 * fota update reminder task |
|
382 */ |
|
383 TFotaScheduledUpdate* iScheduledUpdate; |
|
384 |
|
385 /* |
|
386 * flag to handle showing the reminder dialog twice. |
|
387 */ |
|
388 TBool iHandleUpdateAcceptLater; |
|
389 |
|
390 /* |
|
391 * tells the battery charge to monitor for. |
|
392 */ |
|
393 TInt iChargeToMonitor; |
|
394 |
|
395 /* |
|
396 * to finalize update later |
|
397 */ |
|
398 TBool iFinalizeLater; |
|
399 }; |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 #endif // __UPDATER_H___ |
|