|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Holds information of one network request |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 |
|
20 #include "CCARequest.h" |
|
21 #include "CCARequestMapper.h" |
|
22 #include "ChatDebugPrint.h" |
|
23 |
|
24 #include <e32base.h> |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CCARequest::CCARequest |
|
29 // C++ default constructor can NOT contain any code, that |
|
30 // might leave. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CCARequest::CCARequest( const TInt aOpId, |
|
34 TBool aDestroyAfterComplete, |
|
35 TCallBack aCallBack ) |
|
36 : iOpId( aOpId ), |
|
37 iCallBack( aCallBack ), |
|
38 iDestroyAfterComplete( aDestroyAfterComplete ) |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CCARequest::NewL |
|
44 // Two-phased constructor. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CCARequest* CCARequest::NewL( TInt aOpId, |
|
48 TBool aDestroyAfterComplete, |
|
49 TCallBack aCallBack ) |
|
50 { |
|
51 CCARequest* self = new( ELeave ) CCARequest( aOpId, aDestroyAfterComplete, |
|
52 aCallBack ); |
|
53 |
|
54 return self; |
|
55 } |
|
56 |
|
57 |
|
58 // Destructor |
|
59 CCARequest::~CCARequest() |
|
60 { |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CCARequest::ExecuteCallBackFunction |
|
65 // (other items were commented in a header). |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 TInt CCARequest::ExecuteCallBackFunction() const |
|
69 { |
|
70 return iCallBack.CallBack(); |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // CCARequest::DestroyAfterComplete |
|
75 // (other items were commented in a header). |
|
76 // --------------------------------------------------------- |
|
77 // |
|
78 TBool CCARequest::DestroyAfterComplete() const |
|
79 { |
|
80 return iDestroyAfterComplete; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CCARequest::IdMatches |
|
85 // (other items were commented in a header). |
|
86 // --------------------------------------------------------- |
|
87 // |
|
88 TBool CCARequest::IdMatches( TInt aOpId ) const |
|
89 { |
|
90 return aOpId == iOpId; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // CCARequest::StartWait |
|
95 // (other items were commented in a header). |
|
96 // --------------------------------------------------------- |
|
97 // |
|
98 void CCARequest::StartWait() |
|
99 { |
|
100 CHAT_DP_FUNC_ENTER( "CCARequest::StartWait" ); |
|
101 CHAT_DP( D_CHAT_LIT( "CCARequest::StartWait() Request type is %d" ), |
|
102 iRequestType ); |
|
103 |
|
104 if ( iRequestMapper ) |
|
105 { |
|
106 iRequestMapper->ReportWaitStart(); |
|
107 } |
|
108 if ( !iWait.IsStarted() ) |
|
109 { |
|
110 iWait.Start(); // CSI: 10 # iWait is not active object. |
|
111 } |
|
112 CHAT_DP_FUNC_DP( "CCARequest::StartWait", "Continue processing" ); |
|
113 |
|
114 if ( iRequestMapper ) |
|
115 { |
|
116 iRequestMapper->ReportWaitStop(); |
|
117 } |
|
118 CHAT_DP_FUNC_DONE( "CCARequest::StartWait" ); |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------- |
|
122 // CCARequest::StopWaitIfNeeded |
|
123 // (other items were commented in a header). |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 void CCARequest::StopWaitIfNeeded() |
|
127 { |
|
128 CHAT_DP_FUNC_ENTER( "CCARequest::StopWaitIfNeeded" ); |
|
129 if ( iWait.IsStarted() ) |
|
130 { |
|
131 CHAT_DP( D_CHAT_LIT( "CCARequest::StopWaitIfNeeded - \ |
|
132 Stop is needed: %d" ), iWait.CanStopNow() ); |
|
133 iWait.AsyncStop(); |
|
134 } |
|
135 CHAT_DP_FUNC_DONE( "CCARequest::StopWaitIfNeeded" ); |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------- |
|
139 // CCARequest::SetErrorCode |
|
140 // (other items were commented in a header). |
|
141 // --------------------------------------------------------- |
|
142 // |
|
143 void CCARequest::SetErrorCode( TInt aErrorCode ) |
|
144 { |
|
145 iErrorCode = aErrorCode; |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------- |
|
149 // CCARequest::ErrorCode |
|
150 // (other items were commented in a header). |
|
151 // --------------------------------------------------------- |
|
152 // |
|
153 TInt CCARequest::ErrorCode() const |
|
154 { |
|
155 return iErrorCode; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------- |
|
159 // CCARequest::SetRequestType |
|
160 // (other items were commented in a header). |
|
161 // --------------------------------------------------------- |
|
162 // |
|
163 void CCARequest::SetRequestType( TInt aRequestType ) |
|
164 { |
|
165 iRequestType = aRequestType; |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------- |
|
169 // CCARequest::RequestType |
|
170 // (other items were commented in a header). |
|
171 // --------------------------------------------------------- |
|
172 // |
|
173 TInt CCARequest::RequestType() const |
|
174 { |
|
175 return iRequestType; |
|
176 } |
|
177 |
|
178 // --------------------------------------------------------- |
|
179 // CCARequest::SetAdditionalData |
|
180 // (other items were commented in a header). |
|
181 // --------------------------------------------------------- |
|
182 // |
|
183 void CCARequest::SetAdditionalData( const MDesCArray& aAdditionalArray ) |
|
184 { |
|
185 iAdditionalArray = &aAdditionalArray; |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------- |
|
189 // CCARequest::AdditionalData |
|
190 // (other items were commented in a header). |
|
191 // --------------------------------------------------------- |
|
192 // |
|
193 const MDesCArray* CCARequest::AdditionalData() const |
|
194 { |
|
195 return iAdditionalArray; |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------- |
|
199 // CCARequest::SetRequestMapper |
|
200 // (other items were commented in a header). |
|
201 // --------------------------------------------------------- |
|
202 // |
|
203 void CCARequest::SetRequestMapper( CCARequestMapper* aRequestMapper ) |
|
204 { |
|
205 iRequestMapper = aRequestMapper; |
|
206 } |
|
207 |
|
208 // End of File |