|
1 /* |
|
2 * Copyright (c) 2005-2007 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 the License "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: State machine for IAP availability. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_OPERATION_GET_AVAILABLE_IAPS_H |
|
20 #define CORE_OPERATION_GET_AVAILABLE_IAPS_H |
|
21 |
|
22 #include "genscanlist.h" |
|
23 #include "core_operation_base.h" |
|
24 #include "core_type_list.h" |
|
25 #include "abs_core_frame_handler.h" |
|
26 #include "core_ap_data.h" |
|
27 #include "abs_core_event_handler.h" |
|
28 #include "core_scan_channels.h" |
|
29 |
|
30 class core_server_c; |
|
31 |
|
32 /** |
|
33 * State machine for IAP availability. |
|
34 * |
|
35 * @lib wlmserversrv.lib |
|
36 * @since S60 v3.1 |
|
37 */ |
|
38 NONSHARABLE_CLASS( core_operation_get_available_iaps_c ) : |
|
39 public core_operation_base_c, |
|
40 public abs_core_frame_handler_c, |
|
41 public abs_core_event_handler_c |
|
42 { |
|
43 |
|
44 public: |
|
45 |
|
46 enum core_state_e |
|
47 { |
|
48 core_state_init = core_base_state_next, |
|
49 core_state_long_broadcast_scan_start, |
|
50 core_state_long_broadcast_scan_done, |
|
51 core_state_broadcast_scan_start, |
|
52 core_state_broadcast_scan_done, |
|
53 core_state_broadcast_scan_start_unknown_region, |
|
54 core_state_broadcast_scan_complete_unknown_region, |
|
55 core_state_store_country_info, |
|
56 core_state_broadcast_scan_done_handle_result, |
|
57 core_state_direct_scan_start, |
|
58 core_state_direct_scan_done, |
|
59 core_state_secondary_ssid_check, |
|
60 core_state_secondary_ssid_next, |
|
61 core_state_secondary_ssid_start, |
|
62 core_state_secondary_ssid_done, |
|
63 core_state_scanning_done, |
|
64 core_state_MAX |
|
65 }; |
|
66 |
|
67 struct core_scan_list_entry |
|
68 { |
|
69 core_mac_address_s bssid; |
|
70 core_ssid_s ssid; |
|
71 }; |
|
72 |
|
73 /** |
|
74 * Constructor. |
|
75 * |
|
76 * @since S60 v3.1 |
|
77 * @param request_id to corresponding service request |
|
78 * @param server core server |
|
79 * @param drivers pointer to lower adaptation |
|
80 * @param adaptation pointer to upper adaptation |
|
81 * @param is_active_scan_allowed specifies whether to use probes or just listen to beacons |
|
82 * @param iap_data_list contains list of IAP data structures |
|
83 * @param iap_ssid_list List of possible secondary SSIDs |
|
84 * @param list of available IAP IDs on return |
|
85 * @param scan data of found networks on return |
|
86 */ |
|
87 core_operation_get_available_iaps_c( |
|
88 u32_t request_id, |
|
89 core_server_c* server, |
|
90 abs_core_driverif_c* drivers, |
|
91 abs_core_server_callback_c* adaptation, |
|
92 bool_t is_active_scan_allowed, |
|
93 core_type_list_c<core_iap_data_s>& iap_data_list, |
|
94 core_type_list_c<u32_t>& iap_id_list, |
|
95 core_type_list_c<core_ssid_entry_s>* iap_ssid_list, |
|
96 ScanList& scan_data ); |
|
97 |
|
98 /** |
|
99 * Destructor. |
|
100 */ |
|
101 virtual ~core_operation_get_available_iaps_c(); |
|
102 |
|
103 protected: |
|
104 |
|
105 /** |
|
106 * This method is called when a pending request has been completed |
|
107 * and so sub-operations are pending. |
|
108 * |
|
109 * @since S60 v3.1 |
|
110 * @return status of the operation: |
|
111 * core_error_request_pending if the operation is not finished, |
|
112 * otherwise the status code of the finished operation |
|
113 */ |
|
114 core_error_e next_state(); |
|
115 |
|
116 /** |
|
117 * This method is called when the operation is cancelled from the outside. |
|
118 * |
|
119 * @since S60 v3.2 |
|
120 * @param do_graceful_cancel Whether cancel should be graceful or forced. |
|
121 */ |
|
122 void user_cancel( |
|
123 bool_t do_graceful_cancel ); |
|
124 |
|
125 /** |
|
126 * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. |
|
127 * |
|
128 * @since S60 v3.1 |
|
129 * @param frame Pointer to a dot11 frame parser. |
|
130 * @param rcpi RCPI value of the frame. |
|
131 * @return true_t if the frame was handled, false_t otherwise. |
|
132 */ |
|
133 bool_t receive_frame( |
|
134 const core_frame_dot11_c* frame, |
|
135 u8_t rcpi ); |
|
136 |
|
137 /** |
|
138 * From abs_core_event_handler_c Called by the core server when an indication has been received. |
|
139 * |
|
140 * @since S60 v3.1 |
|
141 * @param indication Adaptation layer event. |
|
142 * @return true_t if the indication was handled, false_t if not handled. |
|
143 */ |
|
144 bool_t notify( |
|
145 core_am_indication_e indication ); |
|
146 |
|
147 private: // functions |
|
148 |
|
149 /** |
|
150 * Remove IAPs that are not marked hidden from the list of IAPs to search. |
|
151 */ |
|
152 void remove_non_hidden_iaps(); |
|
153 |
|
154 /** |
|
155 * Process the scan results using the given tag. |
|
156 * |
|
157 * @param tag Tag to use for iterating through the scan results. |
|
158 */ |
|
159 void process_scan_results( |
|
160 u8_t tag ); |
|
161 |
|
162 /** |
|
163 * Remove IAPs that match the given AP. |
|
164 */ |
|
165 void remove_matching_iaps( |
|
166 core_ap_data_c& ap_data ); |
|
167 |
|
168 /** |
|
169 * Calculate the amount IAPs marked as hidden from the given IAP list. |
|
170 * |
|
171 * @param iap_data_list List of IAPs to check |
|
172 * @return The amount IAPs marked as hidden. |
|
173 */ |
|
174 u8_t hidden_iap_count( |
|
175 core_type_list_c<core_iap_data_s>& iap_data_list ); |
|
176 |
|
177 /** |
|
178 * If region information is not known before the scan, also the channels 12 and 13 can be |
|
179 * scanned in passive mode. After the scan if region is still not known or region |
|
180 * limits the allowed channels, this method removes the those APs from scan list that |
|
181 * are not on valid channels. |
|
182 */ |
|
183 void remove_disallowed_aps(); |
|
184 |
|
185 /** |
|
186 * Check whether the given IAP ID has any secondary SSIDs defined. |
|
187 * |
|
188 * @param id IAP ID to match. |
|
189 * @return true_t if secondary SSIDs found, false_t otherwise. |
|
190 */ |
|
191 bool_t is_id_in_secondary_ssid_list( |
|
192 u32_t id ); |
|
193 |
|
194 /** |
|
195 * Remove all secondary SSID entries with a matching IAP ID. |
|
196 * |
|
197 * @param id IAP ID to match. |
|
198 */ |
|
199 void remove_secondary_ssid_entries_by_id( |
|
200 u32_t id ); |
|
201 |
|
202 /** |
|
203 * Check whether the given SSID is present in the scan results. |
|
204 * |
|
205 * @param ssid SSID to match. |
|
206 * @param scan_data Scan list to search. |
|
207 * @return true_t if matching SSID is found, false_t otherwise. |
|
208 */ |
|
209 bool_t is_ssid_in_scanlist( |
|
210 const core_ssid_s& ssid, |
|
211 const ScanList& scan_data ); |
|
212 |
|
213 private: // data |
|
214 |
|
215 /** |
|
216 * Whether active scanning is allowed. |
|
217 */ |
|
218 bool_t is_active_scan_allowed_m; |
|
219 |
|
220 /** |
|
221 * Whether the amount of channels scanned should be limited. |
|
222 */ |
|
223 bool_t is_limiting_algorithm_used_m; |
|
224 |
|
225 /** |
|
226 * Original list of IAPs. |
|
227 */ |
|
228 core_type_list_c<core_iap_data_s>& iap_data_list_m; |
|
229 |
|
230 /** |
|
231 * List for storing IDs of available IAPs. |
|
232 */ |
|
233 core_type_list_c<u32_t>& iap_id_list_m; |
|
234 |
|
235 /** |
|
236 * List of possible secondary SSIDs. Not owned by this pointer. |
|
237 */ |
|
238 core_type_list_c<core_ssid_entry_s>* iap_ssid_list_m; |
|
239 |
|
240 /** |
|
241 * Handle to the ScanList instance. |
|
242 */ |
|
243 ScanList& client_scan_data_m; |
|
244 |
|
245 /** |
|
246 * List of channels that have WLAN activity. |
|
247 */ |
|
248 core_scan_channels_c active_channels_m; |
|
249 |
|
250 /** |
|
251 * List of channels to scan in a broadcast scan. |
|
252 */ |
|
253 core_scan_channels_c broadcast_channels_m; |
|
254 |
|
255 /** |
|
256 * Number of channels to scan with a long broadcast scan |
|
257 */ |
|
258 u8_t long_broadcast_count_m; |
|
259 |
|
260 /** |
|
261 * List of IAPs that are not available. |
|
262 */ |
|
263 core_type_list_c<core_iap_data_s> non_found_iaps_list_m; |
|
264 |
|
265 /** |
|
266 * Defines whether a split-scan should be used. |
|
267 */ |
|
268 bool_t is_split_scan_m; |
|
269 |
|
270 /** |
|
271 * Defines the number of BSSs found during scanning. |
|
272 */ |
|
273 u8_t bss_count_m; |
|
274 |
|
275 /** |
|
276 * SSID being direct scanned. |
|
277 */ |
|
278 core_ssid_s direct_scanned_ssid_m; |
|
279 |
|
280 /** |
|
281 * Region information that is selected based on the APs country information. |
|
282 */ |
|
283 core_wlan_region_e region_from_ap_m; |
|
284 |
|
285 }; |
|
286 |
|
287 #endif // CORE_OPERATION_GET_AVAILABLE_IAPS_H |