|
1 /* |
|
2 * Copyright (c) 2004,2006 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: RAU manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CAOCONNECTIONIMPLSTUB_H |
|
21 #define CAOCONNECTIONIMPLSTUB_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <e32base.h> |
|
25 #include <e32property.h> |
|
26 #include "maoconnectionmanager.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MAOSettings; |
|
30 class MAOConnectionObserver; |
|
31 class CPeriodic; |
|
32 template<class T> class CAOAsyncWrapper; |
|
33 |
|
34 /** |
|
35 * Connection implementation. |
|
36 * This is the stub version of CAOConnectionImpl. |
|
37 * |
|
38 * @lib PDPContextManager.lib |
|
39 * @since S60 v3.1 |
|
40 */ |
|
41 class CAOConnectionImpl : public CActive |
|
42 { |
|
43 private: // Data types |
|
44 |
|
45 /** |
|
46 * Internal state bit |
|
47 */ |
|
48 enum TInternalState |
|
49 { |
|
50 EDisconnected, |
|
51 EOpeningLink, |
|
52 EListeningAccessPoint, |
|
53 EAttachingExistingConnection |
|
54 }; |
|
55 |
|
56 public: // Constructors & destructors |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 * |
|
61 * @since S60 v3.1 |
|
62 * @param aObserver ? |
|
63 * @param aSettings ? |
|
64 * @param aSocketServ ? |
|
65 * @return ? |
|
66 */ |
|
67 static CAOConnectionImpl* NewL( |
|
68 MAOConnectionObserver& aObserver, |
|
69 MAOSettings& aSettings, |
|
70 RSocketServ* aSocketServ ); |
|
71 |
|
72 /** |
|
73 * Default destructor |
|
74 * |
|
75 * @since S60 v3.1 |
|
76 */ |
|
77 virtual ~CAOConnectionImpl(); |
|
78 |
|
79 /** |
|
80 * Starts a new connection if none exists. |
|
81 * |
|
82 * @since S60 v3.1 |
|
83 */ |
|
84 void ActivateConnection(); |
|
85 |
|
86 /** |
|
87 * ? |
|
88 * |
|
89 * @since S60 v3.1 |
|
90 * @param aConnectionId ? |
|
91 */ |
|
92 void AttachToExistingConnection( TUint aConnectionId ); |
|
93 |
|
94 /** |
|
95 * Cancels any outstanding connections. |
|
96 * |
|
97 * @since S60 v3.1 |
|
98 */ |
|
99 void CancelConnection(); |
|
100 |
|
101 /** |
|
102 * Checks if there is already a connection ongoing. |
|
103 * |
|
104 * @since S60 v3.1 |
|
105 * @return ETrue if there is connection |
|
106 */ |
|
107 TBool IsConnectedToDefaultIAP(); |
|
108 |
|
109 /** |
|
110 * Returns number of ongoing connections. |
|
111 * |
|
112 * @since 3.0 |
|
113 * @return TInt |
|
114 */ |
|
115 TInt NumberOfConnections(); |
|
116 |
|
117 private: |
|
118 |
|
119 /** |
|
120 * Default constructor. |
|
121 * |
|
122 * @since S60 v3.1 |
|
123 * @param aObserver |
|
124 * @param aSettings |
|
125 * @param aSocketServ |
|
126 */ |
|
127 CAOConnectionImpl( |
|
128 MAOConnectionObserver& aObserver, |
|
129 MAOSettings& aSettings, |
|
130 RSocketServ* aSocketServ ); |
|
131 |
|
132 /** |
|
133 * Default Symbian constructor |
|
134 * |
|
135 * @since S60 v3.1 |
|
136 */ |
|
137 void ConstructL(); |
|
138 |
|
139 /** |
|
140 * Change state |
|
141 * |
|
142 * @since S60 v3.1 |
|
143 * @param aNewState ? |
|
144 */ |
|
145 void ChangeState( TInternalState aNewState ); |
|
146 |
|
147 /** |
|
148 * Completes self |
|
149 * |
|
150 * @since S60 v3.1 |
|
151 * @param aStatus ? |
|
152 * @param aReason ? |
|
153 */ |
|
154 void CompleteSelf( TRequestStatus& aStatus, TInt aReason ); |
|
155 |
|
156 /** |
|
157 * Callback for connection timer |
|
158 * |
|
159 * @since S60 v3.1 |
|
160 * @param aSelf ? |
|
161 */ |
|
162 static TInt ConnectionCallBack( TAny* aSelf ); |
|
163 |
|
164 /** |
|
165 * Handles callback timer trigger |
|
166 * |
|
167 * @since S60 v3.1 |
|
168 */ |
|
169 void HandleConnectionCallBackL(); |
|
170 |
|
171 /** |
|
172 * Activates connection |
|
173 * |
|
174 * @since S60 v3.1 |
|
175 */ |
|
176 void DoActivateConnection(); |
|
177 |
|
178 /** |
|
179 * Handles EOpeningLink request completion |
|
180 * |
|
181 * @since S60 v3.1 |
|
182 * @param aStatus ? |
|
183 */ |
|
184 void HandleOpeningLinkL( TInt aStatus ); |
|
185 |
|
186 /** |
|
187 * Converts error code to failure reason |
|
188 * |
|
189 * @since S60 v3.1 |
|
190 * @param aError ? |
|
191 * @return ? |
|
192 */ |
|
193 MAOConnectionManager::TFailureReason FailureReason( TInt aError ); |
|
194 |
|
195 /** |
|
196 * Handles EListeningAccessPoint request completion |
|
197 * |
|
198 * @since S60 v3.1 |
|
199 * @param aStatus ? |
|
200 */ |
|
201 void HandleListeningAccessPointL( TInt aStatus ); |
|
202 |
|
203 /** |
|
204 * Reports PDP context activation error |
|
205 * |
|
206 * @since S60 v3.1 |
|
207 * @param aError ? |
|
208 */ |
|
209 void BroadcastPDPContextActivationFailureL( TInt aError ); |
|
210 |
|
211 /** |
|
212 * Reports PDP context disconnection |
|
213 * |
|
214 * @since S60 v3.1 |
|
215 * @param aError ? |
|
216 */ |
|
217 void BroadcastPDPContextDisconnectionL( TInt aError ); |
|
218 |
|
219 /** |
|
220 * Handles EAttachingExistingConnection request completion |
|
221 * |
|
222 * @since S60 v3.1 |
|
223 * @param aStatus ? |
|
224 */ |
|
225 void HandleAttachingExistingConnectionL( TInt aStatus ); |
|
226 |
|
227 /** |
|
228 * PDP context activation property |
|
229 * |
|
230 * @since S60 v3.1 |
|
231 */ |
|
232 void SubscribePDPContextActivation(); |
|
233 |
|
234 /** |
|
235 * ? |
|
236 * |
|
237 * @since S60 v3.1 |
|
238 * @param aStatus ? |
|
239 */ |
|
240 void PDPContextActivationIssueRequest( TRequestStatus& aStatus ); |
|
241 |
|
242 /** |
|
243 * ? |
|
244 * |
|
245 * @since S60 v3.1 |
|
246 * @param aStatus ? |
|
247 */ |
|
248 void PDPContextActivationRunL( TInt aStatus ); |
|
249 |
|
250 /** |
|
251 * ? |
|
252 * |
|
253 * @since S60 v3.1 |
|
254 */ |
|
255 void PDPContextActivationDoCancel(); |
|
256 |
|
257 /** |
|
258 * PDP context disconnection property |
|
259 * |
|
260 * @since S60 v3.1 |
|
261 */ |
|
262 void SubscribePDPContextDisconnection(); |
|
263 |
|
264 /** |
|
265 * ? |
|
266 * |
|
267 * @since S60 v3.1 |
|
268 * @param aStatus ? |
|
269 */ |
|
270 void PDPContextDisconnectionIssueRequest( TRequestStatus& aStatus ); |
|
271 |
|
272 /** |
|
273 * ? |
|
274 * |
|
275 * @since S60 v3.1 |
|
276 * @param aStatus ? |
|
277 */ |
|
278 void PDPContextDisconnectionRunL( TInt aStatus ); |
|
279 |
|
280 /** |
|
281 * ? |
|
282 * |
|
283 * @since S60 v3.1 |
|
284 */ |
|
285 void PDPContextDisconnectionDoCancel(); |
|
286 |
|
287 /** |
|
288 * Broadcast PDP context activated |
|
289 * |
|
290 * @since S60 v3.1 |
|
291 */ |
|
292 void BroadcastPDPContextActivatedL(); |
|
293 |
|
294 // From base classes CActive |
|
295 |
|
296 /** |
|
297 * From CActive |
|
298 * ? |
|
299 * |
|
300 * @since S60 v3.1 |
|
301 */ |
|
302 void RunL(); |
|
303 |
|
304 /** |
|
305 * From CActive |
|
306 * ? |
|
307 * |
|
308 * @since S60 v3.1 |
|
309 */ |
|
310 void DoCancel(); |
|
311 |
|
312 /** |
|
313 * From CActive |
|
314 * ? |
|
315 * |
|
316 * @since S60 v3.1 |
|
317 * @param aError ? |
|
318 * @return ? |
|
319 */ |
|
320 TInt RunError( TInt aError ); |
|
321 |
|
322 private: // Data |
|
323 |
|
324 /** |
|
325 * Ref: Connection observer |
|
326 */ |
|
327 MAOConnectionObserver& iObserver; |
|
328 |
|
329 /** |
|
330 * Ref: Settings |
|
331 */ |
|
332 MAOSettings& iSettings; |
|
333 |
|
334 /** |
|
335 * Not Own: Socket server session |
|
336 */ |
|
337 RSocketServ* iSocketServ; |
|
338 |
|
339 /** |
|
340 * Own: Internal state flag |
|
341 */ |
|
342 TInternalState iState; |
|
343 |
|
344 /** |
|
345 * Own: Connection timer |
|
346 */ |
|
347 CPeriodic* iConnectionTimer; |
|
348 |
|
349 /** |
|
350 * Own: PDP context activation property |
|
351 */ |
|
352 RProperty iPDPContextActivationProperty; |
|
353 |
|
354 /** |
|
355 * Own: ? |
|
356 */ |
|
357 CAOAsyncWrapper<CAOConnectionImpl>* iPDPContextActivationSubscriber; |
|
358 |
|
359 /** |
|
360 * Own: PDP context disconnection property |
|
361 */ |
|
362 RProperty iPDPContextDisconnectionProperty; |
|
363 |
|
364 /** |
|
365 * Own: ? |
|
366 */ |
|
367 CAOAsyncWrapper<CAOConnectionImpl>* iPDPContextDisconnectionSubscriber; |
|
368 |
|
369 /** |
|
370 * Own: PDP context activation error |
|
371 */ |
|
372 TInt iActivationError; |
|
373 |
|
374 /** |
|
375 * Own: PDP context activation error |
|
376 */ |
|
377 TInt iDisconnectionError; |
|
378 }; |
|
379 |
|
380 #endif /* CAOCONNECTIONIMPLSTUB_H */ |