|
1 /* |
|
2 * Copyright (c) 2009-2010 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: |
|
15 * CBootstrapAppUi application UI class declaration. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __BOOTSTRAPAPPUI_H__ |
|
22 #define __BOOTSTRAPAPPUI_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <aknappui.h> |
|
26 #include <aknglobalconfirmationquery.h> |
|
27 #include <downloadmgrclient.h> |
|
28 #include <smartinstaller.rsg> |
|
29 #include <swinstapi.h> |
|
30 #include "debug.h" |
|
31 |
|
32 const TInt KMaxDlConnectionAttempts = 6; |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CBootstrapAppView; |
|
36 class CAknGlobalNote; |
|
37 class CGlobalWaitNoteObserver; |
|
38 class CInstallObserver; |
|
39 |
|
40 enum AppState |
|
41 { |
|
42 EInitialState, // 0 |
|
43 EChangesDownloadState, |
|
44 EChangesParseState, |
|
45 EADMDownloadState, |
|
46 EADMInstallState, |
|
47 EADMLaunchState |
|
48 }; |
|
49 |
|
50 // Mandatory changes xml elements |
|
51 _LIT8(KFieldVersion,"Version"); |
|
52 _LIT8(KFieldSisName,"SisFileName"); |
|
53 // Optional changes xml element |
|
54 _LIT8(KFieldUrl,"Url"); |
|
55 |
|
56 enum XmlParserError |
|
57 { |
|
58 EErrorXmlNotWelformed, |
|
59 EMissingVersion, |
|
60 EInvalidVersion, |
|
61 EMissingSisFileName, |
|
62 }; |
|
63 |
|
64 struct AdmChangesInfo |
|
65 { |
|
66 AdmChangesInfo() |
|
67 :iVersion(0,0,0), |
|
68 iSisName(NULL), |
|
69 iUrl(NULL) |
|
70 {} |
|
71 ~AdmChangesInfo() |
|
72 { |
|
73 delete iSisName; |
|
74 delete iUrl; |
|
75 } |
|
76 TVersion iVersion; |
|
77 HBufC8 *iSisName; |
|
78 HBufC8 *iUrl; |
|
79 }; |
|
80 |
|
81 // CLASS DECLARATION |
|
82 /** |
|
83 * CBootstrapAppUi application UI class. |
|
84 * Interacts with the user through the UI and request message processing |
|
85 * from the handler class |
|
86 */ |
|
87 class CBootstrapAppUi : public CAknAppUi, |
|
88 public MHttpDownloadMgrObserver |
|
89 { |
|
90 public: // Constructors and destructor |
|
91 |
|
92 /** |
|
93 * ConstructL. |
|
94 * 2nd phase constructor. |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 /** |
|
99 * CBootstrapAppUi. |
|
100 * C++ default constructor. This needs to be public due to |
|
101 * the way the framework constructs the AppUi |
|
102 */ |
|
103 CBootstrapAppUi(); |
|
104 |
|
105 /** |
|
106 * ~CBootstrapAppUi. |
|
107 * Virtual Destructor. |
|
108 */ |
|
109 virtual ~CBootstrapAppUi(); |
|
110 |
|
111 void ExitWithError(const TInt& aResourceId ); |
|
112 |
|
113 private: // Functions from base classes |
|
114 |
|
115 |
|
116 /** |
|
117 * Push the application to background. |
|
118 * Called by the framework when the application switches |
|
119 * to foreground. |
|
120 */ |
|
121 void HandleForegroundEventL(TBool aForeground); |
|
122 |
|
123 /** |
|
124 * Sends application to background. |
|
125 */ |
|
126 void SendToBackgroundL(TBool aBackground = ETrue); |
|
127 |
|
128 /** |
|
129 * Check if the ADM is already present in the device or not |
|
130 */ |
|
131 TBool IsPackagePresentL(const TUid& aUid, TVersion& aVersion); |
|
132 |
|
133 |
|
134 /* |
|
135 * Installs the specified package |
|
136 */ |
|
137 void AsyncInstallPackageL(const TDesC& aResponseFilename); |
|
138 |
|
139 |
|
140 TInt LaunchAdmL (); |
|
141 |
|
142 void ShowGlobalWaitNoteL(); |
|
143 |
|
144 void StopGlobalWaitNoteL(); |
|
145 |
|
146 void SetFileNameInfoL(); |
|
147 |
|
148 void ShowNoteL( const TAknGlobalNoteType& aType , const TInt& aResourceId ); |
|
149 |
|
150 /** |
|
151 * Fetch ADM from the web server. |
|
152 */ |
|
153 void DownloadL(); |
|
154 |
|
155 void CloseApp(); |
|
156 |
|
157 void DeleteFile(const TDesC& aFileName); |
|
158 |
|
159 void WaitForInstallCompleteL(); |
|
160 |
|
161 TUint32 GetLatestInstalledL(); |
|
162 |
|
163 |
|
164 void HandleCommandL(TInt aCommand); |
|
165 |
|
166 TInt ReadConfigurationL(); |
|
167 |
|
168 #ifdef FEATURE_BOOTSTRAP_SETIAP |
|
169 void SetIAPL(); |
|
170 #endif |
|
171 void ParseChangesInfoL( const TDesC& aChangesFileName ); |
|
172 |
|
173 public: |
|
174 |
|
175 void HandleInstallCompleteL(const TInt& aStatus); |
|
176 /** |
|
177 *Handle the Global Query Response |
|
178 */ |
|
179 void HandleHttpFetchCompleteL(const TBool& aStatus); |
|
180 |
|
181 /** |
|
182 *Handle download manager events. |
|
183 */ |
|
184 void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); |
|
185 |
|
186 /** |
|
187 * Handle user press cancel |
|
188 */ |
|
189 void HandleGlobalWaitNoteCancel(const TInt& aStatus); |
|
190 |
|
191 private: // Data |
|
192 |
|
193 /** |
|
194 * The application view |
|
195 * Owned by CBootstrapAppUi |
|
196 */ |
|
197 |
|
198 /** |
|
199 * IAP for Download Manager. Passed to ADM. |
|
200 */ |
|
201 TInt32 iIAP; |
|
202 |
|
203 HBufC* iDepFilename; |
|
204 |
|
205 HBufC* iSisFileName; |
|
206 |
|
207 /** |
|
208 * URL provided by the configuration file to the server root or |
|
209 * the default URL, if config file is missing. |
|
210 */ |
|
211 HBufC8* iConfigUrl; |
|
212 |
|
213 /** |
|
214 * URL |
|
215 */ |
|
216 HBufC8* iUrl; |
|
217 |
|
218 HBufC* iDownloadFileName; |
|
219 |
|
220 TBool iAllowForeground; |
|
221 |
|
222 TBool iIsAdmInstalled; |
|
223 |
|
224 TVersion iAdmInstalledVersion; |
|
225 |
|
226 /* |
|
227 * Downloadmanager object |
|
228 */ |
|
229 RHttpDownloadMgr iDownloadManager; |
|
230 |
|
231 CAknGlobalNote* iGlobalWaitNote; |
|
232 |
|
233 CGlobalWaitNoteObserver* iGlobalWaitNoteObserver; |
|
234 |
|
235 TInt iGlobalWaitNoteId; |
|
236 |
|
237 TUint32 iWrapperPackageUid; |
|
238 |
|
239 TBool iPausable; |
|
240 |
|
241 TInt iConnectionAttempts; |
|
242 |
|
243 SwiUI::RSWInstSilentLauncher iLauncher; |
|
244 |
|
245 SwiUI::TInstallOptionsPckg iOptionsPckg; |
|
246 |
|
247 AppState iAppState; |
|
248 |
|
249 TInt iInstallAttempt; |
|
250 |
|
251 CInstallObserver* iInstallObsrv; |
|
252 |
|
253 AdmChangesInfo iAdmChangesInfo; |
|
254 |
|
255 TBool isIapCancelled; |
|
256 |
|
257 INIT_OBJECT_DEBUG_LOG |
|
258 }; |
|
259 |
|
260 #endif // __BootstrapAPPUI_H__ |
|
261 |
|
262 // End of File |
|
263 |