1 /* |
|
2 * Copyright (c) 2006-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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IRHTTPPOST_H |
|
20 #define IRHTTPPOST_H |
|
21 |
|
22 #include <f32file.h> |
|
23 #include <mhttpdatasupplier.h> |
|
24 #include <rhttptransaction.h> |
|
25 |
|
26 class CIRSettings; |
|
27 |
|
28 /** |
|
29 * CIRHttpPost class for posting the data |
|
30 * Reading from the file as chunks of data |
|
31 * using MHTTPDataSupplier - Data supplier |
|
32 */ |
|
33 NONSHARABLE_CLASS ( CIRHttpPost ):public CBase, public MHTTPDataSupplier |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 * CIRHttpPost::NewL |
|
39 * 1st phase constructor |
|
40 */ |
|
41 static CIRHttpPost* NewL( const RHTTPTransaction& aHttpTransaction ); |
|
42 |
|
43 /** |
|
44 * CIRHttpPost::~CIRHttpPost |
|
45 * C++ default destructor |
|
46 */ |
|
47 virtual ~CIRHttpPost(); |
|
48 |
|
49 /** |
|
50 * CIRHttpPost::GetNextDataPart |
|
51 * Obtain a data part from the supplier. |
|
52 * The data is guaranteed to survive until a call |
|
53 * is made to ReleaseData(). |
|
54 */ |
|
55 virtual TBool GetNextDataPart( TPtrC8& aDataPart ); |
|
56 |
|
57 /** |
|
58 * ReleaseData() |
|
59 * Release the current data part being held at the data supplier |
|
60 */ |
|
61 virtual void ReleaseData(); |
|
62 |
|
63 /** |
|
64 * OverallDataSize() |
|
65 * Obtain the overall size of the data being supplied, |
|
66 * if known to the supplier |
|
67 */ |
|
68 virtual TInt OverallDataSize(); |
|
69 |
|
70 /** |
|
71 * Reset() |
|
72 * Reset the data supplier |
|
73 * otherwise returns KErrNone |
|
74 */ |
|
75 virtual TInt Reset(); |
|
76 |
|
77 /** |
|
78 * GetFileToPostL() |
|
79 * Prepares the data to be posted from the log file |
|
80 */ |
|
81 void GetFileToPostL(TInt *aFileSize); |
|
82 |
|
83 /** |
|
84 * CloseLogFile () |
|
85 * Used to Close the log file LogUsage.gz externally from other sources (bug-fixing) |
|
86 */ |
|
87 void CloseLogFile (); |
|
88 |
|
89 /** |
|
90 * SetTransaction(). |
|
91 * Sets transaction. |
|
92 * |
|
93 * @param aHttpTransaction Reference to RHTTPTransaction. |
|
94 */ |
|
95 void SetTransaction( const RHTTPTransaction& aHttpTransaction ); |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * CIRHttpPost::CIRHttpPost |
|
101 * C++ default constructor |
|
102 * @param aHttpTransaction Reference to RHTTPTransaction |
|
103 */ |
|
104 CIRHttpPost( const RHTTPTransaction& aHttpTransaction ); |
|
105 |
|
106 /** |
|
107 * CIRHttpPost::ConstructL |
|
108 * 2nd phase constructor |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 /** |
|
113 * CIRHttpPost::GetDataPartFromFileL |
|
114 * Obtain a data part from the browse log file. |
|
115 * |
|
116 * @param aDataPart Data from browse log to be returned. |
|
117 */ |
|
118 void GetDataPartFromFileL( TDes8& aDataPart ); |
|
119 |
|
120 private: |
|
121 |
|
122 /** |
|
123 * Browse log file. |
|
124 */ |
|
125 RFile iLogFile; |
|
126 |
|
127 /** |
|
128 * Total size of the post data file |
|
129 */ |
|
130 TInt iTotalsize; |
|
131 |
|
132 /** |
|
133 * set the initial data sent |
|
134 */ |
|
135 TInt iStartPos; |
|
136 |
|
137 /** |
|
138 * remaining size of data to be sent |
|
139 */ |
|
140 TInt iRemainingLength; |
|
141 |
|
142 /** |
|
143 * object to HTTP Transaction |
|
144 */ |
|
145 RHTTPTransaction iTransaction; |
|
146 |
|
147 /** |
|
148 * Data part buffer. |
|
149 */ |
|
150 RBuf8 iPartPostBuffer; |
|
151 |
|
152 /** |
|
153 *central repository settings handle |
|
154 */ |
|
155 CIRSettings* iSettings; |
|
156 }; |
|
157 |
|
158 #endif //IRHTTPPOST_H |
|
159 |
|