|
1 /* |
|
2 * Copyright (c) 2004 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: Access handler of the network session |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CPENGPUREDATAHANDLER_H__ |
|
19 #define __CPENGPUREDATAHANDLER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Base.h> |
|
23 #include <impspurecli.h> |
|
24 #include "MPEngPureDataHandler.h" |
|
25 #include "MPEngSessionStatusObserver.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CPEngSendDataOperation; |
|
29 class CPEngSessionSlotId; |
|
30 class RImpsEng; |
|
31 class MPEngSessionManager; |
|
32 class MPEngAccessHandler; |
|
33 |
|
34 /** |
|
35 * CPEngPureDataHandler implementation. |
|
36 * |
|
37 * @since 3.0 |
|
38 */ |
|
39 NONSHARABLE_CLASS( CPEngPureDataHandler ) : |
|
40 public CBase, |
|
41 public MPEngPureDataHandler, |
|
42 public MImpsPureHandler2, |
|
43 public MImpsErrorHandler2, |
|
44 public MPEngSessionStatusObserver |
|
45 { |
|
46 public: /* Construction */ |
|
47 |
|
48 |
|
49 /** |
|
50 * Instantiates CPEngPureDataHandler object. |
|
51 * |
|
52 * @return New CPEngPureDataHandler instance. |
|
53 */ |
|
54 static CPEngPureDataHandler* NewL( RImpsEng& aSessClient, |
|
55 MPEngSessionManager& aSessManager, |
|
56 MPEngAccessHandler& aAccessHandler, |
|
57 const CPEngSessionSlotId& aSessionId ); |
|
58 |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 ~CPEngPureDataHandler(); |
|
64 |
|
65 //----------------------------------------------------------------------- |
|
66 |
|
67 public: // new functions from MPEngPureDataHandler |
|
68 |
|
69 /** |
|
70 * Close reference to the Pure data handler |
|
71 * @see <MPEngPureDataHandler.h> |
|
72 * @since 3.0 |
|
73 */ |
|
74 void Close(); |
|
75 |
|
76 /** |
|
77 * Get Transfer buffer for out going message |
|
78 * @see <MPEngPureDataHandler.h> |
|
79 * @since 3.0 |
|
80 */ |
|
81 TPtr8 TransferBufferL(); |
|
82 |
|
83 /** |
|
84 * Sends data from the transfer buffer to the network |
|
85 * @see <MPEngPureDataHandler.h> |
|
86 * @since 3.0 |
|
87 */ |
|
88 TInt SendDataL( TRequestStatus& aStatus ); |
|
89 |
|
90 /** |
|
91 * Gets response for the message of given operation id |
|
92 * @see <MPEngPureDataHandler.h> |
|
93 * @since 3.0 |
|
94 */ |
|
95 HBufC8* ResponseL( TInt aTransId ); |
|
96 |
|
97 /** |
|
98 * Cancel sendin operation of given transaction id |
|
99 * @see <MPEngPureDataHandler.h> |
|
100 * @since 3.0 |
|
101 */ |
|
102 void CancelSending( TInt aTransId ); |
|
103 |
|
104 /** |
|
105 * Listen Incoming data |
|
106 * @see <MPEngPureDataHandler.h> |
|
107 * @since 3.0 |
|
108 */ |
|
109 TInt ListenIncomingData( TRequestStatus& aStatus ); |
|
110 |
|
111 /** |
|
112 * Cancel incoming data listening |
|
113 * @see <MPEngPureDataHandler.h> |
|
114 * @since 3.0 |
|
115 */ |
|
116 void CancelListening(); |
|
117 |
|
118 public: // new functions from MImpsPureHandler |
|
119 |
|
120 /** |
|
121 * Observer method for pure message content. |
|
122 * @see <impspurecli.h> |
|
123 * @seince 3.0 |
|
124 */ |
|
125 void HandlePureDataL( TInt aOpId, |
|
126 const TDesC8& aBuffer, |
|
127 TImpsCspIdentifier& aCspId ); |
|
128 |
|
129 public: // new functions from MImpsErrorHandler |
|
130 |
|
131 /** |
|
132 * Observer method for error messages. |
|
133 * @see <impspurecli.h> |
|
134 * @seince 3.0 |
|
135 */ |
|
136 void HandleErrorL( TInt aStatus, |
|
137 TInt aOpId, |
|
138 const TDesC* aDescription, |
|
139 const CImpsDetailed* aDetailedRes, |
|
140 TImpsCspIdentifier& aCspId ); |
|
141 |
|
142 public: // new function from the MPEngSessionStatusObserver |
|
143 /** |
|
144 * Handle Session status change |
|
145 * @see <MPEngSessionStatusObserver.h> |
|
146 * @since 3.0 |
|
147 */ |
|
148 void StatusChangedL( TPEngNWSessionSlotState aNewState, |
|
149 TPEngNWSessionSlotEvent aNewEvent ); |
|
150 |
|
151 public: // New functions |
|
152 |
|
153 /** |
|
154 * Open new reference to the object |
|
155 * |
|
156 * @since 3.0 |
|
157 */ |
|
158 void Open(); |
|
159 |
|
160 private: // new private functions |
|
161 |
|
162 /** |
|
163 * Find operation |
|
164 * |
|
165 * @since 3.0 |
|
166 * @return index in array |
|
167 */ |
|
168 TInt FindOperation( TInt aOpId, TInt ( CPEngSendDataOperation:: *aIdFunc )() const ) const; |
|
169 TInt FindOperationL( TInt aOpId, TInt ( CPEngSendDataOperation:: *aIdFunc )() const ) const; |
|
170 |
|
171 protected: // construction |
|
172 |
|
173 /** |
|
174 * C++ constructor. protected |
|
175 */ |
|
176 CPEngPureDataHandler( MPEngSessionManager& aSessManager, |
|
177 MPEngAccessHandler& aAccessHandler, |
|
178 const CPEngSessionSlotId& aSessionId, |
|
179 RImpsEng& aSessClient ); |
|
180 |
|
181 /** |
|
182 * Symbian Second phase constructor |
|
183 */ |
|
184 void ConstructL( RImpsEng& aSessClient ); |
|
185 |
|
186 private: //Data |
|
187 |
|
188 /// OWN: Access count |
|
189 TInt iCount; |
|
190 |
|
191 /// OWN: Session manager |
|
192 MPEngSessionManager& iSessionManager; |
|
193 |
|
194 /// OWN: Access handler |
|
195 MPEngAccessHandler& iAccessHandler; |
|
196 |
|
197 /// REF: Session Id |
|
198 const CPEngSessionSlotId& iSessionId; |
|
199 |
|
200 /// OWN: Max number of active requests |
|
201 TInt iMaxActive; |
|
202 |
|
203 /// OWN: Transfer buffer, OWNED |
|
204 HBufC8* iTrasferBuffer; |
|
205 |
|
206 /// OWN: Incoming data queue, OWNED |
|
207 RPointerArray<HBufC8> iIncomingData; |
|
208 |
|
209 // Incoming data Request Status |
|
210 TRequestStatus* iIncReqStatus; |
|
211 |
|
212 /// REF: Main client of the IMPS Engine |
|
213 RImpsEng& iSessClient; |
|
214 |
|
215 /// OWN: Pure client |
|
216 RImpsPureClient2 iPureClient; |
|
217 |
|
218 /// OWN: Send data operations] |
|
219 /// Elements OWNed |
|
220 RPointerArray<CPEngSendDataOperation> iOperations; |
|
221 |
|
222 /// OWN: Id which is used to do logs more human readable |
|
223 TInt iConnectionLogsId; |
|
224 |
|
225 /// OWN: Logs Id iteration, |
|
226 TInt iOpidIterator; |
|
227 |
|
228 /// OWN: Last served op Id |
|
229 TInt iLastServerOpId; |
|
230 }; |
|
231 |
|
232 #endif //__CPENGPUREDATAHANDLER_H__ |
|
233 |
|
234 // End of File |