|
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 #ifndef __UPDATER_H___ |
|
18 #define __UPDATER_H___ |
|
19 //System includes |
|
20 #include <bautils.h> |
|
21 #include <schinfo.h> |
|
22 #include <starterclient.h> |
|
23 #include "FotaServer.h" |
|
24 #include "fotaUpdateAgentComms.h" |
|
25 #include "fotaengine.h" |
|
26 #include <devicedialogconsts.h> |
|
27 #include <HbSymbianVariant.h> |
|
28 #include "fotadevicedialogobserver.h" |
|
29 // CONSTANTS |
|
30 _LIT (KUpdateResultFile, "update.resp"); |
|
31 _LIT (KUpdateRequestFile, "update.req"); |
|
32 _LIT (KUpdateBitmap ,"installing.bmp"); |
|
33 _LIT (KRestartingBitmap ,"restarting.bmp"); |
|
34 _LIT (KUpdateTimeStampFileName, "updatetimestamp"); |
|
35 _LIT8 (KSwupdPath8, "c:\\private\\102072C4\\"); |
|
36 _LIT8 (KSwupdFileExt8, ".swupd"); |
|
37 |
|
38 const TInt BatteryLevelAccepted = EBatteryLevelLevel3; |
|
39 |
|
40 enum MonitorType |
|
41 { |
|
42 None, BatteryLevel, ChargingStatus |
|
43 }; |
|
44 |
|
45 // FORWARD DECLARATIONS |
|
46 class CFotaServer; |
|
47 class CFotaUpdate; |
|
48 class CFotaDownloadNotifHandler; |
|
49 |
|
50 // CLASS DECLARATION |
|
51 |
|
52 /** |
|
53 * Update related activities |
|
54 * |
|
55 * @lib fotaserver |
|
56 * @since S60 v3.1 |
|
57 */ |
|
58 NONSHARABLE_CLASS( CFotaUpdate ) : public CActive, MfotadevicedialogObserver |
|
59 { |
|
60 public: |
|
61 |
|
62 static CFotaUpdate* NewL(CFotaServer* aServer); |
|
63 |
|
64 virtual ~CFotaUpdate(); |
|
65 |
|
66 /*****Functions called before update*****/ |
|
67 |
|
68 TBool CheckBatteryL(); |
|
69 |
|
70 void MonitorBatteryChargeLevel(); |
|
71 |
|
72 void MonitorBatteryChargingStatus(); |
|
73 |
|
74 void CancelMonitor(); |
|
75 |
|
76 /** |
|
77 * Start update |
|
78 * |
|
79 * @since S60 v3.1 |
|
80 * @param aParams details |
|
81 * @return none |
|
82 */ |
|
83 void StartUpdateL(const TDownloadIPCParams &aParams); |
|
84 |
|
85 /** |
|
86 * Update. boot. |
|
87 * |
|
88 * @since S60 v3.1 |
|
89 * @param none |
|
90 * @return none |
|
91 */ |
|
92 void UpdateL(); |
|
93 |
|
94 /*****Functions called after update *****/ |
|
95 |
|
96 /** |
|
97 * Check update result written update agent. Is it there? |
|
98 * |
|
99 * @since S60 v3.1 |
|
100 * @param aRfs |
|
101 * @return is it there |
|
102 */ |
|
103 static TBool CheckUpdateResults(RFs& aRfs); |
|
104 |
|
105 /** |
|
106 * Delete update result file |
|
107 * |
|
108 * @since S60 v3.1 |
|
109 * @param none |
|
110 * @return none |
|
111 */ |
|
112 static void DeleteUpdateResultFileL(); |
|
113 |
|
114 /** |
|
115 * Execute update result file. That is, read result code. Send it to srv. |
|
116 * |
|
117 * @since S60 v3.1 |
|
118 * @param aRfs |
|
119 * @return none |
|
120 */ |
|
121 void ExecuteUpdateResultFileL(); |
|
122 |
|
123 protected: |
|
124 // from base classes |
|
125 |
|
126 |
|
127 /** |
|
128 * Hanlde notifier clicking |
|
129 * |
|
130 * @since S60 v3.1 |
|
131 * @param none |
|
132 * @return none |
|
133 */ |
|
134 virtual void RunL(); |
|
135 |
|
136 /** |
|
137 * Cancel outstanding reqeust |
|
138 * |
|
139 * @since S60 v3.1 |
|
140 * @param none |
|
141 * @return none |
|
142 */ |
|
143 void DoCancel(); |
|
144 |
|
145 /** |
|
146 * Handle leaving runl |
|
147 * |
|
148 * @since S60 v3.1 |
|
149 * @param aError error |
|
150 * @return none |
|
151 */ |
|
152 virtual TInt RunError(TInt aError); |
|
153 |
|
154 private: |
|
155 |
|
156 CFotaUpdate(); |
|
157 |
|
158 void ShowDialogL(TFwUpdNoteTypes dialogid); |
|
159 |
|
160 TBool IsUSBConnected(); |
|
161 |
|
162 TInt WriteUpdateBitmapL( const TDesC& aText, const TDesC& aFile); |
|
163 |
|
164 public: |
|
165 // from MfotadevicedialogObserver |
|
166 |
|
167 void HandleDialogResponse(int response, TInt aDialogid); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * reference to fotaserver. |
|
173 * Not own |
|
174 */ |
|
175 CFotaServer* iFotaServer; |
|
176 |
|
177 RProperty iProperty; |
|
178 |
|
179 MonitorType iMonitorType; |
|
180 |
|
181 CHbSymbianVariantMap * iNotifParams; |
|
182 |
|
183 CFotaDownloadNotifHandler * iNotifier; |
|
184 }; |
|
185 |
|
186 #endif // __UPDATER_H___ |