|
1 /* |
|
2 * Copyright (c) 2006 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 CNcdNodeScreenshot class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_NODE_SCREENSHOT_H |
|
20 #define NCD_NODE_SCREENSHOT_H |
|
21 |
|
22 |
|
23 // For streams |
|
24 #include <s32mem.h> |
|
25 |
|
26 #include "ncdcommunicable.h" |
|
27 #include "ncdstoragedataitem.h" |
|
28 #include "ncdnodeclassids.h" |
|
29 #include "ncdutils.h" |
|
30 |
|
31 class CNcdNodeManager; |
|
32 class CNcdNodeMetaData; |
|
33 class MNcdPreminetProtocolDataEntity; |
|
34 class MNcdPreminetProtocolDownload; |
|
35 |
|
36 |
|
37 /** |
|
38 * This server side class contains the data and the functionality |
|
39 * that the proxy objects will use to internalize itself. |
|
40 * |
|
41 * This object should be added to the session. So, it will be usable |
|
42 * in the proxy side by using the handle gotten during addition. |
|
43 * The handle is used to identify to what object the proxy directs |
|
44 * the function call. When objects are added to sessions, |
|
45 * multiple handles may be gotten for the same object if addition is |
|
46 * done multiple times. |
|
47 * |
|
48 * @lib ?library |
|
49 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
50 */ |
|
51 class CNcdNodeScreenshot : public CNcdCommunicable, |
|
52 public MNcdStorageDataItem |
|
53 { |
|
54 |
|
55 public: |
|
56 /** |
|
57 * NewL |
|
58 * |
|
59 * @return CNcdNodeScreenshot* Pointer to the created object |
|
60 * of this class. |
|
61 */ |
|
62 static CNcdNodeScreenshot* NewL( |
|
63 CNcdNodeManager& aNodeManager, |
|
64 const CNcdNodeMetaData& aParentMetaData ); |
|
65 |
|
66 /** |
|
67 * NewLC |
|
68 * |
|
69 * @return CNcdNodeScreenshot* Pointer to the created object |
|
70 * of this class. |
|
71 */ |
|
72 static CNcdNodeScreenshot* NewLC( |
|
73 CNcdNodeManager& aNodeManager, |
|
74 const CNcdNodeMetaData& aParentMetaData ); |
|
75 |
|
76 |
|
77 /** |
|
78 * Destructor |
|
79 * |
|
80 * @note Because this is CCatalogsCommunicable function the |
|
81 * session that owns this object should delete this class object. |
|
82 * So, instead of directly deleting this object from some other |
|
83 * class. Close-method should be used instead. |
|
84 */ |
|
85 virtual ~CNcdNodeScreenshot(); |
|
86 |
|
87 |
|
88 /** |
|
89 * Retrieves the data type that informs what class the data is for. |
|
90 * By checking the data type information, an InternalizeL function |
|
91 * of a right class can be called when the object data is set |
|
92 * from the storage. |
|
93 * The data type may be decided and set in a object that creates this |
|
94 * class object. |
|
95 * |
|
96 * @return NcdNodeClassIds::TNcdNodeClassId Describes the data type. |
|
97 */ |
|
98 NcdNodeClassIds::TNcdNodeClassId ClassId() const; |
|
99 |
|
100 |
|
101 /** |
|
102 * Count of screenshot downloads. Use this to determine how many |
|
103 * screenshot downloads it is possible to get from ScreenshotDownload() |
|
104 * function. |
|
105 * |
|
106 * @return Screenshot download count. |
|
107 */ |
|
108 TInt ScreenshotDownloadCount() const; |
|
109 |
|
110 |
|
111 /** |
|
112 * Get specific screenshot download URI |
|
113 * |
|
114 * @param aIndex Index of the screenshot download. |
|
115 * @return Download URI |
|
116 */ |
|
117 const TDesC& ScreenshotDownloadUri( TInt aIndex ) const; |
|
118 |
|
119 |
|
120 /** |
|
121 * This function is called when the owner of this object |
|
122 * wants to internalize the content according to the data |
|
123 * that has been received from the parser. |
|
124 * |
|
125 * @param aData The data is set in the protocol parser and can |
|
126 * be used to initialize this class object. |
|
127 */ |
|
128 void InternalizeL( MNcdPreminetProtocolDataEntity& aData ); |
|
129 |
|
130 |
|
131 public: // MNcdStorageDataItem |
|
132 |
|
133 // These functions are used to get the data from and to insert the data |
|
134 // into the database using by the given stream. |
|
135 |
|
136 /** |
|
137 * @see MNcdStorageDataItem::ExternalizeL |
|
138 */ |
|
139 virtual void ExternalizeL( RWriteStream& aStream ); |
|
140 |
|
141 |
|
142 /** |
|
143 * @see MNcdStorageDataItem::InternalizeL |
|
144 */ |
|
145 virtual void InternalizeL( RReadStream& aStream ); |
|
146 |
|
147 |
|
148 public: // CCatalogsCommunicable |
|
149 |
|
150 /** |
|
151 * @see CCatalogsCommunicable::ReceiveMessage |
|
152 */ |
|
153 virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage, |
|
154 TInt aFunctionNumber ); |
|
155 |
|
156 /** |
|
157 * @see CCatalogsCommunicable::CounterPartLost |
|
158 */ |
|
159 virtual void CounterPartLost( const MCatalogsSession& aSession ); |
|
160 |
|
161 |
|
162 protected: |
|
163 |
|
164 /** |
|
165 * Constructor |
|
166 * @param aClassId Identifies this class. |
|
167 * Is set in the NewLC function |
|
168 */ |
|
169 CNcdNodeScreenshot( |
|
170 NcdNodeClassIds::TNcdNodeClassId aClassId, |
|
171 CNcdNodeManager& aNodeManager, |
|
172 const CNcdNodeMetaData& aParentMetaData ); |
|
173 |
|
174 /** |
|
175 * ConstructL |
|
176 */ |
|
177 virtual void ConstructL(); |
|
178 |
|
179 |
|
180 // These functions are called from the ReceiveMessage when |
|
181 // the given function id has matched to the function. |
|
182 |
|
183 /** |
|
184 * This function is called when the proxy wants to get the |
|
185 * data from the serverside. This function calls the |
|
186 * InternalizeDataForRequestL which may be overloaded in the |
|
187 * child classes |
|
188 * @param aMessage Contains data from the proxy and can be used |
|
189 * to send data back to proxy |
|
190 */ |
|
191 void InternalizeRequestL( MCatalogsBaseMessage& aMessage ); |
|
192 |
|
193 /** |
|
194 * This function writes the object data to the stream. |
|
195 * The stream content will be sent to the proxy that requested the data. |
|
196 * Child classes should add their own data after this parent data. |
|
197 * @param aStream The data content of this class object will be written |
|
198 * into this stream. |
|
199 */ |
|
200 virtual void ExternalizeDataForRequestL( RWriteStream& aStream ); |
|
201 |
|
202 /** |
|
203 * This function is called when the proxy wants to get the |
|
204 * screenshot data from the serverside. |
|
205 * @param aMessage Contains data from the proxy and can be used |
|
206 * to send data back to proxy. |
|
207 */ |
|
208 void ScreenshotDataRequestL( MCatalogsBaseMessage& aMessage ); |
|
209 |
|
210 /** |
|
211 * This function is called from the proxy side. When the proxy |
|
212 * is deleted. |
|
213 * @param aMessage Contains data from the proxy and can be used |
|
214 * to send data back to proxy |
|
215 */ |
|
216 void ReleaseRequest( MCatalogsBaseMessage& aMessage ) const; |
|
217 |
|
218 |
|
219 private: |
|
220 |
|
221 // Prevent these two if they are not implemented |
|
222 CNcdNodeScreenshot( const CNcdNodeScreenshot& aObject ); |
|
223 CNcdNodeScreenshot& operator =( const CNcdNodeScreenshot& aObject ); |
|
224 |
|
225 |
|
226 private: // data |
|
227 |
|
228 // The class id identifies this class. The id may be used to identify |
|
229 // what kind of class object is created when data is gotten from the db. |
|
230 NcdNodeClassIds::TNcdNodeClassId iClassId; |
|
231 |
|
232 // Node manager. |
|
233 CNcdNodeManager& iNodeManager; |
|
234 |
|
235 // Parent meta data. |
|
236 const CNcdNodeMetaData& iParentMetaData; |
|
237 |
|
238 |
|
239 // The message is set when ReceiveMessage is called. The message |
|
240 // is used in the CounterPartLost-function that informs the message |
|
241 // if the session has been lost. |
|
242 MCatalogsBaseMessage* iMessage; |
|
243 |
|
244 // Key = URI, Value = Mime type |
|
245 RPointerArray<CNcdKeyValuePair> iScreenshotDownload; |
|
246 }; |
|
247 |
|
248 #endif // NCD_NODE_SCREENSHOT_H |