|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Client application preferencies container class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef HTTPCLIENTAPPINSTANCE_H |
|
21 #define HTTPCLIENTAPPINSTANCE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "HttpDownloadMgrCommon.h" |
|
25 |
|
26 #include <e32base.h> |
|
27 |
|
28 // CONSTANTS |
|
29 //const ?type ?constant_var = ?constant; |
|
30 |
|
31 // MACROS |
|
32 //#define ?macro ?macro_def |
|
33 |
|
34 // DATA TYPES |
|
35 //enum ?declaration |
|
36 //typedef ?declaration |
|
37 //extern ?data_type; |
|
38 |
|
39 // FUNCTION PROTOTYPES |
|
40 //?type ?function_name(?arg_list); |
|
41 |
|
42 // FORWARD DECLARATIONS |
|
43 class CHttpDownload; |
|
44 class CHttpClientApp; |
|
45 class CHttpConnHandler; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 // CLASS DECLARATION |
|
50 class MDownloadStateObserver |
|
51 { |
|
52 public: |
|
53 |
|
54 virtual void Event( CHttpDownload* aDownload, |
|
55 THttpDownloadState aDlState, |
|
56 THttpProgressState aProgState, |
|
57 TInt32 aMoIndex ) = 0; |
|
58 }; |
|
59 |
|
60 /** |
|
61 * ?one_line_short_description. |
|
62 * ?other_description_lines |
|
63 * |
|
64 * @lib ?library |
|
65 * @since Series 60 2.8 |
|
66 */ |
|
67 NONSHARABLE_CLASS( CHttpClientAppInstance ) : public CBase |
|
68 { |
|
69 public: // Constructors and destructor |
|
70 |
|
71 /** |
|
72 * Two-phased constructor. |
|
73 */ |
|
74 static CHttpClientAppInstance* NewL( CHttpClientApp* aClientApp, |
|
75 CHttpConnHandler* aConnHandler, |
|
76 TBool aMaster, |
|
77 TInt aInstanceId = 0, |
|
78 MDownloadStateObserver* aObserver = NULL ); |
|
79 |
|
80 /** |
|
81 * Destructor. |
|
82 */ |
|
83 virtual ~CHttpClientAppInstance(); |
|
84 |
|
85 public: // New functions |
|
86 |
|
87 /** |
|
88 * This function is only for internal test usage. |
|
89 * Do NOT use it!!! |
|
90 * @since Series 60 2.8 |
|
91 * @param aObserver download state observer |
|
92 */ |
|
93 IMPORT_C void SetObserver( MDownloadStateObserver* aObserver ); |
|
94 |
|
95 /** |
|
96 * Search for a download that is already registered with the given URL. |
|
97 * If found this dowload object is return. NULL anyway. |
|
98 * @since Series 60 2.8 |
|
99 * @param aUrl URL to be searched for |
|
100 * @return download object registered with this URL or NULL. |
|
101 */ |
|
102 IMPORT_C CHttpDownload* SearchDownloadWithUrl( const TDesC8& aUrl ); |
|
103 |
|
104 /** |
|
105 * Creates a new download with the given URL. |
|
106 * |
|
107 * @since Series 60 2.8 |
|
108 * @param aURL URL address of this download |
|
109 * @return a new created download object |
|
110 */ |
|
111 IMPORT_C CHttpDownload* CreateNewDownloadL( const TDesC8& aUrl ); |
|
112 |
|
113 /** |
|
114 * Get pointer to a download object that is already created, |
|
115 * and identified with the id. |
|
116 * |
|
117 * @since Series 60 3.2 |
|
118 * @param aDownloadId id of the download attached to |
|
119 * @return download object identified with the id |
|
120 */ |
|
121 IMPORT_C CHttpDownload* AttachDownloadL( TInt32 aDownloadId ); |
|
122 |
|
123 /** |
|
124 * Returns array of the downloads owned by this client |
|
125 * instance. |
|
126 * Ownership is passed to the caller. |
|
127 * @since Series S60 2.8 |
|
128 * @return pointer to an array of the downloads owned by this client instance |
|
129 */ |
|
130 IMPORT_C CArrayPtrFlat<CHttpDownload>* DownloadsL() const; |
|
131 |
|
132 /** |
|
133 * Returns the UId of this application |
|
134 * @since Series 60 2.8 |
|
135 * @return UId of this application |
|
136 */ |
|
137 IMPORT_C TUint32 AppUid() const; |
|
138 |
|
139 /** |
|
140 * Gets the value for a TInt attribute. |
|
141 * @param aAttribute Identifies the attribute to be retrived. |
|
142 * @param aValue On completion, contains the requested TInt attribute. |
|
143 * @return void. |
|
144 */ |
|
145 IMPORT_C void GetIntAttributeL( THttpDownloadMgrAttrib aAttribute, |
|
146 TInt32& aValue ); |
|
147 |
|
148 /** |
|
149 * Gets the value for a TBool attribute. |
|
150 * @param aAttribute Identifies the attribute to be retrived. |
|
151 * @param aValue On completion, contains the requested TBool attribute. |
|
152 * @return pointer to the string attribute. |
|
153 */ |
|
154 IMPORT_C void GetBoolAttributeL( THttpDownloadMgrAttrib aAttribute, |
|
155 TBool& aValue ); |
|
156 |
|
157 /** |
|
158 * Gets the value for a string attribute. |
|
159 * @param aAttribute Identifies the attribute to be retrived. |
|
160 * @param aDelete ETrue if returned buffer has to be deleted. |
|
161 * @return pointer to the string attribute. |
|
162 */ |
|
163 IMPORT_C HBufC* GetStringAttributeL( THttpDownloadMgrAttrib aAttribute, |
|
164 TBool& aDelete ); |
|
165 |
|
166 /** |
|
167 * Gets the value for a string attribute. |
|
168 * @param aAttribute Identifies the attribute to be retrived. |
|
169 * @param aDelete ETrue if returned buffer has to be deleted. |
|
170 * @return void. |
|
171 */ |
|
172 IMPORT_C HBufC8* GetString8AttributeL( THttpDownloadMgrAttrib aAttribute, |
|
173 TBool& aDelete ); |
|
174 |
|
175 /** |
|
176 * Sets the value for a TInt attribute. |
|
177 * @param aAttribute Identifies the attribute to be set. |
|
178 * @param aValue The value to be set. |
|
179 * @return KErrNone if successful, a system-wide error code if not. |
|
180 */ |
|
181 IMPORT_C void SetIntAttributeL( THttpDownloadMgrAttrib aAttribute, |
|
182 const TInt32 aValue ); |
|
183 |
|
184 /** |
|
185 * Sets the value for a TBool attribute. |
|
186 * This method can be used to stop a connection (KConnectionStop). |
|
187 * @param aAttribute Identifies the attribute to be set. |
|
188 * @param aValue The value to be set. |
|
189 */ |
|
190 IMPORT_C void SetBoolAttributeL( THttpDownloadMgrAttrib aAttribute, |
|
191 const TBool aValue ); |
|
192 |
|
193 /** |
|
194 * Sets the value for a string attribute. |
|
195 * @param aAttribute Identifies the attribute to be set. |
|
196 * @param aValue The string value to be set. Must be a 16-bit descriptor!. |
|
197 */ |
|
198 IMPORT_C void SetStringAttributeL( THttpDownloadMgrAttrib aAttribute, |
|
199 const TDesC16& aValue ); |
|
200 |
|
201 /** |
|
202 * Sets the value for a string attribute. |
|
203 * @param aAttribute Identifies the attribute to be set. |
|
204 * @param aValue The string value to be set. Must be a 16-bit descriptor!. |
|
205 */ |
|
206 IMPORT_C void SetStringAttributeL( THttpDownloadMgrAttrib aAttribute, |
|
207 const TDesC8& aValue ); |
|
208 |
|
209 /** |
|
210 * Disconnects the instance's connection and pauses all downloads. |
|
211 * @since Series 60 2.8 |
|
212 * @return none |
|
213 */ |
|
214 IMPORT_C void Disconnect(); |
|
215 |
|
216 /** |
|
217 * Returns the client application object. |
|
218 * @since Series 60 2.8 |
|
219 * @return pointer to the client application object. Ownership not passed. |
|
220 */ |
|
221 IMPORT_C CHttpClientApp* ClientApp() const; |
|
222 |
|
223 |
|
224 /** |
|
225 * Returns the id of this client instance |
|
226 * @since Series 60 2.8 |
|
227 * @return id of this client instance |
|
228 */ |
|
229 TInt InstanceId() const; |
|
230 |
|
231 |
|
232 /** |
|
233 * Returns the connection handler of this instance. |
|
234 * @since Series 60 2.8 |
|
235 * @return pointer to the connection handler of this instance. Ownership not passed. |
|
236 */ |
|
237 CHttpConnHandler* ConnHandler() const; |
|
238 |
|
239 /** |
|
240 * Returns the state observer of this instance. |
|
241 * @since Series 60 2.8 |
|
242 * @return pointer to the state observer. Ownership not passed. |
|
243 */ |
|
244 MDownloadStateObserver* Observer() const; |
|
245 |
|
246 /** |
|
247 * Return the exit action attribute. |
|
248 * @since Series 60 2.8 |
|
249 * @return exit action. |
|
250 */ |
|
251 THttpDownloadMgrExitAction ExitAction() const; |
|
252 |
|
253 /** |
|
254 * Returns master attribute. |
|
255 * @since Series 60 2.8 |
|
256 * @return master attribute. |
|
257 */ |
|
258 TBool Master() const; |
|
259 |
|
260 /** |
|
261 * Returns cookie usage setting. |
|
262 * @return ETrue if cookie usage is enabled. |
|
263 */ |
|
264 TBool Cookies() const; |
|
265 |
|
266 /** |
|
267 * Returns auto connectn setting. |
|
268 * @return ETrue if auto-connect enabled. |
|
269 */ |
|
270 TBool AutoConnect() const; |
|
271 |
|
272 public: // Functions from base classes |
|
273 |
|
274 protected: // New functions |
|
275 |
|
276 protected: // Functions from base classes |
|
277 |
|
278 private: |
|
279 |
|
280 /** |
|
281 * C++ default constructor. |
|
282 */ |
|
283 CHttpClientAppInstance( CHttpClientApp* aClientApp, |
|
284 CHttpConnHandler* aConnHandler, |
|
285 TBool aMaster, |
|
286 TInt aInstanceId, |
|
287 MDownloadStateObserver* aObserver ); |
|
288 |
|
289 /** |
|
290 * By default Symbian 2nd phase constructor is private. |
|
291 */ |
|
292 void ConstructL(); |
|
293 |
|
294 public: // Data |
|
295 |
|
296 protected: // Data |
|
297 // ?one_line_short_description_of_data |
|
298 //?data_declaration; |
|
299 |
|
300 private: // Data |
|
301 // ?one_line_short_description_of_data |
|
302 //?data_declaration; |
|
303 CHttpClientApp* iClientApp; // not owned |
|
304 TInt iInstanceId; // Unique id of this instance |
|
305 // of the client application |
|
306 TBool iSilentMode; // See EDlMgrSilentMode |
|
307 TBool iNotifications; // No user notification needed |
|
308 THttpDownloadMgrExitAction iExitAction; // See EDlMgrDeleteOnExit |
|
309 CHttpConnHandler* iConnHandler; // pointer to the CHttpConnHandler object |
|
310 // used by this instance. Not owned only |
|
311 // contained. |
|
312 |
|
313 MDownloadStateObserver* iObserver; // now owner |
|
314 TBool iMaster; // Indicates that this instance inherits all |
|
315 // downloads another instance with the same UID |
|
316 // left in the download manager |
|
317 |
|
318 TBool iCookies; // EDlMgrEnableCookies |
|
319 TBool iAutoConnect; // EDlAutoConnect |
|
320 |
|
321 TBool iFotaDownload; // EDlMgrFotaDownload |
|
322 |
|
323 TBool iProgressiveDownload; // EDlMgrProgressiveDownload |
|
324 |
|
325 // Reserved pointer for future extension |
|
326 //TAny* iReserved; |
|
327 |
|
328 public: // Friend classes |
|
329 protected: // Friend classes |
|
330 friend class CHttpClientApp; |
|
331 |
|
332 private: // Friend classes |
|
333 }; |
|
334 |
|
335 #endif // HTTPCLIENTAPPINSTANCE_H |
|
336 |
|
337 // End of File |