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