|
1 /* |
|
2 * Copyright (c) 2005-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 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: Statemachine for scanning |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_OPERATION_SCAN_H |
|
20 #define CORE_OPERATION_SCAN_H |
|
21 |
|
22 #include "core_operation_base.h" |
|
23 #include "abs_core_frame_handler.h" |
|
24 #include "core_type_list.h" |
|
25 #include "genscanlist.h" |
|
26 #include "abs_core_event_handler.h" |
|
27 |
|
28 class core_server_c; |
|
29 |
|
30 /** |
|
31 * Statemachine for loading the drivers |
|
32 * |
|
33 * @lib wlmserversrv.lib |
|
34 * @since S60 v3.1 |
|
35 */ |
|
36 NONSHARABLE_CLASS( core_operation_scan_c ) : |
|
37 public core_operation_base_c, |
|
38 public abs_core_frame_handler_c, |
|
39 public abs_core_event_handler_c |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 enum core_state_e |
|
45 { |
|
46 core_state_init = core_base_state_next, |
|
47 core_state_scan_start, |
|
48 core_state_scan_complete, |
|
49 core_state_scan_start_unknown_region, |
|
50 core_state_scan_complete_unknown_region, |
|
51 core_state_scan_complete_store_country_info, |
|
52 core_state_scan_complete_handle_result, |
|
53 core_state_rcpi_received, |
|
54 core_state_scanning_done, |
|
55 core_state_MAX |
|
56 }; |
|
57 |
|
58 /** |
|
59 * Constructor. |
|
60 */ |
|
61 core_operation_scan_c( |
|
62 u32_t request_id, |
|
63 core_server_c* server, |
|
64 abs_core_driverif_c* drivers, |
|
65 abs_core_server_callback_c* adaptation, |
|
66 core_scan_mode_e scan_mode, |
|
67 const core_ssid_s& scan_ssid, |
|
68 const core_scan_channels_s& scan_channels, |
|
69 u8_t scan_max_age, |
|
70 ScanList& scan_data, |
|
71 bool_t passive_scan_all_channels, |
|
72 bool_t is_current_ap_added ); |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 virtual ~core_operation_scan_c(); |
|
78 |
|
79 /** |
|
80 * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. |
|
81 * |
|
82 * @since S60 v3.1 |
|
83 * @param frame Pointer to a dot11 frame parser. |
|
84 * @param rcpi RCPI value of the frame. |
|
85 * @return true_t if the frame was handled, false_t otherwise. |
|
86 */ |
|
87 bool_t receive_frame( |
|
88 const core_frame_dot11_c* frame, |
|
89 u8_t rcpi ); |
|
90 |
|
91 protected: |
|
92 |
|
93 /** |
|
94 * This method is called when a pending request has been completed |
|
95 * and so sub-operations are pending. |
|
96 * |
|
97 * @since S60 v3.1 |
|
98 * @return status of the operation: |
|
99 * core_error_request_pending if the operation is not finished, |
|
100 * otherwise the status code of the finished operation |
|
101 */ |
|
102 core_error_e next_state(); |
|
103 |
|
104 /** |
|
105 * This method is called when the operation is cancelled from the outside. |
|
106 * |
|
107 * @since S60 v3.2 |
|
108 * @param do_graceful_cancel Whether cancel should be graceful or forced. |
|
109 */ |
|
110 void user_cancel( |
|
111 bool_t do_graceful_cancel ); |
|
112 |
|
113 /** |
|
114 * From abs_core_event_handler_c Called by the core server when an indication has been received. |
|
115 * |
|
116 * @since S60 v3.1 |
|
117 * @param indication Adaptation layer event. |
|
118 * @return true_t if the indication was handled, false_t if not handled. |
|
119 */ |
|
120 bool_t notify( |
|
121 core_am_indication_e indication ); |
|
122 |
|
123 private: |
|
124 |
|
125 /** |
|
126 * If region information is not known before the scan, also the channels 12 and 13 can be |
|
127 * scanned in passive mode. After the scan if region is still not known or region |
|
128 * limits the allowed channels, this method removes the those APs from scan list that |
|
129 * are not on valid channels. |
|
130 * |
|
131 * @since S60 v5.0 |
|
132 */ |
|
133 void remove_disallowed_aps(); |
|
134 |
|
135 private: // data |
|
136 |
|
137 /** |
|
138 * The scanning mode. |
|
139 */ |
|
140 const core_scan_mode_e scan_mode_m; |
|
141 |
|
142 /** |
|
143 * The SSID to be scanned. |
|
144 */ |
|
145 const core_ssid_s& scan_ssid_m; |
|
146 |
|
147 /** |
|
148 * The channels to be scanned. |
|
149 */ |
|
150 const core_scan_channels_s& scan_channels_m; |
|
151 |
|
152 /** |
|
153 * The maximum age of returned scan results. |
|
154 */ |
|
155 const u8_t scan_max_age_m; |
|
156 |
|
157 /** |
|
158 * Handle to the ScanList instance. |
|
159 */ |
|
160 ScanList& scan_data_m; |
|
161 |
|
162 /** |
|
163 * Whether all channels should be scanned in passive mode if region information (MCC) is not known. |
|
164 */ |
|
165 const bool_t passive_scan_all_channels_m; |
|
166 |
|
167 /** |
|
168 * Region information that is selected based on the APs country information. |
|
169 */ |
|
170 core_wlan_region_e region_from_ap_m; |
|
171 |
|
172 /** |
|
173 * Whether the current AP needs be added during an ongoing connection if not otherwise |
|
174 * found in the scan. |
|
175 */ |
|
176 const bool_t is_current_ap_added_m; |
|
177 |
|
178 /** |
|
179 * Current RCPI value. |
|
180 */ |
|
181 u32_t current_rcpi_m; |
|
182 |
|
183 }; |
|
184 |
|
185 #endif // CORE_OPERATION_SCAN_H |