|
1 /** @file |
|
2 * Copyright (c) 2007 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: class for sending/receiving HTTP request/response |
|
15 * using Symbian HTTP client |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_CUPNPTRANSFERBASE_H |
|
21 #define C_CUPNPTRANSFERBASE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "httptransferobserver.h" |
|
26 #include "upnptransferobserver.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CUpnpContentDirectory; |
|
30 class CHttpTransferBase; |
|
31 class MUpnpTransferObserver; |
|
32 |
|
33 const TInt KDefaultAccessPoint = 11; |
|
34 const TInt KDefaultBuffer = 64000; |
|
35 const TInt KNumOfConcurrentTransactions = 2; |
|
36 |
|
37 class CUpnpTransferBase: public CBase , public MHttpTransferObserver |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Destructor. |
|
43 */ |
|
44 virtual ~CUpnpTransferBase(); |
|
45 |
|
46 // from base class MHttpTransferObserver |
|
47 |
|
48 virtual void ReadyForTransferL( TAny* aKey); |
|
49 |
|
50 /** |
|
51 * Gets transfer progress callback |
|
52 * |
|
53 * @since S60 v3.2 |
|
54 * @param aKey the file identifier |
|
55 * @param aBytes transferred |
|
56 * @param aTotalBytes all bytes to be transferred |
|
57 */ |
|
58 virtual void TransferProgress( TAny* aKey, |
|
59 TInt aBytes, |
|
60 TInt aTotalBytes ); |
|
61 |
|
62 virtual void TransferCompleted( TAny* aKey, TInt aStatus ); |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 public: // New functions |
|
68 |
|
69 /** |
|
70 * Creates new CHttpFile object and adds it to the iFileQueue |
|
71 * |
|
72 * @since S60 v3.2 |
|
73 * @param aUri Uri of the downloaded object |
|
74 * @param aTargetPath Local path of the object |
|
75 * @param aKey Identifier of the object |
|
76 */ |
|
77 void CreateAndQueueHttpFileL( const TDesC8& aUri, |
|
78 const TDesC& aTargetPath, |
|
79 TInt aKey ); |
|
80 |
|
81 /** |
|
82 * Sets a header |
|
83 * |
|
84 * @since S60 v3.2 |
|
85 * @param aKey the file identifier |
|
86 * @param aFieldName The field name, e.g. 'Content-Type' |
|
87 * @param aFieldValue The field value. e.g. 'text/plain' |
|
88 */ |
|
89 void SetHeaderL( TInt aKey, |
|
90 const TDesC8& aFieldName, |
|
91 const TDesC8& aFieldValue ); |
|
92 |
|
93 /** |
|
94 * Turns on/off transfer progress callbacks |
|
95 * |
|
96 * @since S60 v3.2 |
|
97 * @param aKey the file identifier |
|
98 * @param aSwitchOn tuning on/off |
|
99 */ |
|
100 void TrackProgess(TInt aKey, TBool aSwitchOn); |
|
101 |
|
102 |
|
103 /** |
|
104 * cancels transfer |
|
105 * |
|
106 * @since S60 v3.2 |
|
107 * @param aKey the file identifier |
|
108 */ |
|
109 virtual void CancelTransfer( TInt aKey); |
|
110 |
|
111 protected: |
|
112 /** |
|
113 * C++ default constructor. |
|
114 */ |
|
115 CUpnpTransferBase( MUpnpTransferObserver* aCd ); |
|
116 |
|
117 // new functions |
|
118 TInt MapStatus( TInt aErrorCode ); |
|
119 |
|
120 protected: // Data |
|
121 MUpnpTransferObserver* iObserver; |
|
122 CHttpTransferBase* iHttpTransferBase; |
|
123 |
|
124 |
|
125 }; |
|
126 |
|
127 #endif // C_CUPNPTRANFERBASE_H |