|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Contains CNcdNodeInstall class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_NODE_INSTALL_H |
|
20 #define NCD_NODE_INSTALL_H |
|
21 |
|
22 |
|
23 // For streams |
|
24 #include <s32mem.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 #include "catalogscommunicable.h" |
|
28 #include "ncdnodeclassids.h" |
|
29 #include "catalogsutils.h" |
|
30 #include "ncdinstallationservice.h" |
|
31 |
|
32 class MNcdPreminetProtocolDataEntity; |
|
33 class CNcdInstallInfo; |
|
34 class MNcdPurchaseDetails; |
|
35 class CNcdExtendedInstallInfo; |
|
36 class CNcdNodeMetaData; |
|
37 class MNcdPurchaseDownloadInfo; |
|
38 |
|
39 /** |
|
40 * CNcdNodeInstall does not handle db information directly. The information |
|
41 * is Internalized from the purchase history data and also the data is saved |
|
42 * to the purchase history when the purchase operation progresses. |
|
43 * |
|
44 * This server side class contains the data and the functionality |
|
45 * that the proxy objects will use to internalize itself. |
|
46 * |
|
47 * This object should be added to the session. So, it will be usable |
|
48 * in the proxy side by using the handle gotten during addition. |
|
49 * The handle is used to identify to what object the proxy directs |
|
50 * the function call. When objects are added to sessions, |
|
51 * multiple handles may be gotten for the same object if addition is |
|
52 * done multiple times. |
|
53 * |
|
54 * @lib ?library |
|
55 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
56 */ |
|
57 class CNcdNodeInstall : public CCatalogsCommunicable |
|
58 { |
|
59 |
|
60 public: |
|
61 /** |
|
62 * NewL |
|
63 * |
|
64 * @return CNcdNodeInstall* Pointer to the created object |
|
65 * of this class. |
|
66 */ |
|
67 static CNcdNodeInstall* NewL( const CNcdNodeMetaData& aMetadata ); |
|
68 |
|
69 /** |
|
70 * NewLC |
|
71 * |
|
72 * @return CNcdNodeInstall* Pointer to the created object |
|
73 * of this class. |
|
74 */ |
|
75 static CNcdNodeInstall* NewLC( const CNcdNodeMetaData& aMetadata ); |
|
76 |
|
77 |
|
78 /** |
|
79 * Destructor |
|
80 * |
|
81 * @note Because this is CCatalogsCommunicable function the |
|
82 * session that owns this object should delete this class object. |
|
83 * So, instead of directly deleting this object from some other |
|
84 * class. Close-method should be used instead. |
|
85 */ |
|
86 virtual ~CNcdNodeInstall(); |
|
87 |
|
88 |
|
89 /** |
|
90 * Retrieves the data type that informs what class the data is for. |
|
91 * By checking the data type information, an InternalizeL function |
|
92 * of a right class can be called when the object data is set |
|
93 * from the storage. |
|
94 * The data type may be decided and set in a object that creates this |
|
95 * class object. |
|
96 * |
|
97 * @return NcdNodeClassIds::TNcdNodeClassId Describes the data type. |
|
98 */ |
|
99 NcdNodeClassIds::TNcdNodeClassId ClassId() const; |
|
100 |
|
101 |
|
102 |
|
103 /** |
|
104 * This function is called when the owner of this object |
|
105 * wants to internalize the content according to the data |
|
106 * that has been received from the purchase history. |
|
107 * |
|
108 * @param aDetails Purchase details from purchase history. |
|
109 * @return ETrue if purchase details contained install |
|
110 * data to internalize. |
|
111 */ |
|
112 TBool InternalizeL( const MNcdPurchaseDetails& aDetails ); |
|
113 |
|
114 |
|
115 public: // CCatalogsCommunicable |
|
116 |
|
117 /** |
|
118 * @see CCatalogsCommunicable::ReceiveMessage |
|
119 */ |
|
120 virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage, |
|
121 TInt aFunctionNumber ); |
|
122 |
|
123 /** |
|
124 * @see CCatalogsCommunicable::CounterPartLost |
|
125 */ |
|
126 virtual void CounterPartLost( const MCatalogsSession& aSession ); |
|
127 |
|
128 public: |
|
129 |
|
130 /** |
|
131 * Paths of downloaded files |
|
132 */ |
|
133 const MDesCArray& DownloadedFiles() const; |
|
134 |
|
135 /** |
|
136 * Number of installed content |
|
137 */ |
|
138 TInt ContentCount() const; |
|
139 |
|
140 /** |
|
141 * Returns if the content is available (installed & present) |
|
142 * |
|
143 * @param aIgnoreMissingUri If application doesn't have content URI |
|
144 * it's always considered to be installed |
|
145 */ |
|
146 TNcdApplicationStatus IsContentInstalledL( |
|
147 TInt aIndex, |
|
148 TBool aIgnoreMissingUri ); |
|
149 |
|
150 /** |
|
151 * Checks if all of the content is installed |
|
152 * |
|
153 * @return ETrue if all content files are installed (includes newer versions) |
|
154 */ |
|
155 TBool IsAllContentInstalledL(); |
|
156 |
|
157 |
|
158 /** |
|
159 * Checks if the application specified in content info is installed |
|
160 */ |
|
161 TBool InternalizeContentInfoL(); |
|
162 |
|
163 /** |
|
164 * Returns the content version that was received in downloadableContent's |
|
165 * version attribute. This value is read from purchase history, not |
|
166 * CNcdContentInfo |
|
167 */ |
|
168 const TCatalogsVersion& ContentVersion() const; |
|
169 |
|
170 public: |
|
171 |
|
172 /** |
|
173 * Used for delayed file opening |
|
174 */ |
|
175 void OpenContentFileRunner(); |
|
176 |
|
177 protected: |
|
178 |
|
179 /** |
|
180 * Constructor |
|
181 * @param aClassId Identifies this class. |
|
182 * Is set in the NewLC function |
|
183 */ |
|
184 CNcdNodeInstall( NcdNodeClassIds::TNcdNodeClassId aClassId, |
|
185 const CNcdNodeMetaData& aMetadata ); |
|
186 |
|
187 /** |
|
188 * ConstructL |
|
189 */ |
|
190 virtual void ConstructL(); |
|
191 |
|
192 |
|
193 // These functions are called from the ReceiveMessage when |
|
194 // the given function id has matched to the function. |
|
195 |
|
196 /** |
|
197 * This function is called when the proxy wants to get the |
|
198 * data from the serverside. This function calls the |
|
199 * InternalizeDataForRequestL which may be overloaded in the |
|
200 * child classes |
|
201 * @param aMessage Contains data from the proxy and can be used |
|
202 * to send data back to proxy |
|
203 */ |
|
204 void InternalizeRequestL( MCatalogsBaseMessage& aMessage ); |
|
205 |
|
206 /** |
|
207 * This function writes the object data to the stream. |
|
208 * The stream content will be sent to the proxy that requested the data. |
|
209 * Child classes should add their own data after this parent data. |
|
210 * @param aStream The data content of this class object will be written |
|
211 * into this stream. |
|
212 */ |
|
213 virtual void ExternalizeDataForRequestL( RWriteStream& aStream ); |
|
214 |
|
215 /** |
|
216 * This function is called from the proxy side when the proxy |
|
217 * is deleted. |
|
218 * @param aMessage Contains data from the proxy and can be used |
|
219 * to send data back to proxy |
|
220 */ |
|
221 void ReleaseRequest( MCatalogsBaseMessage& aMessage ) const; |
|
222 |
|
223 /** |
|
224 * This function is called from the proxy side when some application |
|
225 * is installed separately outside of the NCD Engine and the install |
|
226 * status should be updated into the purchase history. |
|
227 * @param aMessage Contains data from the proxy and can be used |
|
228 * to send data back to proxy |
|
229 */ |
|
230 void SetApplicationInstalledRequestL( MCatalogsBaseMessage& aMessage ); |
|
231 |
|
232 protected: |
|
233 |
|
234 void OpenContentFileL( MCatalogsBaseMessage& aMessage ); |
|
235 |
|
236 |
|
237 void OpenContentFileL(); |
|
238 |
|
239 TInt DependencyCount( |
|
240 const TArray<MNcdPurchaseDownloadInfo*>& aInfos ) const; |
|
241 |
|
242 |
|
243 void SetContentType( |
|
244 CNcdExtendedInstallInfo& aInstall, |
|
245 const MNcdPurchaseDownloadInfo& aDownload ) const; |
|
246 |
|
247 void SetLaunchParameterL( |
|
248 RPointerArray<CNcdExtendedInstallInfo>& aInstalls, |
|
249 TInt aIndex ) const; |
|
250 |
|
251 // Sets iContentVersion from aVersion |
|
252 void SetContentVersionL( const TDesC& aVersion ); |
|
253 |
|
254 private: |
|
255 |
|
256 // Prevent these two if they are not implemented |
|
257 CNcdNodeInstall( const CNcdNodeInstall& aObject ); |
|
258 CNcdNodeInstall& operator =( const CNcdNodeInstall& aObject ); |
|
259 |
|
260 |
|
261 |
|
262 private: // data |
|
263 |
|
264 // The class id identifies this class. The id may be used to identify |
|
265 // what kind of class object is created when data is gotten from the db. |
|
266 NcdNodeClassIds::TNcdNodeClassId iClassId; |
|
267 |
|
268 |
|
269 const CNcdNodeMetaData& iMetadata; |
|
270 |
|
271 // The message is set when ReceiveMessage is called. The message |
|
272 // is used in the CounterPartLost-function that informs the message |
|
273 // if the session has been lost. |
|
274 MCatalogsBaseMessage* iMessage; |
|
275 |
|
276 TBool iInstalled; |
|
277 TBool iLaunchable; |
|
278 |
|
279 |
|
280 RPointerArray<CNcdExtendedInstallInfo> iInstallInfos; |
|
281 TUint iPurpose; |
|
282 CDesCArray* iDownloadedFiles; |
|
283 |
|
284 // Install info from Content info |
|
285 CNcdExtendedInstallInfo* iInstalledContent; |
|
286 |
|
287 // Used for delayed file open attempts |
|
288 CPeriodic* iPeriodic; |
|
289 |
|
290 // Current file open attempt number |
|
291 TInt iRetryCount; |
|
292 |
|
293 // File index of the file that is being opened |
|
294 TInt iFileIndex; |
|
295 |
|
296 // Version number from purchase history |
|
297 TCatalogsVersion iContentVersion; |
|
298 }; |
|
299 |
|
300 #endif // NCD_NODE_Install_H |