|
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 CNcdNodeContentInfo class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_NCDNODECONTENTINFO_H |
|
20 #define C_NCDNODECONTENTINFO_H |
|
21 |
|
22 |
|
23 // For streams |
|
24 #include <s32mem.h> |
|
25 |
|
26 #include "ncdcommunicable.h" |
|
27 #include "ncdstoragedataitem.h" |
|
28 #include "ncdnodeclassids.h" |
|
29 |
|
30 |
|
31 class MNcdPreminetProtocolDataEntity; |
|
32 class MNcdPurchaseDetails; |
|
33 |
|
34 _LIT( KNcdContentPurposeMusic, "music" ); |
|
35 _LIT( KNcdContentPurposeRingtone, "ringtone" ); |
|
36 _LIT( KNcdContentPurposeWallpaper, "wallpaper" ); |
|
37 _LIT( KNcdContentPurposeVideo, "video" ); |
|
38 _LIT( KNcdContentPurposeTheme, "theme" ); |
|
39 _LIT( KNcdContentPurposeApplication, "application" ); |
|
40 _LIT( KNcdContentPurposeHtmlPage, "html-page" ); |
|
41 _LIT( KNcdContentPurposeGame, "game" ); |
|
42 _LIT( KNcdContentPurposeScreensaver, "screensaver" ); |
|
43 _LIT( KNcdContentPurposeStream, "stream" ); |
|
44 |
|
45 /** |
|
46 * This server side class contains the data and the functionality |
|
47 * that the proxy objects will use to internalize itself. |
|
48 * |
|
49 * This object should be added to the session. So, it will be usable |
|
50 * in the proxy side by using the handle gotten during addition. |
|
51 * The handle is used to identify to what object the proxy directs |
|
52 * the function call. When objects are added to sessions, |
|
53 * multiple handles may be gotten for the same object if addition is |
|
54 * done multiple times. |
|
55 * |
|
56 * @lib ?library |
|
57 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
58 */ |
|
59 class CNcdNodeContentInfo : public CNcdCommunicable, |
|
60 public MNcdStorageDataItem |
|
61 { |
|
62 public: |
|
63 /** |
|
64 * NewL |
|
65 * |
|
66 * @return CNcdNodeContentInfo* Pointer to the created object |
|
67 * of this class. |
|
68 */ |
|
69 static CNcdNodeContentInfo* NewL(); |
|
70 |
|
71 /** |
|
72 * NewLC |
|
73 * |
|
74 * @return CNcdNodeContentInfo* Pointer to the created object |
|
75 * of this class. |
|
76 */ |
|
77 static CNcdNodeContentInfo* NewLC(); |
|
78 |
|
79 |
|
80 /** |
|
81 * Destructor |
|
82 * |
|
83 * @note Because this is CCatalogsCommunicable function the |
|
84 * session that owns this object should delete this class object. |
|
85 * So, instead of directly deleting this object from some other |
|
86 * class. Close-method should be used instead. |
|
87 */ |
|
88 virtual ~CNcdNodeContentInfo(); |
|
89 |
|
90 |
|
91 /** |
|
92 * Retrieves the data type that informs what class the data is for. |
|
93 * By checking the data type information, an InternalizeL function |
|
94 * of a right class can be called when the object data is set |
|
95 * from the storage. |
|
96 * The data type may be decided and set in a object that creates this |
|
97 * class object. |
|
98 * |
|
99 * @return NcdNodeClassIds::TNcdNodeClassId Describes the data type. |
|
100 */ |
|
101 NcdNodeClassIds::TNcdNodeClassId ClassId() const; |
|
102 |
|
103 |
|
104 /** |
|
105 * The purpose of the node. |
|
106 * |
|
107 * @return Bit field describing the purpose(s) of this node, a combination |
|
108 * of TNcdItemPurpose flags. |
|
109 * @see TNcdItemPurpose |
|
110 */ |
|
111 TUint Purpose() const; |
|
112 |
|
113 |
|
114 /** |
|
115 * Gives the mime type of the content data. |
|
116 * |
|
117 * @return The mime type of the download content data. The type is |
|
118 * given as a text according to the standards that define MIME types. |
|
119 */ |
|
120 const TDesC& MimeType() const; |
|
121 |
|
122 |
|
123 /** |
|
124 * This function is the indicative Symbian application UID for the |
|
125 * contents that are applications. This can be used e.g. for checking |
|
126 * if the application has already been installed to the phone. |
|
127 * |
|
128 * @return The UID of the application item. |
|
129 */ |
|
130 const TUid& Uid() const; |
|
131 |
|
132 |
|
133 /** |
|
134 * Different versions of the content items may exist. Thus, |
|
135 * a version identifier may be defined for the item. When installing |
|
136 * applications the version may be required. |
|
137 * |
|
138 * @return Version string of this application item. |
|
139 * If the protocol has not defined |
|
140 * any value, an empty string is returned. |
|
141 */ |
|
142 const TDesC& Version() const; |
|
143 |
|
144 /** |
|
145 * Gives the total content size of the item in bytes. |
|
146 * |
|
147 * @return The content size or 0 if not defined. |
|
148 */ |
|
149 TInt TotalContentSize() const; |
|
150 |
|
151 |
|
152 /** |
|
153 * This function is called when the owner of this object |
|
154 * wants to internalize the content according to the data |
|
155 * that has been received from the parser. |
|
156 * |
|
157 * @param aData The data is set in the protocol parser and can |
|
158 * be used to initialize this class object. |
|
159 */ |
|
160 void InternalizeL( MNcdPreminetProtocolDataEntity& aData ); |
|
161 |
|
162 /** |
|
163 * Internalizes content info from purchase details |
|
164 */ |
|
165 void InternalizeL( const MNcdPurchaseDetails& aDetails ); |
|
166 |
|
167 public: // MNcdStorageDataItem |
|
168 |
|
169 // These functions are used to get the data from and to insert the data |
|
170 // into the database using by the given stream. |
|
171 |
|
172 /** |
|
173 * @see MNcdStorageDataItem::ExternalizeL |
|
174 */ |
|
175 virtual void ExternalizeL( RWriteStream& aStream ); |
|
176 |
|
177 |
|
178 /** |
|
179 * @see MNcdStorageDataItem::InternalizeL |
|
180 */ |
|
181 virtual void InternalizeL( RReadStream& aStream ); |
|
182 |
|
183 |
|
184 public: // CCatalogsCommunicable |
|
185 |
|
186 /** |
|
187 * @see CCatalogsCommunicable::ReceiveMessage |
|
188 */ |
|
189 virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage, |
|
190 TInt aFunctionNumber ); |
|
191 |
|
192 /** |
|
193 * @see CCatalogsCommunicable::CounterPartLost |
|
194 */ |
|
195 virtual void CounterPartLost( const MCatalogsSession& aSession ); |
|
196 |
|
197 |
|
198 protected: |
|
199 |
|
200 /** |
|
201 * Constructor |
|
202 * @param aClassId Identifies this class. |
|
203 * Is set in the NewLC function |
|
204 */ |
|
205 CNcdNodeContentInfo( NcdNodeClassIds::TNcdNodeClassId aClassId ); |
|
206 |
|
207 /** |
|
208 * ConstructL |
|
209 */ |
|
210 void ConstructL(); |
|
211 |
|
212 |
|
213 // These functions are called from the ReceiveMessage when |
|
214 // the given function id has matched to the function. |
|
215 |
|
216 /** |
|
217 * This function is called when the proxy wants to get the |
|
218 * data from the serverside. This function calls the |
|
219 * InternalizeDataForRequestL which may be overloaded in the |
|
220 * child classes |
|
221 * @param aMessage Contains data from the proxy and can be used |
|
222 * to send data back to proxy |
|
223 */ |
|
224 void InternalizeRequestL( MCatalogsBaseMessage& aMessage ); |
|
225 |
|
226 /** |
|
227 * This function writes the object data to the stream. |
|
228 * The stream content will be sent to the proxy that requested the data. |
|
229 * Child classes should add their own data after this parent data. |
|
230 * @param aStream The data content of this class object will be written |
|
231 * into this stream. |
|
232 */ |
|
233 void ExternalizeDataForRequestL( RWriteStream& aStream ); |
|
234 |
|
235 /** |
|
236 * This function is called from the proxy side. When the proxy |
|
237 * is deleted. |
|
238 * @param aMessage Contains data from the proxy and can be used |
|
239 * to send data back to proxy |
|
240 */ |
|
241 void ReleaseRequest( MCatalogsBaseMessage& aMessage ) const; |
|
242 |
|
243 |
|
244 private: |
|
245 |
|
246 // Prevent these two if they are not implemented |
|
247 CNcdNodeContentInfo( const CNcdNodeContentInfo& aObject ); |
|
248 CNcdNodeContentInfo& operator =( const CNcdNodeContentInfo& aObject ); |
|
249 |
|
250 |
|
251 private: // data |
|
252 |
|
253 // The class id identifies this class. The id may be used to identify |
|
254 // what kind of class object is created when data is gotten from the db. |
|
255 NcdNodeClassIds::TNcdNodeClassId iClassId; |
|
256 |
|
257 // The message is set when ReceiveMessage is called. The message |
|
258 // is used in the CounterPartLost-function that informs the message |
|
259 // if the session has been lost. |
|
260 MCatalogsBaseMessage* iMessage; |
|
261 |
|
262 TUint iPurpose; |
|
263 HBufC* iMimeType; |
|
264 TUid iUid; |
|
265 HBufC* iVersion; |
|
266 TInt iSize; |
|
267 |
|
268 }; |
|
269 |
|
270 #endif // C_NCDNODECONTENTINFO_H |