|
1 /* |
|
2 * Copyright (c) 2002 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: Request Handler to update data to the network server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CPENGHANDLERSENDDATA_H__ |
|
21 #define __CPENGHANDLERSENDDATA_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "MPEngRequestHandler.h" |
|
27 #include "MPEngHandlerSendData.h" |
|
28 |
|
29 // Own RMessage class wraper |
|
30 #include "RPEngMessage.h" |
|
31 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MPEngRequestHandlerObserver; |
|
35 class MPEngPureDataHandler; |
|
36 class CPEngOutGoingTransContainer; |
|
37 class MPEngOutgoingTransactionHandler; |
|
38 class CPEngTransactionStatus; |
|
39 class MPEngSubSession; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 /** |
|
43 * Request Handler to update data to the network server |
|
44 * |
|
45 * @lib PEngServer2 |
|
46 * @since 3.0 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CPEngHandlerSendData ): |
|
49 public CBase, |
|
50 public MPEngRequestHandler, |
|
51 public MPEngHandlerSendData |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. which creates Send Data handler from |
|
57 * Transaction handlers. |
|
58 * Transaction handlers from the passed pointer array are removed |
|
59 * and its owner ship is taked by the created class. |
|
60 * Due to the nature of the construction, it can happen that only |
|
61 * part of the transaction handler is removed from the array, |
|
62 * before construction fails,however remained elements in the |
|
63 * array have now relation to failed object, and removed ones |
|
64 * have been destroied among failed contruction of |
|
65 * the CPEngHandlerSendData object. This constructor can be called |
|
66 * without valid client message. In that case, when handler |
|
67 * is completed there is no client notify about it. |
|
68 * |
|
69 * @since 3.0 |
|
70 * @param aRequestObserver request handler observer |
|
71 * @param aPureDataHandler Pure data handler, |
|
72 * @param aServSubSession sub session |
|
73 * @param aTransactions outgoing transactions |
|
74 * @param aMessage message to complete request to |
|
75 * @param aSessionId session id |
|
76 * @param aSubSessionId subsession id |
|
77 * @return pointer to the constructed class |
|
78 */ |
|
79 static CPEngHandlerSendData* NewLC( |
|
80 MPEngRequestHandlerObserver& aRequestObserver, |
|
81 MPEngPureDataHandler& aPureDataHandler, |
|
82 MPEngSubSession& aServSubSession, |
|
83 const RPEngMessage& aMessage, |
|
84 RPointerArray<MPEngOutgoingTransactionHandler>& aTransactions, |
|
85 TInt32 aSessionId, |
|
86 TInt32 aSubSessionId ); |
|
87 |
|
88 |
|
89 /** |
|
90 * Destructor. |
|
91 */ |
|
92 ~CPEngHandlerSendData(); |
|
93 |
|
94 public: // Function from MPEngRequestHandler |
|
95 |
|
96 /** |
|
97 * Start Handling of the request |
|
98 * @see <MPEngRequestHandler.h> |
|
99 */ |
|
100 void StartHandlerL(); |
|
101 |
|
102 /** |
|
103 * Return Session Id |
|
104 * @see <MPEngRequestHandler.h> |
|
105 */ |
|
106 TInt32 SessionId() const ; |
|
107 |
|
108 /** |
|
109 * Return Sub-Session Id |
|
110 * @see <MPEngRequestHandler.h> |
|
111 */ |
|
112 TInt SubSessionId() const ; |
|
113 |
|
114 /** |
|
115 * Return Request function |
|
116 * @see <MPEngRequestHandler.h> |
|
117 */ |
|
118 TInt RequestFunction() const; |
|
119 |
|
120 /** |
|
121 * Cancel Request |
|
122 * @see <MPEngRequestHandler.h> |
|
123 */ |
|
124 void CancelRequestD(); |
|
125 |
|
126 /** |
|
127 * Set message handler |
|
128 * @see <MPEngRequestHandler.h> |
|
129 */ |
|
130 void SetMessage( const RPEngMessage& aMessage ); |
|
131 |
|
132 |
|
133 public: // Function from MPEngHandlerSendData |
|
134 |
|
135 /** |
|
136 * Create new transaction containers and start their processing |
|
137 * @see <MPEngHandlerSendData.h> |
|
138 * @since 3.0 |
|
139 */ |
|
140 void CreateNewContainersRunThemL( ) ; |
|
141 |
|
142 /** |
|
143 * Complete passed transaction container |
|
144 * @see <MPEngHandlerSendData.h> |
|
145 * @since 3.0 |
|
146 */ |
|
147 void CompleteTransContainer( |
|
148 CPEngOutGoingTransContainer* aContainer, |
|
149 CPEngTransactionStatus* aStatus, |
|
150 TInt aErrCode ); |
|
151 /** |
|
152 * Checks if this is last running transaction container |
|
153 * @see <MPEngHandlerSendData.h> |
|
154 * @since 3.0 |
|
155 */ |
|
156 TBool LastRunningTransaction( ); |
|
157 |
|
158 private: // Functions from base classes |
|
159 |
|
160 /** |
|
161 * Complete request handlers |
|
162 * and delete Request Handler Class |
|
163 * @since 3.0 |
|
164 */ |
|
165 void CompleteRequestD(); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * C++ default constructor. |
|
171 */ |
|
172 CPEngHandlerSendData( |
|
173 MPEngRequestHandlerObserver& aRequestHandlerObserver, |
|
174 MPEngPureDataHandler& aPureDataHandler, |
|
175 MPEngSubSession& aServSubSession, |
|
176 const RPEngMessage& aMessage, |
|
177 TInt32 aSessionId, |
|
178 TInt32 aSubSessionId ); |
|
179 |
|
180 |
|
181 /** |
|
182 * Symbian 2nd phase constructor |
|
183 */ |
|
184 void ConstructL( |
|
185 RPointerArray<MPEngOutgoingTransactionHandler>& aTransactions ); |
|
186 |
|
187 private: // Data |
|
188 |
|
189 /// REF: Request Handler Observer |
|
190 MPEngRequestHandlerObserver& iRequestHandlerObserver; |
|
191 |
|
192 /// REF: Pure data handler |
|
193 MPEngPureDataHandler& iPureDataHandler; |
|
194 |
|
195 /// REF: Server Sub-session |
|
196 MPEngSubSession& iServSubSession; |
|
197 |
|
198 /// OWN: Request RPEngMessage |
|
199 RPEngMessage iMessage; |
|
200 |
|
201 /// OWN: Session Id from where request was issued |
|
202 TInt32 iSessionId; |
|
203 |
|
204 /// OWN: SubSssion Id from where request was issued |
|
205 TInt iSubSessionId; |
|
206 |
|
207 /// OWN: Request Function |
|
208 TInt32 iFunction; |
|
209 |
|
210 /// OWN: All running Outgoing Transaction Handler containers |
|
211 /// Elements OWNed |
|
212 RPointerArray<CPEngOutGoingTransContainer> iTrasactionContainersArray; |
|
213 |
|
214 /// OWN: Not activated Outgoing Transaction handlers |
|
215 /// Elements OWNed |
|
216 RPointerArray<MPEngOutgoingTransactionHandler> iOutgoingTransactionHandlers; |
|
217 |
|
218 /// OWN: Transaction status |
|
219 CPEngTransactionStatus* iTransactionStatus; |
|
220 }; |
|
221 |
|
222 #endif // __CPENGHANDLERSENDDATA_H__ |
|
223 |
|
224 // End of File |