9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Fotaengine api |
14 * Description: Fotaengine hdr |
15 * |
15 * |
16 */ |
16 */ |
|
17 |
|
18 |
17 |
19 |
18 #ifndef __FOTAENGINE_H__ |
20 #ifndef __FOTAENGINE_H__ |
19 #define __FOTAENGINE_H__ |
21 #define __FOTAENGINE_H__ |
20 |
22 |
21 // INCLUDES |
23 // INCLUDES |
22 #include <e32std.h> |
24 #include <e32std.h> |
23 #include <e32def.h> |
25 #include <e32def.h> |
|
26 #include <badesca.h> |
|
27 #include <AknServerApp.h> |
24 #include <SyncMLDef.h> |
28 #include <SyncMLDef.h> |
25 |
29 #include <apacmdln.h> |
|
30 #include <apgtask.h> |
|
31 #include <coemain.h> |
|
32 #include <s32file.h> |
|
33 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
34 #include <uikon.hrh> |
|
35 #else |
|
36 #include <uikon.hrh> |
|
37 #include <uiklaf/private/pluginuid.hrh> |
|
38 #endif |
|
39 |
|
40 |
|
41 #include "fotaengstream.h" |
26 #include "fotaConst.h" |
42 #include "fotaConst.h" |
27 #include <s32strm.h> |
|
28 |
43 |
29 // CONSTANTS |
44 // CONSTANTS |
30 /** FOTA Server commands */ |
45 /** FOTA Server commands */ |
31 enum TFotaIPCCmds |
46 enum TFotaIPCCmds |
32 { |
47 { |
33 EFotaDownload, // The download command |
48 EFotaFirstCommand = RApaAppServiceBase::KServiceCmdBase, |
34 EFotaDownloadAndUpdate, // The download and update command |
49 EDeletePackage, |
35 EFotaUpdate, // The update command |
50 EFotaDownload, |
36 EPauseDownload, // The download pause command |
51 EFotaDownloadAndUpdate, |
37 EFotaTryResumeDownload, // The download resume command |
52 EGetResult, |
38 EGetState, // The get state command |
53 EGetState, |
39 EGetResult, // The get result command |
54 EIsPackageStoreSizeAvailable, |
40 EDeletePackage, // The package delete command |
55 EFotaOpenUpdatePackageStore, |
41 EGetUpdateTimestamp, // The get command for updated timestamp |
56 // Command for getting the downloaded & full size of the update package |
42 EGetUpdatePackageIds, // The get command for all package ids |
57 EFotaGetDownloadUpdatePackageSize, |
43 EGenericAlertSentForPackage, // The generic alert sent notification command |
58 // Command to attempt resuming of the download session for downloading the remaining parts of the update package. |
44 EScheduledUpdate, // The schedule update command |
59 // This service is restriced to DM UI and FMS Server. |
45 EGetCurrFwDetails // The get command for reading current firmware package details |
60 EFotaTryResumeDownload, |
46 }; |
61 EFotaUpdate, |
47 |
62 EUpdatePackageDownloadComplete, |
48 /** Fota start up action states */ |
63 EFotaSendChunk, |
|
64 EFotaReleaseChunkHandle, |
|
65 EGetUpdatePackageIds, |
|
66 EGetUpdateTimestamp, |
|
67 EGenericAlertSentForPackage, |
|
68 EScheduledUpdate |
|
69 }; |
|
70 |
|
71 |
49 enum TFotaUpdateStates |
72 enum TFotaUpdateStates |
50 { |
73 { |
51 EFotaDefault, // No action |
74 EFotaDefault, |
52 EFotaPendingGenAlert, // Send pending generic alert |
75 EFotaPendingGenAlert, |
53 EFotaDownloadInterrupted, // Try to resume download |
76 EFotaDownloadInterrupted, |
54 EFotaUpdateInterrupted // Try to resume update |
77 EFotaUpdateInterrupted |
55 }; |
78 }; |
56 |
79 |
57 class TFotaScheduledUpdate; |
80 class TFotaScheduledUpdate; |
58 |
81 |
59 // CLASS DECLARATION |
82 // CLASS DECLARATION |
60 |
83 |
61 /** |
84 /** |
62 * A client handle to a FOTA engine session. |
85 * A client handle to a FOTA engine session. |
63 * @lib fotaengine.lib |
86 * @lib fotaengine.lib |
64 * @since SF4 |
87 * @since Series 60 3.1 |
65 */ |
88 */ |
66 //class RFotaEngineSession : public RAknAppServiceBase // 10.1 changes |
89 class RFotaEngineSession : public RAknAppServiceBase |
67 class RFotaEngineSession : public RSessionBase |
90 { |
68 { |
91 |
69 |
92 friend class TDP2StreamBuf; // TDP2StreamBuf will use iChunk |
70 public: |
93 |
71 // enums |
94 public: // enums |
72 |
95 |
73 /** |
96 /** |
74 * An enumeration of the firmware update progress state codes as specified |
97 * An enumeration of the firmware update progress state codes as specified |
75 * in FUMO spec. |
98 * in FUMO spec. |
76 */ |
99 */ |
77 enum TState |
100 enum TState |
78 { |
101 { |
79 /** No firmware update has been started */ |
102 /** No firmware update has been started */ |
80 EIdle = 10, |
103 EIdle = 10, |
81 /** Client has sent a client initiated request */ |
104 /** Client has sent a client initiated request */ |
82 EClientRequest = 5, |
105 EClientRequest = 5, |
83 /** There is no data available and download is about to start */ |
106 /** There is no data available and download is about to start */ |
84 EStartingDownload = 15, |
107 EStartingDownload = 15, |
85 /** Download failed and there is no data received */ |
108 /** Download failed and there is no data received */ |
86 EDownloadFailed = 20, |
109 EDownloadFailed = 20, |
87 /** Download is progressing without resume support. */ |
110 /** Download is progressing with resume support. This is an internal state and is not a valid FUMO state. |
88 EDownloadProgressing = 30, |
111 * Only DM UI and Fota Server can get this state; others get state 30 instead.*/ |
89 /** Have data and download has been completed successfully */ |
112 EDownloadProgressingWithResume = 25, |
90 EDownloadComplete = 40, |
113 /** Download is progressing without resume support. */ |
91 /** Have data and about to start update */ |
114 EDownloadProgressing = 30, |
92 EStartingUpdate = 50, |
115 /** Have data and download has been completed successfully */ |
93 /** Denotes that the update is currently running, but has not yet |
116 EDownloadComplete = 40, |
94 completed */ |
117 /** Have data and about to start update */ |
95 EUpdateProgressing = 60, |
118 EStartingUpdate = 50, |
96 /** Have data but update failed */ |
119 /** Denotes that the update is currently running, but has not yet |
97 EUpdateFailed = 70, |
120 completed */ |
98 /** Update failed and data deleted or removed */ |
121 EUpdateProgressing = 60, |
99 EUpdateFailedNoData = 80, |
122 /** Have data but update failed */ |
100 /** Update complete and data still available */ |
123 EUpdateFailed = 70, |
101 EUpdateSuccessful = 90, |
124 /** Update failed and data deleted or removed */ |
102 /** Data deleted or removed after a successful update */ |
125 EUpdateFailedNoData = 80, |
103 EUpdateSuccessfulNoData = 100, |
126 /** Update complete and data still available */ |
104 }; |
127 EUpdateSuccessful = 90, |
105 |
128 /** Data deleted or removed after a successful update */ |
106 /** |
129 EUpdateSuccessfulNoData = 100, |
107 * An enumeration of the firmware update result codes as specified |
130 }; |
108 * in the OMA Firmware Update Management Oobject specification. |
131 |
109 */ |
132 /** |
|
133 * An enumeration of the firmware update result codes as specified |
|
134 * in the OMA Firmware Update Management Oobject specification. |
|
135 */ |
|
136 |
110 enum TResult |
137 enum TResult |
111 { |
138 { |
112 /** Requested operation is successful */ |
139 EResSuccessful = 200, |
113 EResSuccessful = 200, |
140 EResUserCancelled = 401, |
114 /** Requested operation is cancelled by user */ |
141 EResCorruptedFWUPD = 402, |
115 EResUserCancelled = 401, |
142 EResPackageMismatch = 403, |
116 /** Firmware update is corrupt */ |
143 EResFailedSignatureAuthentication = 404, |
117 EResCorruptedFWUPD = 402, |
144 EResUndefinedError = 409, |
118 /** Firmware update mismatches with the device */ |
145 EResUpdateFailed = 410, |
119 EResPackageMismatch = 403, |
146 EResMalformedOrBadURL = 411, |
120 /** Not used */ |
147 EResAlternateDLServerUnavailable = 412, |
121 EResFailedSignatureAuthentication = 404, |
148 EResDLFailDueToDeviceOOM = 501, |
122 /** Undefined error occured during the operation */ |
149 EResDLFailDueToNWIssues = 503 |
123 EResUndefinedError = 409, |
|
124 /** Update has failed */ |
|
125 EResUpdateFailed = 410, |
|
126 /** Download failed due to malformed or bad url */ |
|
127 EResMalformedOrBadURL = 411, |
|
128 /** The OMA DL server is unavailable */ |
|
129 EResAlternateDLServerUnavailable = 412, |
|
130 /** Download paused due to out of memory */ |
|
131 EResDLFailDueToDeviceOOM = 501, |
|
132 /** Download paused due to network error */ |
|
133 EResDLFailDueToNWIssues = 503, |
|
134 |
|
135 //Vendor specific errors |
|
136 /** Download failed due to content type mismatch */ |
|
137 EResContentMisMatch = 600, |
|
138 /** Download failed due to invalid OMA DL1.0 descriptor */ |
|
139 EResInvalidDownloadDescriptor = 601, |
|
140 /** Update suspended due to low battery */ |
|
141 EResLowBattery = 602 |
|
142 }; |
150 }; |
143 |
151 |
144 public: |
152 public: // Constructors |
145 // Constructors |
153 |
146 |
154 IMPORT_C RFotaEngineSession(); |
147 IMPORT_C RFotaEngineSession(); |
155 |
148 |
156 public: // new functions |
149 public: |
157 /** |
150 // new functions |
158 * Opens session to Fota Engine |
151 /** |
159 * |
152 * Opens session to Fota Engine |
160 * @since Series 60 3.1 |
153 * |
161 * @param None |
154 * @since SF4 |
162 * @return None |
155 * @param None |
163 */ |
156 * @return None |
164 IMPORT_C void OpenL(); |
|
165 |
|
166 /** |
|
167 * Closes session to Fota Engine |
|
168 * |
|
169 * @since Series 60 3.1 |
|
170 * @param None |
|
171 * @return None |
|
172 */ |
|
173 IMPORT_C void Close(); |
|
174 |
|
175 |
|
176 /** |
|
177 * Called when DM server calls execute command to |
|
178 * Firmware update object URI ./FUMO/<x>/Download |
|
179 * Initiates a firmware download for the specified update package. |
|
180 * |
|
181 * @since Series 60 3.1 |
|
182 * @param aPkgId Unique identifier of the update package. |
|
183 * Mapped to Mgmt URI ./FUMO/<x> in DM Framework |
|
184 * @param aPkgURL Contains the URL where the firmware update package |
|
185 * or download |
|
186 * descriptor is located. This URL is used for |
|
187 * alternative download |
|
188 * mechanism such as Descriptor Based Download. |
|
189 * Mgmt URI ./FUMO/<x>/Download/PkgURL |
|
190 * @param aProfileId ProfileId of the DM server that send the execute |
|
191 * command |
|
192 * @param aPkgName Name associated with the firmware update package, |
|
193 * may be empty |
|
194 * Mgmt URI ./FUMO/<x>/PkgName |
|
195 * @param aPkgVersion Version information for the firmware update |
|
196 * package, |
|
197 * may be empty. |
|
198 * Mgmt URI./FUMO/<x>/PkgVersion |
|
199 * @return Immediate result of the command |
|
200 * KErrNotFound: url doesn't exist |
|
201 */ |
|
202 IMPORT_C TInt Download( |
|
203 const TInt aPkgId |
|
204 ,const TDesC8& aPkgURL |
|
205 ,const TSmlProfileId aProfileId |
|
206 ,const TDesC8& aPkgName |
|
207 ,const TDesC8& aPkgVersion); |
|
208 |
|
209 |
|
210 /** |
|
211 * Called when DM server calls execute command to |
|
212 * Firmware update object URI ./FUMO/<x>/DownloadAndUpdate |
|
213 * Initiates a firmware download and an immediate update for the specified |
|
214 * update package. |
|
215 * |
|
216 * @since Series 60 3.1 |
|
217 * @param aPkgId Unique identifier of the update package. |
|
218 * Mapped to Mgmt URI ./FUMO/<x> in DM Framework |
|
219 * @param aPkgURL Contains the URL where the firmware update package or |
|
220 * download descriptor is located. This URL is used for |
|
221 * alternative download mechanism such as Descriptor |
|
222 * Based Download. |
|
223 * Mgmt URI ./FUMO/<x>/DownloadAndUpdate/PkgURL |
|
224 * @param aProfileId ProfileId of the DM server that send the execute |
|
225 * command |
|
226 * @param aPkgName Name associated with the firmware update package, |
|
227 * may be empty. |
|
228 * Mgmt URI ./FUMO/<x>/PkgName |
|
229 * @param aPkgVersion Version information for the firmware update |
|
230 * package, may be empty. |
|
231 * Mgmt URI./FUMO/<x>/PkgVersion |
|
232 * @return Immediate result of the command |
|
233 */ |
|
234 IMPORT_C TInt DownloadAndUpdate( |
|
235 const TInt aPkgId |
|
236 ,const TDesC8& aPkgURL |
|
237 ,const TSmlProfileId aProfileId |
|
238 ,const TDesC8& aPkgName |
|
239 ,const TDesC8& aPkgVersion); |
|
240 |
|
241 |
|
242 /** |
|
243 * Called when DM server calls execute command to |
|
244 * Firmware update object URI ./FUMO/<x>/Update |
|
245 * Initiates a firmware update for the specified update package. |
|
246 * Firmware Update Package should be already downloaded to the device |
|
247 * either using DM Large Object or OMA OTA download mechanisms. |
|
248 * |
|
249 * @since Series 60 3.1 |
|
250 * @param aPkgId Unique identifier of the update package. |
|
251 * @param aProfileId ProfileId of the DM server that send the execute |
|
252 * command |
|
253 * @param aPkgName Name associated with the firmware update package, may |
|
254 * be empty. |
|
255 * Mgmt URI ./FUMO/<x>/PkgName |
|
256 * @param aPkgVersion Version information for the firmware update |
|
257 * package, may be empty. |
|
258 * Mgmt URI./FUMO/<x>/PkgVersion |
|
259 * @return Immediate result of the command |
|
260 */ |
|
261 IMPORT_C TInt Update( |
|
262 const TInt aPkgId |
|
263 ,const TSmlProfileId aProfileId |
|
264 ,const TDesC8& aPkgName |
|
265 ,const TDesC8& aPkgVersion); |
|
266 |
|
267 |
|
268 /** |
|
269 * Called when DM server is about to start sending |
|
270 * new firmware update package using DM Large Object download. |
|
271 * This function is used to enquire if there is enough space available |
|
272 * for the firmware update package. |
|
273 * e.g when DM server is about to start sending new firmware update package using |
|
274 * DM Large Object download. |
|
275 |
|
276 * |
|
277 * @since Series 60 3.1 |
|
278 * @param aSize Size of the firmware update package. Since |
|
279 * continuation of interrupted downloads is not supported |
|
280 * , this means new update package. |
|
281 * @return ETrue if there is enough space available, EFalse |
|
282 * otherwise |
|
283 */ |
|
284 IMPORT_C TBool IsPackageStoreSizeAvailable( const TInt aSize ); |
|
285 |
|
286 |
|
287 /** |
|
288 * Opens stream to update package storage. |
|
289 * Call UpdatePackageDownloadComplete when package is completely written. |
|
290 * |
|
291 * @since Series 60 3.1 |
|
292 * @param aPkgId Unique identifier of the update package. Download mgr |
|
293 * may use value -1. |
|
294 * @param aPkgStore On return, open stream in which file may be written |
|
295 * to. |
|
296 * @return Immediate result of the command. KErrInUse store is |
|
297 * already opened |
|
298 */ |
|
299 IMPORT_C TInt OpenUpdatePackageStore( const TInt aPkgId |
|
300 , RWriteStream*& aPkgStore ); |
|
301 |
|
302 /** |
|
303 * Gets the downloaded and full size of the update package. |
|
304 * Called by Download Manager during resume operation to know the size of partially downloaded package. |
|
305 * @since Series 60 3.2.2 |
|
306 * @param aPkgId Unique identifier of the update package. |
|
307 * @param aDownloadedSize On return, size of the downloaded package in bytes |
|
308 * @param aTotalSize On return, full size of the download package in bytes |
|
309 * |
|
310 * @return KErrNone when successful, else System wide errors |
|
311 * |
|
312 */ |
|
313 |
|
314 IMPORT_C TInt GetDownloadUpdatePackageSize( const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize ); |
|
315 |
|
316 /** |
|
317 * Requests to resume the suspended download of the update package. |
|
318 * Called by Fota Monitory Service. for ex, when network is available again. |
|
319 * @since Series 60 3.2.2 |
|
320 * @param None |
|
321 * |
|
322 * @return KErrNone when successful, else System wide errors |
|
323 * |
|
324 */ |
|
325 |
|
326 IMPORT_C TInt TryResumeDownload(); |
|
327 |
|
328 |
|
329 /** |
|
330 * Call this when download of update package is completed. In case of |
|
331 * software error or network interruption, this is not called and package |
|
332 * store is left empty. When this is called, fotaengine closes the stream |
|
333 * and associated storage. |
|
334 * |
|
335 * @since Series 60 3.1 |
|
336 * @param aPkgId Unique identifier of the update package. Download |
|
337 * mgr may use value -1. |
|
338 * @return None |
|
339 */ |
|
340 IMPORT_C void UpdatePackageDownloadComplete( const TInt aPkgId ); |
|
341 |
|
342 |
|
343 /** |
|
344 * Called when caller wants to enquire State of specified |
|
345 * firmware update. If the State is unknown to FOTA Engine, then it should |
|
346 * return EIdle. |
|
347 * |
|
348 * @since Series 60 3.1 |
|
349 * @param aPkgId Unique identifier of the update package. |
|
350 * @return State reached by specified firmware update package |
|
351 */ |
|
352 IMPORT_C TState GetState( const TInt aPkgId ); |
|
353 |
|
354 |
|
355 /** |
|
356 * Called when caller wants to enquire Final Result Code of specified |
|
357 * firmware update operation. If the update operation is not yet reached |
|
358 * final stage, then -1 should be returned to the caller. Possible Final |
|
359 * Result Codes are specified in OMA FUMO Specification. Note that Download |
|
360 * operation also ends to final result code e.g. 202 - Successful Download. |
|
361 * |
|
362 * @since Series 60 3.1 |
|
363 * @param aPkgId Unique identifier of the update package. |
|
364 * @return Result code as specified in FUMO specification, -1 if |
|
365 * not yet reached final result. |
|
366 */ |
|
367 IMPORT_C TInt GetResult( const TInt aPkgId ); |
|
368 |
|
369 |
|
370 /** |
|
371 * Called when DM server deletes firmware update management object |
|
372 * from device's management tree. I.e. Delete to mgmt URI ./FUMO/<x>. |
|
373 * If FOTA Engine has not yet deleted specified update package, then it |
|
374 * should do so. |
|
375 * |
|
376 * @since Series 60 3.1 |
|
377 * @param aPkgId Unique identifier of the update package. |
|
378 * @return Result code |
|
379 */ |
|
380 IMPORT_C TInt DeleteUpdatePackage( const TInt aPkgId ); |
|
381 |
|
382 |
|
383 /** |
|
384 * Retrieves the timestamp of last succesful update. |
|
385 * |
|
386 * @since Series 60 3.1 |
|
387 * @param aUpdate On return, contains time of last succesfull update |
|
388 * @return Error code. KErrUnknown if device has never been |
|
389 * updated. |
|
390 */ |
|
391 IMPORT_C TInt LastUpdate( TTime& aUpdate ); |
|
392 |
|
393 /** |
|
394 * Tells device FW version |
|
395 * |
|
396 * @since Series 60 3.1 |
|
397 * @param aSWVersion On return, contains FW version of device. |
|
398 * @return Error code |
|
399 */ |
|
400 IMPORT_C TInt CurrentVersion( TDes& aSWVersion ); |
|
401 |
|
402 /** |
|
403 * Gets IDs of the present update packages. |
|
404 * |
|
405 * @since Series 60 3.1 |
|
406 * @param aPackageIdList On return, contains array of pkg ids |
|
407 * @return Error code |
|
408 */ |
|
409 IMPORT_C TInt GetUpdatePackageIds( TDes16& aPackageIdList ); |
|
410 |
|
411 IMPORT_C TVersion Version() const; |
|
412 |
|
413 |
|
414 /** |
|
415 * Tells fotaserver that generic alert for package is sent. |
|
416 * When fotaengine session is closed, cleanup for package |
|
417 * is done. |
|
418 * |
|
419 * @since Series 60 3.1 |
|
420 * @param aPackageId |
|
421 * @return Error code |
|
422 */ |
|
423 IMPORT_C void GenericAlertSentL( const TInt aPackageID ) ; |
|
424 |
|
425 |
|
426 /** |
|
427 * Like Update, but called by scheduler mechanism. |
|
428 * Needed package details (profile id etc are already known) |
|
429 * |
|
430 * @since Series 60 3.2 |
|
431 * @param aSchedule Schedule data |
|
432 * @return Error code |
|
433 */ |
|
434 IMPORT_C TInt ScheduledUpdateL( TFotaScheduledUpdate aSchedule ); |
|
435 |
|
436 |
|
437 private: // From RApaAppServiceBase |
|
438 |
|
439 /** Returns the UID of the service that this session provides an |
|
440 * interface for. Client side service implementations must implement this |
|
441 * function to return the UID for the service that they implement. |
|
442 * |
|
443 * @since Series 60 3.1 |
|
444 * @param None |
|
445 * @return The UID of the service implemented by the derived class. |
|
446 */ |
|
447 TUid ServiceUid() const; |
|
448 |
|
449 IMPORT_C virtual void ExtensionInterface( |
|
450 TUid aInterfaceId |
|
451 ,TAny*& aImplementation ); |
|
452 |
|
453 private: // New methods |
|
454 |
|
455 /** |
|
456 * Signals the server to read chunk contents |
|
457 * |
|
458 * @since Series 60 3.1 |
|
459 * @param aP1 Pointer to beginning of content |
|
460 * @param aP2 Pointer to end of content |
|
461 * @return |
|
462 **/ |
|
463 void SendChunkL(const TUint8* aP1, const TUint8* aP2); |
|
464 |
|
465 |
|
466 /** |
|
467 * Signals the server to release chunk handle |
|
468 * |
|
469 * @since Series 60 3.1 |
|
470 * @param None |
|
471 * @return |
|
472 **/ |
|
473 TInt ReleaseChunkHandle(); |
|
474 |
|
475 /** |
|
476 * Starts fotaserver server application. |
|
477 * |
|
478 * @since Series 60 3.1 |
|
479 * @param aNameUid Differentiator. |
|
480 * @param aAppServerUid FotaServer app uid |
|
481 * @return None |
|
482 **/ |
|
483 void StartApplicationL( const TUid& aNameUid,const TUid& aAppServerUid ); |
|
484 |
|
485 |
|
486 /** |
|
487 * Connects to running fotaserver instance |
|
488 * |
|
489 * @since Series 60 3.1 |
|
490 * @param aNameUid Differentiator. |
|
491 * @param aAppServerUid FotaServer app uid |
|
492 * @return None |
|
493 **/ |
|
494 void ConnectToServerL( const TUid& aNameUid,const TUid& aAppServerUid ); |
|
495 |
|
496 private: // Data |
|
497 |
|
498 /** |
|
499 * Stream for writing swupd file to chunk |
157 */ |
500 */ |
158 IMPORT_C void OpenL(); |
501 RFotaWriteStream* iStream; |
159 |
502 |
160 /** |
503 /** |
161 * Closes session to Fota Engine |
504 * Chunk for sending swupd contents to fotaserver |
162 * |
|
163 * @since SF4 |
|
164 * @param None |
|
165 * @return None |
|
166 */ |
505 */ |
167 IMPORT_C void Close(); |
506 RChunk iChunk; |
168 |
507 |
169 /** |
|
170 * Called when DM server calls execute command to |
|
171 * Firmware update object URI ./FUMO/<x>/Download |
|
172 * Initiates a firmware download for the specified update package. |
|
173 * |
|
174 * @since SF4 |
|
175 * @param aPkgId Unique identifier of the update package. |
|
176 * Mapped to Mgmt URI ./FUMO/<x> in DM Framework |
|
177 * @param aPkgURL Contains the URL where the firmware update package |
|
178 * or download |
|
179 * descriptor is located. This URL is used for |
|
180 * alternative download |
|
181 * mechanism such as Descriptor Based Download. |
|
182 * Mgmt URI ./FUMO/<x>/Download/PkgURL |
|
183 * @param aProfileId ProfileId of the DM server that send the execute |
|
184 * command |
|
185 * @param aPkgName Name associated with the firmware update package, |
|
186 * may be empty |
|
187 * Mgmt URI ./FUMO/<x>/PkgName |
|
188 * @param aPkgVersion Version information for the firmware update |
|
189 * package, |
|
190 * may be empty. |
|
191 * Mgmt URI./FUMO/<x>/PkgVersion |
|
192 * @param aSilent Decides whether the download has to be silent or not |
|
193 * @return Immediate result of the command |
|
194 * KErrNotFound: url doesn't exist |
|
195 */ |
|
196 IMPORT_C TInt Download(const TInt aPkgId, const TDesC8& aPkgURL, |
|
197 const TSmlProfileId aProfileId, const TDesC8& aPkgName, |
|
198 const TDesC8& aPkgVersion, TBool aSilentDownload = EFalse); |
|
199 |
|
200 /** |
|
201 * Called when DM server calls execute command to |
|
202 * Firmware update object URI ./FUMO/<x>/DownloadAndUpdate |
|
203 * Initiates a firmware download and an immediate update for the specified |
|
204 * update package. |
|
205 * |
|
206 * @since SF4 |
|
207 * @param aPkgId Unique identifier of the update package. |
|
208 * Mapped to Mgmt URI ./FUMO/<x> in DM Framework |
|
209 * @param aPkgURL Contains the URL where the firmware update package or |
|
210 * download descriptor is located. This URL is used for |
|
211 * alternative download mechanism such as Descriptor |
|
212 * Based Download. |
|
213 * Mgmt URI ./FUMO/<x>/DownloadAndUpdate/PkgURL |
|
214 * @param aProfileId ProfileId of the DM server that send the execute |
|
215 * command |
|
216 * @param aPkgName Name associated with the firmware update package, |
|
217 * may be empty. |
|
218 * Mgmt URI ./FUMO/<x>/PkgName |
|
219 * @param aPkgVersion Version information for the firmware update |
|
220 * package, may be empty. |
|
221 * Mgmt URI./FUMO/<x>/PkgVersion |
|
222 * @param aSilent Decides whether the download has to be silent or not |
|
223 * @return Immediate result of the command |
|
224 */ |
|
225 IMPORT_C TInt DownloadAndUpdate(const TInt aPkgId, const TDesC8& aPkgURL, |
|
226 const TSmlProfileId aProfileId, const TDesC8& aPkgName, |
|
227 const TDesC8& aPkgVersion, TBool aSilentDownload = EFalse); |
|
228 |
|
229 /** |
|
230 * Called when DM server calls execute command to |
|
231 * Firmware update object URI ./FUMO/<x>/Update |
|
232 * Initiates a firmware update for the specified update package. |
|
233 * Firmware Update Package should be already downloaded to the device |
|
234 * either using DM Large Object or OMA OTA download mechanisms. |
|
235 * |
|
236 * @since SF4 |
|
237 * @param aPkgId Unique identifier of the update package. |
|
238 * @param aProfileId ProfileId of the DM server that send the execute |
|
239 * command |
|
240 * @param aPkgName Name associated with the firmware update package, may |
|
241 * be empty. |
|
242 * Mgmt URI ./FUMO/<x>/PkgName |
|
243 * @param aPkgVersion Version information for the firmware update |
|
244 * package, may be empty. |
|
245 * Mgmt URI./FUMO/<x>/PkgVersion |
|
246 * @return Immediate result of the command |
|
247 */ |
|
248 IMPORT_C TInt Update(const TInt aPkgId, const TSmlProfileId aProfileId, |
|
249 const TDesC8& aPkgName, const TDesC8& aPkgVersion); |
|
250 |
|
251 /** |
|
252 * Requests to pause the ongoing download. |
|
253 * |
|
254 * @since Symbian 4 |
|
255 * @param None |
|
256 * @return KErrNone if pause is successful, or any system-wide error. |
|
257 */ |
|
258 IMPORT_C TInt PauseDownload(); |
|
259 |
|
260 /** |
|
261 * Requests to resume the suspended download of the update package. |
|
262 * Called by Fota Monitory Service. for ex, when network is available again. |
|
263 * @since 3.2.2 |
|
264 * @param aSilent Decides whether the download has to be silent or not |
|
265 * |
|
266 * @return KErrNone when successful, else System wide errors |
|
267 * |
|
268 */ |
|
269 |
|
270 IMPORT_C TInt TryResumeDownload(TBool aSilentDownload = EFalse); |
|
271 |
|
272 /** |
|
273 * Called when caller wants to enquire State of specified |
|
274 * firmware update. If the State is unknown to FOTA Engine, then it should |
|
275 * return EIdle. |
|
276 * |
|
277 * @since SF4 |
|
278 * @param aPkgId Unique identifier of the update package. |
|
279 * @return State reached by specified firmware update package |
|
280 */ |
|
281 IMPORT_C TState GetState(const TInt aPkgId); |
|
282 |
|
283 /** |
|
284 * Called when caller wants to enquire Final Result Code of specified |
|
285 * firmware update operation. If the update operation is not yet reached |
|
286 * final stage, then -1 should be returned to the caller. Possible Final |
|
287 * Result Codes are specified in OMA FUMO Specification. Note that Download |
|
288 * operation also ends to final result code e.g. 202 - Successful Download. |
|
289 * |
|
290 * @since SF4 |
|
291 * @param aPkgId Unique identifier of the update package. |
|
292 * @return Result code as specified in FUMO specification, -1 if |
|
293 * not yet reached final result. |
|
294 */ |
|
295 IMPORT_C TInt GetResult(const TInt aPkgId); |
|
296 |
|
297 /** |
|
298 * Called when DM server deletes firmware update management object |
|
299 * from device's management tree. I.e. Delete to mgmt URI ./FUMO/<x>. |
|
300 * If FOTA Engine has not yet deleted specified update package, then it |
|
301 * should do so. |
|
302 * |
|
303 * @since SF4 |
|
304 * @param aPkgId Unique identifier of the update package. |
|
305 * @return Result code |
|
306 */ |
|
307 IMPORT_C TInt DeleteUpdatePackage(const TInt aPkgId); |
|
308 |
|
309 /** |
|
310 * Retrieves the timestamp of last succesful update. |
|
311 * |
|
312 * @since SF4 |
|
313 * @param aUpdate On return, contains time of last succesfull update |
|
314 * @return Error code. KErrUnknown if device has never been |
|
315 * updated. |
|
316 */ |
|
317 IMPORT_C TInt LastUpdate(TTime& aUpdate); |
|
318 |
|
319 /** |
|
320 * Tells device FW version |
|
321 * |
|
322 * @since SF4 |
|
323 * @param aSWVersion On return, contains FW version of device. |
|
324 * @return Error code |
|
325 */ |
|
326 IMPORT_C TInt CurrentVersion(TDes& aSWVersion); |
|
327 |
|
328 /** |
|
329 * Gets IDs of the present update packages. |
|
330 * |
|
331 * @since SF4 |
|
332 * @param aPackageIdList On return, contains array of pkg ids |
|
333 * @return Error code |
|
334 */ |
|
335 IMPORT_C TInt GetUpdatePackageIds(TDes16& aPackageIdList); |
|
336 |
|
337 /** |
|
338 * Version of the fota server |
|
339 * |
|
340 * @since SF4 |
|
341 * @return version |
|
342 */ |
|
343 IMPORT_C TVersion Version() const; |
|
344 |
|
345 /** |
|
346 * Tells fotaserver that generic alert for package is sent. |
|
347 * When fotaengine session is closed, cleanup for package |
|
348 * is done. |
|
349 * |
|
350 * @since SF4 |
|
351 * @param aPackageId |
|
352 * @return Error code |
|
353 */ |
|
354 IMPORT_C void GenericAlertSentL(const TInt aPackageID); |
|
355 |
|
356 /** |
|
357 * Like Update, but called by scheduler mechanism. |
|
358 * Needed package details (profile id etc are already known) |
|
359 * |
|
360 * @since 3.2 |
|
361 * @param aSchedule Schedule data |
|
362 * @return Error code |
|
363 */ |
|
364 IMPORT_C TInt ScheduledUpdateL(TFotaScheduledUpdate aSchedule); |
|
365 |
|
366 /** |
|
367 * Gets the details for current/last firmware update. |
|
368 * |
|
369 * @since SF4 |
|
370 * @param aName - name of the firmware |
|
371 * @param aVersion - version of the firmware |
|
372 * @param aSize - size of the firmware in bytes |
|
373 * @return, on return all the params would be filled. Can leave with system wide error. |
|
374 */ |
|
375 IMPORT_C void GetCurrentFirmwareDetailsL(TDes8& aName, TDes8& aVersion, |
|
376 TInt& aSize); |
|
377 |
|
378 IMPORT_C TBool IsPackageStoreSizeAvailable(const TInt aSize); |
|
379 |
508 |
380 |
|
381 IMPORT_C TInt OpenUpdatePackageStore(const TInt aPkgId |
|
382 ,RWriteStream*& aPkgStore); |
|
383 |
|
384 IMPORT_C TInt GetDownloadUpdatePackageSize(const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize); |
|
385 |
|
386 IMPORT_C void UpdatePackageDownloadComplete( |
|
387 const TInt aPkgId); |
|
388 |
|
389 private: |
|
390 |
|
391 /** Returns the UID of the service that this session provides an |
|
392 * interface for. Client side service implementations must implement this |
|
393 * function to return the UID for the service that they implement. |
|
394 * |
|
395 * @since SF4 |
|
396 * @param None |
|
397 * @return The UID of the service implemented by the derived class. |
|
398 */ |
|
399 TUid ServiceUid() const; |
|
400 |
|
401 |
|
402 private: |
|
403 |
|
404 /** |
|
405 * Starts fotaserver server application. |
|
406 * |
|
407 * @since SF4 |
|
408 * @param aNameUid Differentiator. |
|
409 * @param aAppServerUid FotaServer app uid |
|
410 * @return None |
|
411 **/ |
|
412 void StartApplicationL(const TUid& aNameUid, const TUid& aAppServerUid); |
|
413 |
|
414 |
|
415 /** |
|
416 * Connects to the server |
|
417 * |
|
418 * @since SF4 |
|
419 * @return KErrNone if successful, otherwise system wide errors |
|
420 **/ |
|
421 |
|
422 TBool connectToHbServer(); |
|
423 |
|
424 private: // Data |
|
425 |
|
426 |
|
427 /** |
509 /** |
428 * If not -1 , indicates that generic alert has been sent for this package |
510 * If not -1 , indicates that generic alert has been sent for this package |
429 */ |
511 */ |
430 TInt iGenericAlertSentPkgID; |
512 TInt iGenericAlertSentPkgID; |
431 |
513 |
432 }; |
514 }; |
|
515 |
433 |
516 |
434 #endif // __FOTAENGINE_H__ |
517 #endif // __FOTAENGINE_H__ |