26
|
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 |
/* Added for postpone limit, When All the postpones are used and user presses end key this command is sent */
|
|
205 |
EEndKeyReminder
|
|
206 |
};
|
|
207 |
|
|
208 |
private:
|
|
209 |
|
|
210 |
CFotaUpdate ();
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Check if there's enough battery power to update
|
|
214 |
*
|
|
215 |
* @since S60 v3.1
|
|
216 |
* @param aUSBCharger
|
|
217 |
* @return TBool is there enough battery
|
|
218 |
*/
|
|
219 |
TBool CheckBatteryL(TBool aUSBCharger);
|
|
220 |
|
|
221 |
/**
|
|
222 |
* HandleUpdateAcceptLaterL handle the update process when the user pressed Later
|
|
223 |
*
|
|
224 |
* @since S60 v5.0
|
|
225 |
* @param None
|
|
226 |
* @return None
|
|
227 |
*/
|
|
228 |
void HandleUpdateAcceptLaterL();
|
|
229 |
|
|
230 |
/**
|
|
231 |
* HandleErrorBasedonChargingTypeL handle the error based on chrager type
|
|
232 |
*
|
|
233 |
* @since S60 v5.0
|
|
234 |
* @param None
|
|
235 |
* @return None
|
|
236 |
*/
|
|
237 |
void HandleErrorBasedonChargingTypeL();
|
|
238 |
|
|
239 |
/**
|
|
240 |
* SetUpdateFailedStatesL Set the state to update failed
|
|
241 |
*
|
|
242 |
* @since S60 v5.0
|
|
243 |
* @param None
|
|
244 |
* @return None
|
|
245 |
*/
|
|
246 |
void SetUpdateFailedStatesL();
|
|
247 |
|
|
248 |
/**
|
|
249 |
* GetSchedulesInfoL Get the schedule info of FOTA update
|
|
250 |
*
|
|
251 |
* @since S60 v5.0
|
|
252 |
* @param None
|
|
253 |
* @return None
|
|
254 |
*/
|
|
255 |
void GetSchedulesInfoL();
|
|
256 |
|
|
257 |
/**
|
|
258 |
* DisplayInstallationNoteType determines the proper installation note based on the Cenrep keys.
|
|
259 |
*
|
|
260 |
* @since S60 v5.0
|
|
261 |
* @param None
|
|
262 |
* @return None
|
|
263 |
*/
|
|
264 |
void DisplayInstallationNoteTypeL();
|
|
265 |
|
|
266 |
|
|
267 |
/**
|
|
268 |
* Launch notifier for user to interact with
|
|
269 |
*
|
|
270 |
* @since S60 v3.1
|
|
271 |
* @param aNotetype
|
|
272 |
* @param aIntparam
|
|
273 |
* @return none
|
|
274 |
*/
|
|
275 |
void LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype , const TInt aIntParam,const TInt aEnc=EFalse);
|
|
276 |
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Launch the postpone information note, when the postpone limit feature is enabled.
|
|
280 |
*
|
|
281 |
* @since S60 v5.0
|
|
282 |
* @param aNotetype
|
|
283 |
* @param aIntparam
|
|
284 |
* @param aIntParam1
|
|
285 |
* @param aIntervalType
|
|
286 |
* @param aInterval
|
|
287 |
* @return none
|
|
288 |
*/
|
|
289 |
void LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype,const TInt aIntParam,const TInt aIntParam1,TIntervalType aIntervalType,const TInt aInterval);
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Prepare and display Reminder Dialog using RFotaReminderDlg
|
|
293 |
* on radio button setting page
|
|
294 |
* @since S60 v3.1
|
|
295 |
* @param None
|
|
296 |
* @return none
|
|
297 |
*/
|
|
298 |
void ShowReminderDialogL();
|
|
299 |
|
|
300 |
/**
|
|
301 |
* Create the Schedule
|
|
302 |
* @since S60 v3.1
|
|
303 |
*
|
|
304 |
* @param package id
|
|
305 |
* @param intervaltype
|
|
306 |
* @param interval
|
|
307 |
* @return TInt
|
|
308 |
*/
|
|
309 |
TInt CreateScheduleL ( const TInt aPackageId
|
|
310 |
,TIntervalType aIntervalType,const TInt aInterval);
|
|
311 |
|
|
312 |
|
|
313 |
/**
|
|
314 |
* Create the new Schedule
|
|
315 |
* @since S60 v3.1
|
|
316 |
*
|
|
317 |
* @param package id
|
|
318 |
* @param aRet
|
|
319 |
* @param aRadioSelectionIndex
|
|
320 |
* @return None
|
|
321 |
*/
|
|
322 |
|
|
323 |
void CreateNewScheduleL(TInt aRet, TInt aRadioSelectionIndex);
|
|
324 |
|
|
325 |
/**
|
|
326 |
* Fins the schedule or deletes it
|
|
327 |
* @since S60 v3.1
|
|
328 |
*
|
|
329 |
* @param aDelete if true the delete the schedule
|
|
330 |
* @return TScheduleEntryInfo2
|
|
331 |
*/
|
|
332 |
TScheduleEntryInfo2 FindScheduleL ( const TBool aDelete );
|
|
333 |
/**
|
|
334 |
* Parse the schedule string from Cenrep
|
|
335 |
* @since S60 v3.2
|
|
336 |
* @param None
|
|
337 |
* @return none
|
|
338 |
*/
|
|
339 |
void ParseScheduleStringL();
|
|
340 |
|
|
341 |
public:
|
|
342 |
|
|
343 |
|
|
344 |
/**
|
|
345 |
* Creates the Array of radio buttons and returns to the caller
|
|
346 |
*/
|
|
347 |
CDesCArray* CreateRadionButtonArrayLC(const TScheduleEntryInfo2 aScEntry,TInt& aSelectionIndex);
|
|
348 |
|
|
349 |
private:
|
|
350 |
|
|
351 |
/**
|
|
352 |
* State of the update package. For convenience.
|
|
353 |
*/
|
|
354 |
TPackageState iUpdateState;
|
|
355 |
|
|
356 |
|
|
357 |
/**
|
|
358 |
* reference to fotaserver.
|
|
359 |
* Not own
|
|
360 |
*/
|
|
361 |
CFotaServer* iFotaServer;
|
|
362 |
|
|
363 |
|
|
364 |
/**
|
|
365 |
* Notifier
|
|
366 |
*/
|
|
367 |
RNotifier iNotifier;
|
|
368 |
|
|
369 |
|
|
370 |
|
|
371 |
/**
|
|
372 |
* Interval Type
|
|
373 |
*/
|
|
374 |
|
|
375 |
RArray<TInt> iIntervalType;
|
|
376 |
|
|
377 |
/**
|
|
378 |
* Interval
|
|
379 |
*/
|
|
380 |
RArray<TInt> iInterval;
|
|
381 |
/**
|
|
382 |
* Notifier params
|
|
383 |
*/
|
|
384 |
TSyncMLFwUpdNotifParams iNotifParams;
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
/**
|
|
389 |
* NOtifier response
|
|
390 |
*/
|
|
391 |
TSyncMLFwUpdNotifRetValPckg iDummyResponsePckg;
|
|
392 |
|
|
393 |
|
|
394 |
/**
|
|
395 |
* file server session
|
|
396 |
* not own
|
|
397 |
*/
|
|
398 |
RFs* iFs;
|
|
399 |
|
|
400 |
/**
|
|
401 |
* scheduled times
|
|
402 |
*/
|
|
403 |
TBuf<255> iscInfo;
|
|
404 |
|
|
405 |
/**
|
|
406 |
* fota update reminder task
|
|
407 |
*/
|
|
408 |
TFotaScheduledUpdate* iScheduledUpdate;
|
|
409 |
/*
|
|
410 |
* flag to handle showing the reminder dialog twice.
|
|
411 |
*/
|
|
412 |
TBool iHandleUpdateAcceptLater;
|
|
413 |
|
|
414 |
/*
|
|
415 |
* tells the battery charge to monitor for.
|
|
416 |
*/
|
|
417 |
TInt iChargeToMonitor;
|
|
418 |
|
|
419 |
/*
|
|
420 |
* to finalize update later
|
|
421 |
*/
|
|
422 |
|
|
423 |
TBool iFinalizeLater;
|
|
424 |
|
|
425 |
/*
|
|
426 |
* flag to enable the FOTA Update Postpone limit feature.
|
|
427 |
*/
|
|
428 |
TInt iFOTAUICustomization;
|
|
429 |
|
|
430 |
/*
|
|
431 |
* To Store the number of postpones done by the user.
|
|
432 |
*/
|
|
433 |
TInt iFOTAUserPostponeCount;
|
|
434 |
|
|
435 |
/*
|
|
436 |
* To Store the maximum number of postpones allowed for the user.
|
|
437 |
*/
|
|
438 |
TInt iFOTAMaxPostponeCount;
|
|
439 |
|
|
440 |
/*
|
|
441 |
* To Get the Configuration values related to FOTA
|
|
442 |
*/
|
|
443 |
CRepository* iCentrep;
|
|
444 |
|
|
445 |
};
|
|
446 |
|
|
447 |
|
|
448 |
|
|
449 |
|
|
450 |
#endif // __UPDATER_H___ |