1 /* |
|
2 * Copyright (c) 2007-2010 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: CCCHConnMonHandler declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CCHCONNMONHANDLER_H |
|
20 #define C_CCHCONNMONHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <rconnmon.h> |
|
26 |
|
27 // CONSTANTS |
|
28 // None |
|
29 |
|
30 // MACROS |
|
31 // None |
|
32 |
|
33 // DATA TYPES |
|
34 // None |
|
35 |
|
36 // FUNCTION PROTOTYPES |
|
37 // None |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CCCHServerBase; |
|
41 class MCCHConnMonHandlerNotifier; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 class TCCHConnectionInfo |
|
45 { |
|
46 public: |
|
47 TUint iIapId; |
|
48 TUint iConnId; |
|
49 }; |
|
50 |
|
51 /** |
|
52 * CCCHConnMonHandler declaration |
|
53 * Handles Connection Monitor for CCH server |
|
54 * @lib cchserver.exe |
|
55 * @since S60 3.2 |
|
56 */ |
|
57 NONSHARABLE_CLASS( CCCHConnMonHandler ) : public CActive, |
|
58 private MConnectionMonitorObserver |
|
59 { |
|
60 public: // Constructors and destructor |
|
61 |
|
62 /** |
|
63 * State's of object |
|
64 */ |
|
65 enum TCCHConnMonHandlerState |
|
66 { |
|
67 EUninitialized, /// Uninitialized |
|
68 EInitialized, /// Initalized |
|
69 EGetIAPS, |
|
70 EGetSNAPs, |
|
71 EGetIAP, |
|
72 EGetConnectionCount, |
|
73 EError /// Error condition |
|
74 }; |
|
75 |
|
76 /** |
|
77 * Two-phased constructor. |
|
78 */ |
|
79 static CCCHConnMonHandler* NewL( CCCHServerBase& aServer ); |
|
80 |
|
81 /** |
|
82 * Two-phased constructor. |
|
83 */ |
|
84 static CCCHConnMonHandler* NewLC( CCCHServerBase& aServer ); |
|
85 |
|
86 /** |
|
87 * Destructor. |
|
88 */ |
|
89 virtual ~CCCHConnMonHandler(); |
|
90 |
|
91 public: // New functions |
|
92 |
|
93 /** |
|
94 * Scan available networks |
|
95 * |
|
96 * @since S60 9.2 |
|
97 * @param aWlanScan ETrue if WLAN network scan needed |
|
98 * @param aObserver Completion notified by method |
|
99 * NetworkScanningCompletedL() if set. |
|
100 */ |
|
101 void ScanNetworks( TBool aWlanScan = EFalse, |
|
102 MCCHConnMonHandlerNotifier* aObserver = NULL ); |
|
103 |
|
104 /** |
|
105 * Cancel network scanning |
|
106 * @since S60 3.2 |
|
107 */ |
|
108 void ScanNetworksCancel(); |
|
109 |
|
110 /** |
|
111 * Is Snap available |
|
112 * @since S60 3.2 |
|
113 * @param aSNAPId |
|
114 * @return ETrue if SNAP is available |
|
115 */ |
|
116 TBool IsSNAPAvailable( TUint aSNAPId ) const; |
|
117 |
|
118 /** |
|
119 * Is IAP available |
|
120 * @since S60 3.2 |
|
121 * @param aIapId |
|
122 * @return ETrue if IAP is available |
|
123 */ |
|
124 TBool IsIapAvailable( TUint aIapId ) const; |
|
125 |
|
126 /** |
|
127 * Sets observer to notify if SNAPs availability is changed |
|
128 * |
|
129 * @since S60 9.2 |
|
130 * @param aObserver Notifies by method |
|
131 * SNAPsAvailabilityChanged(). NULL turns off notify. |
|
132 */ |
|
133 void SetSNAPsAvailabilityChangeListener( MCCHConnMonHandlerNotifier* aObserver ); |
|
134 |
|
135 /** |
|
136 * Collects all connected IAP Ids and Connection Ids to array. |
|
137 */ |
|
138 void StartMonitoringConnectionChanges(); |
|
139 |
|
140 /** |
|
141 * Connected IAPs getter. |
|
142 * @param aIapIds |
|
143 */ |
|
144 void StopMonitoringConnectionChanges( RArray<TUint>& aIapIds ); |
|
145 |
|
146 protected: // From base classes |
|
147 |
|
148 /** |
|
149 * From CActive |
|
150 * @since Series 60 3.0 |
|
151 */ |
|
152 void RunL(); |
|
153 |
|
154 /** |
|
155 * From CActive |
|
156 * @since Series 60 3.0 |
|
157 */ |
|
158 void DoCancel(); |
|
159 |
|
160 private: // From MConnectionMonitorObserver |
|
161 |
|
162 /** |
|
163 * @see MConnectionMonitorObserver, called when ConnMon event occured. |
|
164 */ |
|
165 void EventL( const CConnMonEventBase &aConnMonEvent ); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * C++ default constructor. |
|
171 */ |
|
172 CCCHConnMonHandler( CCCHServerBase& aServer ); |
|
173 |
|
174 /** |
|
175 * By default Symbian 2nd phase constructor is private. |
|
176 */ |
|
177 void ConstructL(); |
|
178 |
|
179 /** |
|
180 * Get IAPs from Connection Monitor and performs network scan |
|
181 * @since S60 3.2 |
|
182 * @param aBearerId Bearer specific connection id. |
|
183 */ |
|
184 void GetIaps( TConnMonBearerId aBearerId ); |
|
185 |
|
186 /** |
|
187 * Updates available IAP Array |
|
188 * @since S60 3.2 |
|
189 * @param aIaps available IAPs |
|
190 */ |
|
191 void UpdateIapArray( TConnMonIapInfo aIaps ); |
|
192 |
|
193 /** |
|
194 * Get SNAPs from Connection Monitor |
|
195 * @since S60 3.2 |
|
196 */ |
|
197 void GetSNAPs(); |
|
198 |
|
199 /** |
|
200 * Updates available SNAP array |
|
201 * @since S60 3.2 |
|
202 * @param aSNAPs available SNAPs |
|
203 */ |
|
204 void UpdateSnapArray( TConnMonSNAPInfo aSNAPs ); |
|
205 |
|
206 /** |
|
207 * Request SNAP/IAP availability notifications from Connection Monitor. |
|
208 * @since S60 3.2 |
|
209 */ |
|
210 void NotifyL() ; |
|
211 |
|
212 /** |
|
213 * Stops notifications. |
|
214 * @since S60 3.2 |
|
215 */ |
|
216 void StopNotify(); |
|
217 |
|
218 /** |
|
219 * Call back function to the CPeriodic. |
|
220 * |
|
221 * @since S60 9.2 |
|
222 * @param aAny A pointer to this class. |
|
223 * @return Error code |
|
224 */ |
|
225 static TInt PeriodicTimerCallBack(TAny* aAny); |
|
226 |
|
227 /** |
|
228 * Connection count solver. |
|
229 */ |
|
230 void GetConnectionCount(); |
|
231 |
|
232 /** |
|
233 * IAP Id solver. |
|
234 */ |
|
235 void GetIapId(); |
|
236 |
|
237 /** |
|
238 * Remove connected IAP id from connected IAPs array. |
|
239 * @param aConnId disconnected connection id. |
|
240 */ |
|
241 void RemoveIapId( TUint aConnId ); |
|
242 |
|
243 private: // data |
|
244 |
|
245 /** |
|
246 * State of active object |
|
247 */ |
|
248 TCCHConnMonHandlerState iState; |
|
249 |
|
250 /** |
|
251 * Handle to server |
|
252 */ |
|
253 CCCHServerBase& iServer; |
|
254 |
|
255 /** |
|
256 * Connection Monitor |
|
257 */ |
|
258 RConnectionMonitor iConnMon; |
|
259 |
|
260 /** |
|
261 * Package buffer for getting available IAPs |
|
262 */ |
|
263 TConnMonIapInfoBuf iIapsBuf; |
|
264 |
|
265 /** |
|
266 * Package buffer for getting available SNAPs |
|
267 */ |
|
268 TConnMonSNAPInfoBuf iSNAPbuf; |
|
269 |
|
270 /** |
|
271 * SNAP array |
|
272 */ |
|
273 RArray<TUint> iAvailableSNAPs; |
|
274 |
|
275 /** |
|
276 * IAP Array |
|
277 */ |
|
278 RArray<TUint> iAvailableIAPs; |
|
279 |
|
280 /** |
|
281 * Connection change listener timer. |
|
282 * owns. |
|
283 */ |
|
284 CPeriodic* iConnChangeListenerTimer; |
|
285 |
|
286 /** |
|
287 * Network scanning observer |
|
288 */ |
|
289 MCCHConnMonHandlerNotifier* iNetworkScanningObserver; |
|
290 |
|
291 /** |
|
292 * SNAPs availability change observer |
|
293 */ |
|
294 MCCHConnMonHandlerNotifier* iSNAPsAvailabilityObserver; |
|
295 |
|
296 /** |
|
297 * pending async request |
|
298 */ |
|
299 RArray<TCCHConnMonHandlerState> iPendingRequests; |
|
300 |
|
301 /** |
|
302 * Unsolved connection ids |
|
303 */ |
|
304 RArray<TUint> iUnsolvedConnIds; |
|
305 |
|
306 /** |
|
307 * Connected IAP Ids |
|
308 */ |
|
309 RArray<TCCHConnectionInfo> iConnIapIds; |
|
310 |
|
311 /** |
|
312 * Async helpers |
|
313 */ |
|
314 TUint iConnIapId; |
|
315 TUint iConnId; |
|
316 TUint iConnCount; |
|
317 }; |
|
318 |
|
319 #endif // C_CCHCONNMONHANDLER_H |
|
320 |
|
321 // End of file |
|