|
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 the License "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 * Declaration of class RFotaSaver. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef FOTA_SAVER_H |
|
22 #define FOTA_SAVER_H |
|
23 |
|
24 // INCLUDE FILES |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <fotaengine.h> |
|
28 #include "CodSaver.h" |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * FOTA saver. FOTA update package is downloaded to dedicated FOTA store. |
|
34 * Installation is do-nothing (COD just downloads). |
|
35 */ |
|
36 NONSHARABLE_CLASS( CFotaSaver ): public CCodSaver |
|
37 { |
|
38 public: // Construct / destruct |
|
39 |
|
40 /** |
|
41 * Two phase constructor. Leaves on failure. |
|
42 * @param aType Data type. |
|
43 * @param aPkgId FOTA package id. |
|
44 * @return The constructed response. |
|
45 */ |
|
46 static CFotaSaver* NewL( const TDesC8& aType, TInt aPkgId ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CFotaSaver(); |
|
52 |
|
53 public: // from CCodSaver |
|
54 |
|
55 /** |
|
56 * Open temporary store for download. |
|
57 */ |
|
58 virtual void OpenStoreL(); |
|
59 |
|
60 /** |
|
61 * Append data to store. |
|
62 * @param aData Data to append. |
|
63 * @return Error code. |
|
64 */ |
|
65 virtual TInt AppendData( const TDesC8& aData ); |
|
66 |
|
67 /** |
|
68 * Download finished, close temporary store. |
|
69 */ |
|
70 virtual void CloseStore(); |
|
71 |
|
72 /** |
|
73 * Check if attributes of received content match descriptor data. |
|
74 * Leaves with KErrCodAttributeMismatch in case of mismatch. |
|
75 * @param aData Data to match. |
|
76 */ |
|
77 virtual void CheckResponseAttributesL( const CCodData& aData ); |
|
78 |
|
79 /** |
|
80 * Install downloaded content. |
|
81 * @param aStatus Completes when done. |
|
82 * @param aName Preferred name. |
|
83 */ |
|
84 virtual void InstallL( TRequestStatus* aStatus, const TDesC& aName, const TBool aAttached ); |
|
85 |
|
86 /** |
|
87 * BulkInstallL - No support for FOTA |
|
88 */ |
|
89 virtual void BulkInstallL( TRequestStatus* /*aStatus*/, const CCodData &/*aData*/, const TBool /*aAttached*/ ){} |
|
90 /** |
|
91 * Cancel installation. |
|
92 */ |
|
93 virtual void CancelInstall(); |
|
94 |
|
95 /** |
|
96 * Release content (take ownership of content from saver). |
|
97 * @param aFname File name of content returned here. |
|
98 * @param aHandler Handler UID returned here. |
|
99 */ |
|
100 virtual void ReleaseContent( TFileName& aFname, TUid& aHandler ); |
|
101 |
|
102 /** |
|
103 * Get the downloaded file size. |
|
104 */ |
|
105 virtual TInt DownloadedFileSize(); |
|
106 |
|
107 /** |
|
108 * Discard the old contents |
|
109 */ |
|
110 virtual void ResetL(); |
|
111 |
|
112 /** |
|
113 * Clean up. |
|
114 */ |
|
115 virtual void Cleanup( TBool aDeleteFile ); |
|
116 |
|
117 /** |
|
118 * Release file name (take ownership of content from saver). |
|
119 * @param aFname File name of content returned here. |
|
120 */ |
|
121 virtual void ReleaseFileName( TFileName& aFname ); |
|
122 |
|
123 |
|
124 protected: // Construct / destruct |
|
125 |
|
126 /** |
|
127 * Constructor. |
|
128 * @param aType Data type. |
|
129 * @param aPkgId FOTA package id. |
|
130 */ |
|
131 CFotaSaver( const TDesC8& aType, TInt aPkgId ); |
|
132 |
|
133 private: // data |
|
134 |
|
135 RFotaEngineSession iEng; ///< FOTA Engine. Owned. |
|
136 RWriteStream* iStore; ///< FOTA Store. Not owned. |
|
137 TInt iPkgId; ///< FOTA package id. |
|
138 |
|
139 }; |
|
140 |
|
141 #endif /* def FOTA_SAVER_H */ |