|
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 #ifndef CAOCONNECTIONIMPL_H |
|
20 #define CAOCONNECTIONIMPL_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32base.h> |
|
24 #include <commdbconnpref.h> |
|
25 #include <es_sock.h> |
|
26 #include <commdb.h> |
|
27 #include "maoconnectionmanager.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MAOSettings; |
|
31 class CCommsDatabase; |
|
32 class MAOConnectionObserver; |
|
33 |
|
34 /** |
|
35 * Connection implementation. |
|
36 * @see CAOConnection |
|
37 * |
|
38 * @lib PDPContextManager.lib |
|
39 * @since S60 v3.1 |
|
40 */ |
|
41 NONSHARABLE_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 }; |
|
54 |
|
55 public: // Constructors & destructors |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * |
|
60 * @since S60 v3.1 |
|
61 * @param aObserver ? |
|
62 * @param aSettings ? |
|
63 * @param aSocketServ ? |
|
64 * @return ? |
|
65 */ |
|
66 static CAOConnectionImpl* NewL( MAOConnectionObserver& aObserver, |
|
67 MAOSettings& aSettings, |
|
68 RSocketServ* aSocketServ ); |
|
69 |
|
70 /** |
|
71 * Default destructor |
|
72 * |
|
73 * @since S60 v3.1 |
|
74 */ |
|
75 virtual ~CAOConnectionImpl(); |
|
76 |
|
77 /** |
|
78 * Starts a new connection if none exists. |
|
79 * |
|
80 * @since S60 v3.1 |
|
81 */ |
|
82 void ActivateConnection(); |
|
83 |
|
84 /** |
|
85 * Cancels any outstanding connections. |
|
86 * |
|
87 * @since S60 v3.1 |
|
88 */ |
|
89 void CancelConnection(); |
|
90 |
|
91 /** |
|
92 * Checks if there is already a connection ongoing. |
|
93 * |
|
94 * @since S60 v3.1 |
|
95 * @return ETrue if there is connection |
|
96 */ |
|
97 TBool IsConnectedToDefaultIAP(); |
|
98 |
|
99 /** |
|
100 * Returns number of ongoing connections. |
|
101 * |
|
102 * @since 3.0 |
|
103 * @return TInt |
|
104 */ |
|
105 TInt NumberOfConnections(); |
|
106 |
|
107 /** |
|
108 * Closes connection (detaches) without stopping it. |
|
109 * |
|
110 * @since 3.2 |
|
111 * @return void |
|
112 */ |
|
113 void CloseConnection(); |
|
114 |
|
115 private: // New methods |
|
116 |
|
117 /** |
|
118 * Default constructor. |
|
119 * @param aObserver ? |
|
120 * @param aSettings ? |
|
121 * @param aSocketServ ? |
|
122 */ |
|
123 CAOConnectionImpl( MAOConnectionObserver& aObserver, |
|
124 MAOSettings& aSettings, |
|
125 RSocketServ* aSocketServ ); |
|
126 |
|
127 /** |
|
128 * Default Symbian constructor |
|
129 */ |
|
130 void ConstructL(); |
|
131 |
|
132 /** |
|
133 * Checks if current IAP is valid |
|
134 * |
|
135 * @since S60 v3.1 |
|
136 * @param aId ? |
|
137 * @return ? |
|
138 */ |
|
139 TBool IsValidIAP( TUint32 aId ) const; |
|
140 |
|
141 /** |
|
142 * Complete self |
|
143 * |
|
144 * @since S60 v3.1 |
|
145 * @param aStatus ? |
|
146 * @param aReason ? |
|
147 */ |
|
148 void CompleteSelf( TRequestStatus& aStatus, TInt aReason ); |
|
149 |
|
150 /** |
|
151 * Handle method for EOpeningLink state |
|
152 * |
|
153 * @since S60 v3.1 |
|
154 * @param aStatus ? |
|
155 */ |
|
156 void HandleOpeningLinkL( TInt aStatus ); |
|
157 |
|
158 /** |
|
159 * Handle method for EListeningAccessPoint state |
|
160 * |
|
161 * @since S60 v3.1 |
|
162 * @param aStatus ? |
|
163 */ |
|
164 void HandleListeningAccessPointL( TInt aStatus ); |
|
165 |
|
166 /** |
|
167 * Change state |
|
168 * |
|
169 * @since S60 v3.1 |
|
170 * @param aNewState ? |
|
171 */ |
|
172 void ChangeState( TInternalState aNewState ); |
|
173 |
|
174 /** |
|
175 * Issue progress notification |
|
176 * |
|
177 * @since S60 v3.1 |
|
178 */ |
|
179 void IssueProgressNotification(); |
|
180 |
|
181 /** |
|
182 * Sends 'disconnected' error |
|
183 * |
|
184 * @since S60 v3.1 |
|
185 * @param aError ? |
|
186 */ |
|
187 void BrodcastDisconnectedError( TInt aError ); |
|
188 |
|
189 /** |
|
190 * Sends 'activation failed' error |
|
191 * |
|
192 * @since S60 v3.1 |
|
193 * @param aError ? |
|
194 */ |
|
195 void BrodcastActivationFailedError( TInt aError ); |
|
196 |
|
197 /** |
|
198 * Converts error code to failure reason |
|
199 * |
|
200 * @since S60 v3.1 |
|
201 * @param aError ? |
|
202 * @return ? |
|
203 */ |
|
204 MAOConnectionManager::TFailureReason FailureReason( TInt aError ); |
|
205 |
|
206 /** |
|
207 * Activates self |
|
208 * |
|
209 * @since S60 v3.1 |
|
210 * @param aCode ? |
|
211 */ |
|
212 void ActivateSelf( TInt aCode ); |
|
213 |
|
214 /** |
|
215 * Stops connection |
|
216 * |
|
217 * @since S60 v3.1 |
|
218 */ |
|
219 void StopConnection(); |
|
220 |
|
221 // From base classes CActive |
|
222 |
|
223 /** |
|
224 * From CActive |
|
225 * ? |
|
226 * |
|
227 * @since S60 v3.1 |
|
228 */ |
|
229 void RunL(); |
|
230 |
|
231 /** |
|
232 * From CActive |
|
233 * ? |
|
234 * |
|
235 * @since S60 v3.1 |
|
236 */ |
|
237 void DoCancel(); |
|
238 |
|
239 /** |
|
240 * From CActive |
|
241 * ? |
|
242 * |
|
243 * @since S60 v3.1 |
|
244 * @param aError ? |
|
245 * @return ? |
|
246 */ |
|
247 TInt RunError( TInt aError ); |
|
248 |
|
249 private: // Data |
|
250 |
|
251 /** |
|
252 * Ref: Connection observer |
|
253 */ |
|
254 MAOConnectionObserver& iObserver; |
|
255 |
|
256 /** |
|
257 * Ref: Settings |
|
258 */ |
|
259 MAOSettings& iSettings; |
|
260 |
|
261 /** |
|
262 * Not Own: Socket server session |
|
263 */ |
|
264 RSocketServ* iSocketServ; |
|
265 |
|
266 /** |
|
267 * Own: Connection |
|
268 */ |
|
269 RConnection iConnection; |
|
270 |
|
271 /** |
|
272 * Own: Progress notification buffer |
|
273 */ |
|
274 TNifProgressBuf iProgressBuf; |
|
275 |
|
276 /** |
|
277 * Own: Internal state flag |
|
278 */ |
|
279 TInternalState iState; |
|
280 |
|
281 /** |
|
282 * Own: Access point settings |
|
283 */ |
|
284 TCommDbConnPref iAccessPointSettings; |
|
285 |
|
286 /** |
|
287 * Own: Comms database |
|
288 */ |
|
289 CCommsDatabase* iCommsDatabase; |
|
290 }; |
|
291 #endif /* CAOCONNECTIONIMPL_H */ |