|
1 /* |
|
2 * Copyright (c) 2003 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: Outgoing transaction handling interface. |
|
15 * Defines a protocol between Presence Engine server |
|
16 * and concrete transaction handlers to generate outgoing |
|
17 * XML to network and process the responce. |
|
18 * |
|
19 */ |
|
20 |
|
21 #ifndef __MPENGOUTGOINGTRANSACTIONHANDLER_H__ |
|
22 #define __MPENGOUTGOINGTRANSACTIONHANDLER_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <E32Std.h> |
|
26 |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CPEngTransactionStatus; |
|
30 |
|
31 |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * Outgoing transaction handling interface. |
|
36 * |
|
37 * Defines a protocol between Presence Engine server |
|
38 * and concrete transaction handlers to generate outgoing |
|
39 * XML to network and process the response. |
|
40 * |
|
41 * Methods are listed here in their "calling order". |
|
42 * |
|
43 * @since 3.0 |
|
44 */ |
|
45 class MPEngOutgoingTransactionHandler |
|
46 { |
|
47 public: // New functions |
|
48 |
|
49 /** |
|
50 * Synchronous method, get Outgoing transaction request |
|
51 * |
|
52 * This method is called to generate a outgoing XML request |
|
53 * for the presence network server |
|
54 * request is no further processed and it is send to network |
|
55 * |
|
56 * @since 3.0 |
|
57 * @param aSendBuffer The send buffer to write XML request. |
|
58 * Buffer has the maximum send buffer size available. |
|
59 * Handler is responsible to divide too big requests |
|
60 * to smaller partitions, that fit into available |
|
61 * send buffer. In case of separation, handler must |
|
62 * utilize incremental sending, see method |
|
63 * OutgoingTransactionComplete(). |
|
64 |
|
65 */ |
|
66 virtual void RequestL( TDes8& aSendBuffer ) = 0; |
|
67 |
|
68 |
|
69 /** |
|
70 * Signals to the transaction handler thst it is last |
|
71 * active transaction handler in the scope of the client request |
|
72 * |
|
73 * This function is called by the transaction handler runner |
|
74 * when there is no more running transaction handler in |
|
75 * the scope of one client request, same as this transaction |
|
76 * handler is running. |
|
77 * However Request handler can still multiply itself |
|
78 * or continue running in loops as single instance. |
|
79 * |
|
80 * @since 3.0 |
|
81 */ |
|
82 virtual void LastRunningTransactionHandler( ) = 0; |
|
83 |
|
84 /** |
|
85 * Process the response to the request. |
|
86 * |
|
87 * This method is called to process XML request response |
|
88 * from network server. |
|
89 * Request can be processed either in synchronous way |
|
90 * there passed TRequestStatus is not touched by the handler |
|
91 * or when state is changed to pending, and handler will not be |
|
92 * deleted till its completion. |
|
93 * |
|
94 * |
|
95 * @since 3.0 |
|
96 * @param aResponse buffer containing XML request response |
|
97 * @param aStatus status where transaction signals completion |
|
98 */ |
|
99 virtual void ProcessResponseL( const TDesC8& aResponse, |
|
100 TRequestStatus& aStatus ) = 0; |
|
101 |
|
102 /** |
|
103 * Cancels asynchronous processing of the request |
|
104 * |
|
105 * When processing of the request is not asynchronous |
|
106 * this function does nothing |
|
107 * |
|
108 * @since 3.0 |
|
109 * @param |
|
110 * @return |
|
111 */ |
|
112 virtual void CancelProcessing( ) = 0; |
|
113 |
|
114 /** |
|
115 * Support for simultaneous transaction handling. |
|
116 * |
|
117 * This method is called by the transaction handler |
|
118 * runner to ask if there is need to created extra |
|
119 * transaction handlers which will be run separately but |
|
120 * still withing the scope of the clients request this |
|
121 * request handler is belonging. |
|
122 * |
|
123 * @since 3.0 |
|
124 * @param aTransactionsArray Reference to the pointer array |
|
125 * where new transaction handlers can be stored. |
|
126 */ |
|
127 virtual void NewTransactionHandlersL( |
|
128 RPointerArray<MPEngOutgoingTransactionHandler>& aHandlers ) = 0; |
|
129 |
|
130 |
|
131 /** |
|
132 * Function to signal completing of the transaction |
|
133 * |
|
134 * Runner of the transaction handler is using this function |
|
135 * to check if handler needs to send another data to the |
|
136 * network server. |
|
137 * It is called one processing of the request response is |
|
138 * finished. |
|
139 * |
|
140 * @since 3.0 |
|
141 * @param |
|
142 * @return ETrue if transaction is completed and does not need |
|
143 * to create any new request |
|
144 */ |
|
145 virtual TBool TransactionCompleted( ) = 0; |
|
146 |
|
147 /** |
|
148 * Gets transaction status result class |
|
149 * |
|
150 * Transaction handler returns instance of the transaction |
|
151 * status class where are details about finished transaction. |
|
152 * This function is called once transaction handler is completed |
|
153 * Ownership is transfered to the caller |
|
154 * |
|
155 * @since 3.0 |
|
156 * @return instance of the transaction status with ownership |
|
157 */ |
|
158 virtual CPEngTransactionStatus* TransactionResult( ) = 0; |
|
159 |
|
160 /** |
|
161 * Releases handler |
|
162 * |
|
163 * This function is called when some Symbian system error will |
|
164 * occur, so handler has chance to do cleaning if this is |
|
165 * needed. |
|
166 * This function is called when for example processing of the |
|
167 * incoming date failed and left with some error |
|
168 * It is also called when send data to network failed |
|
169 * How ever, handle is not informed about particular error |
|
170 * and its not event its concern |
|
171 * |
|
172 * @since 3.0 |
|
173 */ |
|
174 virtual void ReleaseHandler( ) = 0; |
|
175 |
|
176 public: //Destructor |
|
177 |
|
178 /** |
|
179 * Virtual inline destructor. |
|
180 * |
|
181 * Concrete transaction handlers can be |
|
182 * destroyed using this inteface. |
|
183 */ |
|
184 virtual ~MPEngOutgoingTransactionHandler() {}; |
|
185 }; |
|
186 |
|
187 #endif // __MPENGOUTGOINGTRANSACTIONHANDLER_H__ |
|
188 |
|
189 // End of File |
|
190 |