|
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 |
|
19 #ifndef CCAREQUEST_H |
|
20 #define CCAREQUEST_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <ImpsDetailed.h> |
|
24 |
|
25 #include "PublicEngineDefinitions.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CCARequestMapper; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 class CCARequest : public CBase |
|
33 { |
|
34 public: // Constructors and destructor |
|
35 |
|
36 /** |
|
37 * Two-phased constructor. |
|
38 * @param aOpId Operation Id |
|
39 * @param aDestroyAfterComplete Should the request be destroyed |
|
40 * after it's complete |
|
41 * @param aCallBack Callback function to be executed after complete |
|
42 */ |
|
43 static CCARequest* NewL( TInt aOpId, |
|
44 TBool aDestroyAfterComplete, |
|
45 TCallBack aCallBack ); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CCARequest(); |
|
51 |
|
52 public: |
|
53 |
|
54 /** |
|
55 * Executes callback function if one is defined |
|
56 * @return Return value of callback function |
|
57 */ |
|
58 TInt ExecuteCallBackFunction() const; |
|
59 |
|
60 /** |
|
61 * Is the request marked to be destroyed after complition |
|
62 * @return Gets destroyed after complete or not |
|
63 */ |
|
64 TBool DestroyAfterComplete() const; |
|
65 |
|
66 /** |
|
67 * Checks if given id matches this request's id |
|
68 * @since 1.2 |
|
69 * @param aOpId Operation id |
|
70 * @return Does it match or not |
|
71 */ |
|
72 TBool IdMatches( TInt aOpId ) const; |
|
73 |
|
74 /** |
|
75 * Starts waiting for HandleRequest-call |
|
76 * @since 1.2 |
|
77 */ |
|
78 void StartWait(); |
|
79 |
|
80 /** |
|
81 * Stops waiting if one is in active state |
|
82 * @since 1.2 |
|
83 */ |
|
84 void StopWaitIfNeeded(); |
|
85 |
|
86 /** |
|
87 * Sets the error status for this request |
|
88 * @since 1.2 |
|
89 * @param aErrorCode Error code |
|
90 */ |
|
91 void SetErrorCode( TInt aErrorCode ); |
|
92 |
|
93 /** |
|
94 * Returns the error status of this request |
|
95 * @since 1.2 |
|
96 * @return Error status |
|
97 */ |
|
98 TInt ErrorCode() const; |
|
99 |
|
100 /** |
|
101 * Sets the request type for this request |
|
102 * @since 1.2 |
|
103 * @param aRequestType Type of request |
|
104 */ |
|
105 void SetRequestType( TInt aRequestType ); |
|
106 |
|
107 /** |
|
108 * Return the type of request that was set to this request |
|
109 * @since 1.2 |
|
110 * @return Request type |
|
111 */ |
|
112 TInt RequestType() const; |
|
113 |
|
114 /** |
|
115 * Sets an array of additional data for this request |
|
116 * @since 1.2 |
|
117 * @param aAdditionalArray Array |
|
118 */ |
|
119 void SetAdditionalData( const MDesCArray& aAdditionalArray ); |
|
120 |
|
121 /** |
|
122 * Returns a pointer to additional data array. |
|
123 * Does not transfer ownership! |
|
124 * @since 1.2 |
|
125 * @return Additional data array |
|
126 */ |
|
127 const MDesCArray* AdditionalData() const; |
|
128 |
|
129 /** |
|
130 * Sets the mapper for this request |
|
131 * @param aRequestMapper Request mapper |
|
132 */ |
|
133 void SetRequestMapper( CCARequestMapper* aRequestMapper ); |
|
134 |
|
135 private: // constructors |
|
136 |
|
137 /** |
|
138 * C++ default constructor. |
|
139 * @see CCARequest::NewL for parameters |
|
140 */ |
|
141 CCARequest( const TInt aOpId, TBool aDestroyAfterComplete, TCallBack aCallBack ); |
|
142 |
|
143 private: // data |
|
144 |
|
145 TInt iOpId; // current operation id |
|
146 TInt iErrorCode; // error code |
|
147 TInt iRequestType; // request/operation type |
|
148 |
|
149 // Doesn't own! Used to hold additional data for this request |
|
150 const MDesCArray* iAdditionalArray; |
|
151 CActiveSchedulerWait iWait; |
|
152 TCallBack iCallBack; |
|
153 TBool iDestroyAfterComplete; |
|
154 |
|
155 // Doesn't own. Mapper for this request |
|
156 CCARequestMapper* iRequestMapper; |
|
157 }; |
|
158 |
|
159 #endif // CCAREQUEST_H |
|
160 |
|
161 // End of File |